1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 /**
18 * Autogenerated by Thrift Compiler (0.9.0)
19 *
20 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
21 * @generated
22 */
23 package org.apache.accumulo.core.data.thrift;
24
25 import org.apache.thrift.scheme.IScheme;
26 import org.apache.thrift.scheme.SchemeFactory;
27 import org.apache.thrift.scheme.StandardScheme;
28
29 import org.apache.thrift.scheme.TupleScheme;
30 import org.apache.thrift.protocol.TTupleProtocol;
31 import org.apache.thrift.protocol.TProtocolException;
32 import org.apache.thrift.EncodingUtils;
33 import org.apache.thrift.TException;
34 import java.util.List;
35 import java.util.ArrayList;
36 import java.util.Map;
37 import java.util.HashMap;
38 import java.util.EnumMap;
39 import java.util.Set;
40 import java.util.HashSet;
41 import java.util.EnumSet;
42 import java.util.Collections;
43 import java.util.BitSet;
44 import java.nio.ByteBuffer;
45 import java.util.Arrays;
46 import org.slf4j.Logger;
47 import org.slf4j.LoggerFactory;
48
49 @SuppressWarnings("all") public class TKeyExtent implements org.apache.thrift.TBase<TKeyExtent, TKeyExtent._Fields>, java.io.Serializable, Cloneable {
50 private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TKeyExtent");
51
52 private static final org.apache.thrift.protocol.TField TABLE_FIELD_DESC = new org.apache.thrift.protocol.TField("table", org.apache.thrift.protocol.TType.STRING, (short)1);
53 private static final org.apache.thrift.protocol.TField END_ROW_FIELD_DESC = new org.apache.thrift.protocol.TField("endRow", org.apache.thrift.protocol.TType.STRING, (short)2);
54 private static final org.apache.thrift.protocol.TField PREV_END_ROW_FIELD_DESC = new org.apache.thrift.protocol.TField("prevEndRow", org.apache.thrift.protocol.TType.STRING, (short)3);
55
56 private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
57 static {
58 schemes.put(StandardScheme.class, new TKeyExtentStandardSchemeFactory());
59 schemes.put(TupleScheme.class, new TKeyExtentTupleSchemeFactory());
60 }
61
62 public ByteBuffer table;
63 public ByteBuffer endRow;
64 public ByteBuffer prevEndRow;
65
66 /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
67 @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
68 TABLE((short)1, "table"),
69 END_ROW((short)2, "endRow"),
70 PREV_END_ROW((short)3, "prevEndRow");
71
72 private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
73
74 static {
75 for (_Fields field : EnumSet.allOf(_Fields.class)) {
76 byName.put(field.getFieldName(), field);
77 }
78 }
79
80 /**
81 * Find the _Fields constant that matches fieldId, or null if its not found.
82 */
83 public static _Fields findByThriftId(int fieldId) {
84 switch(fieldId) {
85 case 1:
86 return TABLE;
87 case 2:
88 return END_ROW;
89 case 3:
90 return PREV_END_ROW;
91 default:
92 return null;
93 }
94 }
95
96 /**
97 * Find the _Fields constant that matches fieldId, throwing an exception
98 * if it is not found.
99 */
100 public static _Fields findByThriftIdOrThrow(int fieldId) {
101 _Fields fields = findByThriftId(fieldId);
102 if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
103 return fields;
104 }
105
106 /**
107 * Find the _Fields constant that matches name, or null if its not found.
108 */
109 public static _Fields findByName(String name) {
110 return byName.get(name);
111 }
112
113 private final short _thriftId;
114 private final String _fieldName;
115
116 _Fields(short thriftId, String fieldName) {
117 _thriftId = thriftId;
118 _fieldName = fieldName;
119 }
120
121 public short getThriftFieldId() {
122 return _thriftId;
123 }
124
125 public String getFieldName() {
126 return _fieldName;
127 }
128 }
129
130
131 public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
132 static {
133 Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
134 tmpMap.put(_Fields.TABLE, new org.apache.thrift.meta_data.FieldMetaData("table", org.apache.thrift.TFieldRequirementType.DEFAULT,
135 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
136 tmpMap.put(_Fields.END_ROW, new org.apache.thrift.meta_data.FieldMetaData("endRow", org.apache.thrift.TFieldRequirementType.DEFAULT,
137 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
138 tmpMap.put(_Fields.PREV_END_ROW, new org.apache.thrift.meta_data.FieldMetaData("prevEndRow", org.apache.thrift.TFieldRequirementType.DEFAULT,
139 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
140 metaDataMap = Collections.unmodifiableMap(tmpMap);
141 org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TKeyExtent.class, metaDataMap);
142 }
143
144 public TKeyExtent() {
145 }
146
147 public TKeyExtent(
148 ByteBuffer table,
149 ByteBuffer endRow,
150 ByteBuffer prevEndRow)
151 {
152 this();
153 this.table = table;
154 this.endRow = endRow;
155 this.prevEndRow = prevEndRow;
156 }
157
158 /**
159 * Performs a deep copy on <i>other</i>.
160 */
161 public TKeyExtent(TKeyExtent other) {
162 if (other.isSetTable()) {
163 this.table = org.apache.thrift.TBaseHelper.copyBinary(other.table);
164 ;
165 }
166 if (other.isSetEndRow()) {
167 this.endRow = org.apache.thrift.TBaseHelper.copyBinary(other.endRow);
168 ;
169 }
170 if (other.isSetPrevEndRow()) {
171 this.prevEndRow = org.apache.thrift.TBaseHelper.copyBinary(other.prevEndRow);
172 ;
173 }
174 }
175
176 public TKeyExtent deepCopy() {
177 return new TKeyExtent(this);
178 }
179
180 @Override
181 public void clear() {
182 this.table = null;
183 this.endRow = null;
184 this.prevEndRow = null;
185 }
186
187 public byte[] getTable() {
188 setTable(org.apache.thrift.TBaseHelper.rightSize(table));
189 return table == null ? null : table.array();
190 }
191
192 public ByteBuffer bufferForTable() {
193 return table;
194 }
195
196 public TKeyExtent setTable(byte[] table) {
197 setTable(table == null ? (ByteBuffer)null : ByteBuffer.wrap(table));
198 return this;
199 }
200
201 public TKeyExtent setTable(ByteBuffer table) {
202 this.table = table;
203 return this;
204 }
205
206 public void unsetTable() {
207 this.table = null;
208 }
209
210 /** Returns true if field table is set (has been assigned a value) and false otherwise */
211 public boolean isSetTable() {
212 return this.table != null;
213 }
214
215 public void setTableIsSet(boolean value) {
216 if (!value) {
217 this.table = null;
218 }
219 }
220
221 public byte[] getEndRow() {
222 setEndRow(org.apache.thrift.TBaseHelper.rightSize(endRow));
223 return endRow == null ? null : endRow.array();
224 }
225
226 public ByteBuffer bufferForEndRow() {
227 return endRow;
228 }
229
230 public TKeyExtent setEndRow(byte[] endRow) {
231 setEndRow(endRow == null ? (ByteBuffer)null : ByteBuffer.wrap(endRow));
232 return this;
233 }
234
235 public TKeyExtent setEndRow(ByteBuffer endRow) {
236 this.endRow = endRow;
237 return this;
238 }
239
240 public void unsetEndRow() {
241 this.endRow = null;
242 }
243
244 /** Returns true if field endRow is set (has been assigned a value) and false otherwise */
245 public boolean isSetEndRow() {
246 return this.endRow != null;
247 }
248
249 public void setEndRowIsSet(boolean value) {
250 if (!value) {
251 this.endRow = null;
252 }
253 }
254
255 public byte[] getPrevEndRow() {
256 setPrevEndRow(org.apache.thrift.TBaseHelper.rightSize(prevEndRow));
257 return prevEndRow == null ? null : prevEndRow.array();
258 }
259
260 public ByteBuffer bufferForPrevEndRow() {
261 return prevEndRow;
262 }
263
264 public TKeyExtent setPrevEndRow(byte[] prevEndRow) {
265 setPrevEndRow(prevEndRow == null ? (ByteBuffer)null : ByteBuffer.wrap(prevEndRow));
266 return this;
267 }
268
269 public TKeyExtent setPrevEndRow(ByteBuffer prevEndRow) {
270 this.prevEndRow = prevEndRow;
271 return this;
272 }
273
274 public void unsetPrevEndRow() {
275 this.prevEndRow = null;
276 }
277
278 /** Returns true if field prevEndRow is set (has been assigned a value) and false otherwise */
279 public boolean isSetPrevEndRow() {
280 return this.prevEndRow != null;
281 }
282
283 public void setPrevEndRowIsSet(boolean value) {
284 if (!value) {
285 this.prevEndRow = null;
286 }
287 }
288
289 public void setFieldValue(_Fields field, Object value) {
290 switch (field) {
291 case TABLE:
292 if (value == null) {
293 unsetTable();
294 } else {
295 setTable((ByteBuffer)value);
296 }
297 break;
298
299 case END_ROW:
300 if (value == null) {
301 unsetEndRow();
302 } else {
303 setEndRow((ByteBuffer)value);
304 }
305 break;
306
307 case PREV_END_ROW:
308 if (value == null) {
309 unsetPrevEndRow();
310 } else {
311 setPrevEndRow((ByteBuffer)value);
312 }
313 break;
314
315 }
316 }
317
318 public Object getFieldValue(_Fields field) {
319 switch (field) {
320 case TABLE:
321 return getTable();
322
323 case END_ROW:
324 return getEndRow();
325
326 case PREV_END_ROW:
327 return getPrevEndRow();
328
329 }
330 throw new IllegalStateException();
331 }
332
333 /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
334 public boolean isSet(_Fields field) {
335 if (field == null) {
336 throw new IllegalArgumentException();
337 }
338
339 switch (field) {
340 case TABLE:
341 return isSetTable();
342 case END_ROW:
343 return isSetEndRow();
344 case PREV_END_ROW:
345 return isSetPrevEndRow();
346 }
347 throw new IllegalStateException();
348 }
349
350 @Override
351 public boolean equals(Object that) {
352 if (that == null)
353 return false;
354 if (that instanceof TKeyExtent)
355 return this.equals((TKeyExtent)that);
356 return false;
357 }
358
359 public boolean equals(TKeyExtent that) {
360 if (that == null)
361 return false;
362
363 boolean this_present_table = true && this.isSetTable();
364 boolean that_present_table = true && that.isSetTable();
365 if (this_present_table || that_present_table) {
366 if (!(this_present_table && that_present_table))
367 return false;
368 if (!this.table.equals(that.table))
369 return false;
370 }
371
372 boolean this_present_endRow = true && this.isSetEndRow();
373 boolean that_present_endRow = true && that.isSetEndRow();
374 if (this_present_endRow || that_present_endRow) {
375 if (!(this_present_endRow && that_present_endRow))
376 return false;
377 if (!this.endRow.equals(that.endRow))
378 return false;
379 }
380
381 boolean this_present_prevEndRow = true && this.isSetPrevEndRow();
382 boolean that_present_prevEndRow = true && that.isSetPrevEndRow();
383 if (this_present_prevEndRow || that_present_prevEndRow) {
384 if (!(this_present_prevEndRow && that_present_prevEndRow))
385 return false;
386 if (!this.prevEndRow.equals(that.prevEndRow))
387 return false;
388 }
389
390 return true;
391 }
392
393 @Override
394 public int hashCode() {
395 return 0;
396 }
397
398 public int compareTo(TKeyExtent other) {
399 if (!getClass().equals(other.getClass())) {
400 return getClass().getName().compareTo(other.getClass().getName());
401 }
402
403 int lastComparison = 0;
404 TKeyExtent typedOther = (TKeyExtent)other;
405
406 lastComparison = Boolean.valueOf(isSetTable()).compareTo(typedOther.isSetTable());
407 if (lastComparison != 0) {
408 return lastComparison;
409 }
410 if (isSetTable()) {
411 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.table, typedOther.table);
412 if (lastComparison != 0) {
413 return lastComparison;
414 }
415 }
416 lastComparison = Boolean.valueOf(isSetEndRow()).compareTo(typedOther.isSetEndRow());
417 if (lastComparison != 0) {
418 return lastComparison;
419 }
420 if (isSetEndRow()) {
421 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.endRow, typedOther.endRow);
422 if (lastComparison != 0) {
423 return lastComparison;
424 }
425 }
426 lastComparison = Boolean.valueOf(isSetPrevEndRow()).compareTo(typedOther.isSetPrevEndRow());
427 if (lastComparison != 0) {
428 return lastComparison;
429 }
430 if (isSetPrevEndRow()) {
431 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.prevEndRow, typedOther.prevEndRow);
432 if (lastComparison != 0) {
433 return lastComparison;
434 }
435 }
436 return 0;
437 }
438
439 public _Fields fieldForId(int fieldId) {
440 return _Fields.findByThriftId(fieldId);
441 }
442
443 public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
444 schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
445 }
446
447 public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
448 schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
449 }
450
451 @Override
452 public String toString() {
453 StringBuilder sb = new StringBuilder("TKeyExtent(");
454 boolean first = true;
455
456 sb.append("table:");
457 if (this.table == null) {
458 sb.append("null");
459 } else {
460 org.apache.thrift.TBaseHelper.toString(this.table, sb);
461 }
462 first = false;
463 if (!first) sb.append(", ");
464 sb.append("endRow:");
465 if (this.endRow == null) {
466 sb.append("null");
467 } else {
468 org.apache.thrift.TBaseHelper.toString(this.endRow, sb);
469 }
470 first = false;
471 if (!first) sb.append(", ");
472 sb.append("prevEndRow:");
473 if (this.prevEndRow == null) {
474 sb.append("null");
475 } else {
476 org.apache.thrift.TBaseHelper.toString(this.prevEndRow, sb);
477 }
478 first = false;
479 sb.append(")");
480 return sb.toString();
481 }
482
483 public void validate() throws org.apache.thrift.TException {
484
485
486 }
487
488 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
489 try {
490 write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
491 } catch (org.apache.thrift.TException te) {
492 throw new java.io.IOException(te);
493 }
494 }
495
496 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
497 try {
498 read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
499 } catch (org.apache.thrift.TException te) {
500 throw new java.io.IOException(te);
501 }
502 }
503
504 private static class TKeyExtentStandardSchemeFactory implements SchemeFactory {
505 public TKeyExtentStandardScheme getScheme() {
506 return new TKeyExtentStandardScheme();
507 }
508 }
509
510 private static class TKeyExtentStandardScheme extends StandardScheme<TKeyExtent> {
511
512 public void read(org.apache.thrift.protocol.TProtocol iprot, TKeyExtent struct) throws org.apache.thrift.TException {
513 org.apache.thrift.protocol.TField schemeField;
514 iprot.readStructBegin();
515 while (true)
516 {
517 schemeField = iprot.readFieldBegin();
518 if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
519 break;
520 }
521 switch (schemeField.id) {
522 case 1:
523 if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
524 struct.table = iprot.readBinary();
525 struct.setTableIsSet(true);
526 } else {
527 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
528 }
529 break;
530 case 2:
531 if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
532 struct.endRow = iprot.readBinary();
533 struct.setEndRowIsSet(true);
534 } else {
535 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
536 }
537 break;
538 case 3:
539 if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
540 struct.prevEndRow = iprot.readBinary();
541 struct.setPrevEndRowIsSet(true);
542 } else {
543 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
544 }
545 break;
546 default:
547 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
548 }
549 iprot.readFieldEnd();
550 }
551 iprot.readStructEnd();
552
553
554 struct.validate();
555 }
556
557 public void write(org.apache.thrift.protocol.TProtocol oprot, TKeyExtent struct) throws org.apache.thrift.TException {
558 struct.validate();
559
560 oprot.writeStructBegin(STRUCT_DESC);
561 if (struct.table != null) {
562 oprot.writeFieldBegin(TABLE_FIELD_DESC);
563 oprot.writeBinary(struct.table);
564 oprot.writeFieldEnd();
565 }
566 if (struct.endRow != null) {
567 oprot.writeFieldBegin(END_ROW_FIELD_DESC);
568 oprot.writeBinary(struct.endRow);
569 oprot.writeFieldEnd();
570 }
571 if (struct.prevEndRow != null) {
572 oprot.writeFieldBegin(PREV_END_ROW_FIELD_DESC);
573 oprot.writeBinary(struct.prevEndRow);
574 oprot.writeFieldEnd();
575 }
576 oprot.writeFieldStop();
577 oprot.writeStructEnd();
578 }
579
580 }
581
582 private static class TKeyExtentTupleSchemeFactory implements SchemeFactory {
583 public TKeyExtentTupleScheme getScheme() {
584 return new TKeyExtentTupleScheme();
585 }
586 }
587
588 private static class TKeyExtentTupleScheme extends TupleScheme<TKeyExtent> {
589
590 @Override
591 public void write(org.apache.thrift.protocol.TProtocol prot, TKeyExtent struct) throws org.apache.thrift.TException {
592 TTupleProtocol oprot = (TTupleProtocol) prot;
593 BitSet optionals = new BitSet();
594 if (struct.isSetTable()) {
595 optionals.set(0);
596 }
597 if (struct.isSetEndRow()) {
598 optionals.set(1);
599 }
600 if (struct.isSetPrevEndRow()) {
601 optionals.set(2);
602 }
603 oprot.writeBitSet(optionals, 3);
604 if (struct.isSetTable()) {
605 oprot.writeBinary(struct.table);
606 }
607 if (struct.isSetEndRow()) {
608 oprot.writeBinary(struct.endRow);
609 }
610 if (struct.isSetPrevEndRow()) {
611 oprot.writeBinary(struct.prevEndRow);
612 }
613 }
614
615 @Override
616 public void read(org.apache.thrift.protocol.TProtocol prot, TKeyExtent struct) throws org.apache.thrift.TException {
617 TTupleProtocol iprot = (TTupleProtocol) prot;
618 BitSet incoming = iprot.readBitSet(3);
619 if (incoming.get(0)) {
620 struct.table = iprot.readBinary();
621 struct.setTableIsSet(true);
622 }
623 if (incoming.get(1)) {
624 struct.endRow = iprot.readBinary();
625 struct.setEndRowIsSet(true);
626 }
627 if (incoming.get(2)) {
628 struct.prevEndRow = iprot.readBinary();
629 struct.setPrevEndRowIsSet(true);
630 }
631 }
632 }
633
634 }
635