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