1
2
3
4
5
6
7 package org.apache.hadoop.hbase.thrift2.generated;
8
9 import org.apache.thrift.scheme.IScheme;
10 import org.apache.thrift.scheme.SchemeFactory;
11 import org.apache.thrift.scheme.StandardScheme;
12
13 import org.apache.thrift.scheme.TupleScheme;
14 import org.apache.thrift.protocol.TTupleProtocol;
15 import java.util.List;
16 import java.util.ArrayList;
17 import java.util.Map;
18 import java.util.HashMap;
19 import java.util.EnumMap;
20 import java.util.Set;
21 import java.util.HashSet;
22 import java.util.EnumSet;
23 import java.util.Collections;
24 import java.util.BitSet;
25 import java.nio.ByteBuffer;
26 import java.util.Arrays;
27 import org.slf4j.Logger;
28 import org.slf4j.LoggerFactory;
29
30 public class TTimeRange implements org.apache.thrift.TBase<TTimeRange, TTimeRange._Fields>, java.io.Serializable, Cloneable {
31 private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TTimeRange");
32
33 private static final org.apache.thrift.protocol.TField MIN_STAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("minStamp", org.apache.thrift.protocol.TType.I64, (short)1);
34 private static final org.apache.thrift.protocol.TField MAX_STAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("maxStamp", org.apache.thrift.protocol.TType.I64, (short)2);
35
36 private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
37 static {
38 schemes.put(StandardScheme.class, new TTimeRangeStandardSchemeFactory());
39 schemes.put(TupleScheme.class, new TTimeRangeTupleSchemeFactory());
40 }
41
42 public long minStamp;
43 public long maxStamp;
44
45
46 public enum _Fields implements org.apache.thrift.TFieldIdEnum {
47 MIN_STAMP((short)1, "minStamp"),
48 MAX_STAMP((short)2, "maxStamp");
49
50 private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
51
52 static {
53 for (_Fields field : EnumSet.allOf(_Fields.class)) {
54 byName.put(field.getFieldName(), field);
55 }
56 }
57
58
59
60
61 public static _Fields findByThriftId(int fieldId) {
62 switch(fieldId) {
63 case 1:
64 return MIN_STAMP;
65 case 2:
66 return MAX_STAMP;
67 default:
68 return null;
69 }
70 }
71
72
73
74
75
76 public static _Fields findByThriftIdOrThrow(int fieldId) {
77 _Fields fields = findByThriftId(fieldId);
78 if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
79 return fields;
80 }
81
82
83
84
85 public static _Fields findByName(String name) {
86 return byName.get(name);
87 }
88
89 private final short _thriftId;
90 private final String _fieldName;
91
92 _Fields(short thriftId, String fieldName) {
93 _thriftId = thriftId;
94 _fieldName = fieldName;
95 }
96
97 public short getThriftFieldId() {
98 return _thriftId;
99 }
100
101 public String getFieldName() {
102 return _fieldName;
103 }
104 }
105
106
107 private static final int __MINSTAMP_ISSET_ID = 0;
108 private static final int __MAXSTAMP_ISSET_ID = 1;
109 private BitSet __isset_bit_vector = new BitSet(2);
110 public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
111 static {
112 Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
113 tmpMap.put(_Fields.MIN_STAMP, new org.apache.thrift.meta_data.FieldMetaData("minStamp", org.apache.thrift.TFieldRequirementType.REQUIRED,
114 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
115 tmpMap.put(_Fields.MAX_STAMP, new org.apache.thrift.meta_data.FieldMetaData("maxStamp", org.apache.thrift.TFieldRequirementType.REQUIRED,
116 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
117 metaDataMap = Collections.unmodifiableMap(tmpMap);
118 org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TTimeRange.class, metaDataMap);
119 }
120
121 public TTimeRange() {
122 }
123
124 public TTimeRange(
125 long minStamp,
126 long maxStamp)
127 {
128 this();
129 this.minStamp = minStamp;
130 setMinStampIsSet(true);
131 this.maxStamp = maxStamp;
132 setMaxStampIsSet(true);
133 }
134
135
136
137
138 public TTimeRange(TTimeRange other) {
139 __isset_bit_vector.clear();
140 __isset_bit_vector.or(other.__isset_bit_vector);
141 this.minStamp = other.minStamp;
142 this.maxStamp = other.maxStamp;
143 }
144
145 public TTimeRange deepCopy() {
146 return new TTimeRange(this);
147 }
148
149 @Override
150 public void clear() {
151 setMinStampIsSet(false);
152 this.minStamp = 0;
153 setMaxStampIsSet(false);
154 this.maxStamp = 0;
155 }
156
157 public long getMinStamp() {
158 return this.minStamp;
159 }
160
161 public TTimeRange setMinStamp(long minStamp) {
162 this.minStamp = minStamp;
163 setMinStampIsSet(true);
164 return this;
165 }
166
167 public void unsetMinStamp() {
168 __isset_bit_vector.clear(__MINSTAMP_ISSET_ID);
169 }
170
171
172 public boolean isSetMinStamp() {
173 return __isset_bit_vector.get(__MINSTAMP_ISSET_ID);
174 }
175
176 public void setMinStampIsSet(boolean value) {
177 __isset_bit_vector.set(__MINSTAMP_ISSET_ID, value);
178 }
179
180 public long getMaxStamp() {
181 return this.maxStamp;
182 }
183
184 public TTimeRange setMaxStamp(long maxStamp) {
185 this.maxStamp = maxStamp;
186 setMaxStampIsSet(true);
187 return this;
188 }
189
190 public void unsetMaxStamp() {
191 __isset_bit_vector.clear(__MAXSTAMP_ISSET_ID);
192 }
193
194
195 public boolean isSetMaxStamp() {
196 return __isset_bit_vector.get(__MAXSTAMP_ISSET_ID);
197 }
198
199 public void setMaxStampIsSet(boolean value) {
200 __isset_bit_vector.set(__MAXSTAMP_ISSET_ID, value);
201 }
202
203 public void setFieldValue(_Fields field, Object value) {
204 switch (field) {
205 case MIN_STAMP:
206 if (value == null) {
207 unsetMinStamp();
208 } else {
209 setMinStamp((Long)value);
210 }
211 break;
212
213 case MAX_STAMP:
214 if (value == null) {
215 unsetMaxStamp();
216 } else {
217 setMaxStamp((Long)value);
218 }
219 break;
220
221 }
222 }
223
224 public Object getFieldValue(_Fields field) {
225 switch (field) {
226 case MIN_STAMP:
227 return Long.valueOf(getMinStamp());
228
229 case MAX_STAMP:
230 return Long.valueOf(getMaxStamp());
231
232 }
233 throw new IllegalStateException();
234 }
235
236
237 public boolean isSet(_Fields field) {
238 if (field == null) {
239 throw new IllegalArgumentException();
240 }
241
242 switch (field) {
243 case MIN_STAMP:
244 return isSetMinStamp();
245 case MAX_STAMP:
246 return isSetMaxStamp();
247 }
248 throw new IllegalStateException();
249 }
250
251 @Override
252 public boolean equals(Object that) {
253 if (that == null)
254 return false;
255 if (that instanceof TTimeRange)
256 return this.equals((TTimeRange)that);
257 return false;
258 }
259
260 public boolean equals(TTimeRange that) {
261 if (that == null)
262 return false;
263
264 boolean this_present_minStamp = true;
265 boolean that_present_minStamp = true;
266 if (this_present_minStamp || that_present_minStamp) {
267 if (!(this_present_minStamp && that_present_minStamp))
268 return false;
269 if (this.minStamp != that.minStamp)
270 return false;
271 }
272
273 boolean this_present_maxStamp = true;
274 boolean that_present_maxStamp = true;
275 if (this_present_maxStamp || that_present_maxStamp) {
276 if (!(this_present_maxStamp && that_present_maxStamp))
277 return false;
278 if (this.maxStamp != that.maxStamp)
279 return false;
280 }
281
282 return true;
283 }
284
285 @Override
286 public int hashCode() {
287 return 0;
288 }
289
290 public int compareTo(TTimeRange other) {
291 if (!getClass().equals(other.getClass())) {
292 return getClass().getName().compareTo(other.getClass().getName());
293 }
294
295 int lastComparison = 0;
296 TTimeRange typedOther = (TTimeRange)other;
297
298 lastComparison = Boolean.valueOf(isSetMinStamp()).compareTo(typedOther.isSetMinStamp());
299 if (lastComparison != 0) {
300 return lastComparison;
301 }
302 if (isSetMinStamp()) {
303 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.minStamp, typedOther.minStamp);
304 if (lastComparison != 0) {
305 return lastComparison;
306 }
307 }
308 lastComparison = Boolean.valueOf(isSetMaxStamp()).compareTo(typedOther.isSetMaxStamp());
309 if (lastComparison != 0) {
310 return lastComparison;
311 }
312 if (isSetMaxStamp()) {
313 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.maxStamp, typedOther.maxStamp);
314 if (lastComparison != 0) {
315 return lastComparison;
316 }
317 }
318 return 0;
319 }
320
321 public _Fields fieldForId(int fieldId) {
322 return _Fields.findByThriftId(fieldId);
323 }
324
325 public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
326 schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
327 }
328
329 public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
330 schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
331 }
332
333 @Override
334 public String toString() {
335 StringBuilder sb = new StringBuilder("TTimeRange(");
336 boolean first = true;
337
338 sb.append("minStamp:");
339 sb.append(this.minStamp);
340 first = false;
341 if (!first) sb.append(", ");
342 sb.append("maxStamp:");
343 sb.append(this.maxStamp);
344 first = false;
345 sb.append(")");
346 return sb.toString();
347 }
348
349 public void validate() throws org.apache.thrift.TException {
350
351
352
353 }
354
355 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
356 try {
357 write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
358 } catch (org.apache.thrift.TException te) {
359 throw new java.io.IOException(te);
360 }
361 }
362
363 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
364 try {
365
366 __isset_bit_vector = new BitSet(1);
367 read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
368 } catch (org.apache.thrift.TException te) {
369 throw new java.io.IOException(te);
370 }
371 }
372
373 private static class TTimeRangeStandardSchemeFactory implements SchemeFactory {
374 public TTimeRangeStandardScheme getScheme() {
375 return new TTimeRangeStandardScheme();
376 }
377 }
378
379 private static class TTimeRangeStandardScheme extends StandardScheme<TTimeRange> {
380
381 public void read(org.apache.thrift.protocol.TProtocol iprot, TTimeRange struct) throws org.apache.thrift.TException {
382 org.apache.thrift.protocol.TField schemeField;
383 iprot.readStructBegin();
384 while (true)
385 {
386 schemeField = iprot.readFieldBegin();
387 if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
388 break;
389 }
390 switch (schemeField.id) {
391 case 1:
392 if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
393 struct.minStamp = iprot.readI64();
394 struct.setMinStampIsSet(true);
395 } else {
396 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
397 }
398 break;
399 case 2:
400 if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
401 struct.maxStamp = iprot.readI64();
402 struct.setMaxStampIsSet(true);
403 } else {
404 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
405 }
406 break;
407 default:
408 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
409 }
410 iprot.readFieldEnd();
411 }
412 iprot.readStructEnd();
413
414
415 if (!struct.isSetMinStamp()) {
416 throw new org.apache.thrift.protocol.TProtocolException("Required field 'minStamp' was not found in serialized data! Struct: " + toString());
417 }
418 if (!struct.isSetMaxStamp()) {
419 throw new org.apache.thrift.protocol.TProtocolException("Required field 'maxStamp' was not found in serialized data! Struct: " + toString());
420 }
421 struct.validate();
422 }
423
424 public void write(org.apache.thrift.protocol.TProtocol oprot, TTimeRange struct) throws org.apache.thrift.TException {
425 struct.validate();
426
427 oprot.writeStructBegin(STRUCT_DESC);
428 oprot.writeFieldBegin(MIN_STAMP_FIELD_DESC);
429 oprot.writeI64(struct.minStamp);
430 oprot.writeFieldEnd();
431 oprot.writeFieldBegin(MAX_STAMP_FIELD_DESC);
432 oprot.writeI64(struct.maxStamp);
433 oprot.writeFieldEnd();
434 oprot.writeFieldStop();
435 oprot.writeStructEnd();
436 }
437
438 }
439
440 private static class TTimeRangeTupleSchemeFactory implements SchemeFactory {
441 public TTimeRangeTupleScheme getScheme() {
442 return new TTimeRangeTupleScheme();
443 }
444 }
445
446 private static class TTimeRangeTupleScheme extends TupleScheme<TTimeRange> {
447
448 @Override
449 public void write(org.apache.thrift.protocol.TProtocol prot, TTimeRange struct) throws org.apache.thrift.TException {
450 TTupleProtocol oprot = (TTupleProtocol) prot;
451 oprot.writeI64(struct.minStamp);
452 oprot.writeI64(struct.maxStamp);
453 }
454
455 @Override
456 public void read(org.apache.thrift.protocol.TProtocol prot, TTimeRange struct) throws org.apache.thrift.TException {
457 TTupleProtocol iprot = (TTupleProtocol) prot;
458 struct.minStamp = iprot.readI64();
459 struct.setMinStampIsSet(true);
460 struct.maxStamp = iprot.readI64();
461 struct.setMaxStampIsSet(true);
462 }
463 }
464
465 }
466