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 ScanResult implements org.apache.thrift.TBase<ScanResult, ScanResult._Fields>, java.io.Serializable, Cloneable {
50 private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ScanResult");
51
52 private static final org.apache.thrift.protocol.TField RESULTS_FIELD_DESC = new org.apache.thrift.protocol.TField("results", org.apache.thrift.protocol.TType.LIST, (short)1);
53 private static final org.apache.thrift.protocol.TField MORE_FIELD_DESC = new org.apache.thrift.protocol.TField("more", org.apache.thrift.protocol.TType.BOOL, (short)2);
54
55 private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
56 static {
57 schemes.put(StandardScheme.class, new ScanResultStandardSchemeFactory());
58 schemes.put(TupleScheme.class, new ScanResultTupleSchemeFactory());
59 }
60
61 public List<TKeyValue> results;
62 public boolean more;
63
64 /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
65 @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
66 RESULTS((short)1, "results"),
67 MORE((short)2, "more");
68
69 private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
70
71 static {
72 for (_Fields field : EnumSet.allOf(_Fields.class)) {
73 byName.put(field.getFieldName(), field);
74 }
75 }
76
77 /**
78 * Find the _Fields constant that matches fieldId, or null if its not found.
79 */
80 public static _Fields findByThriftId(int fieldId) {
81 switch(fieldId) {
82 case 1:
83 return RESULTS;
84 case 2:
85 return MORE;
86 default:
87 return null;
88 }
89 }
90
91 /**
92 * Find the _Fields constant that matches fieldId, throwing an exception
93 * if it is not found.
94 */
95 public static _Fields findByThriftIdOrThrow(int fieldId) {
96 _Fields fields = findByThriftId(fieldId);
97 if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
98 return fields;
99 }
100
101 /**
102 * Find the _Fields constant that matches name, or null if its not found.
103 */
104 public static _Fields findByName(String name) {
105 return byName.get(name);
106 }
107
108 private final short _thriftId;
109 private final String _fieldName;
110
111 _Fields(short thriftId, String fieldName) {
112 _thriftId = thriftId;
113 _fieldName = fieldName;
114 }
115
116 public short getThriftFieldId() {
117 return _thriftId;
118 }
119
120 public String getFieldName() {
121 return _fieldName;
122 }
123 }
124
125
126 private static final int __MORE_ISSET_ID = 0;
127 private byte __isset_bitfield = 0;
128 public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
129 static {
130 Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
131 tmpMap.put(_Fields.RESULTS, new org.apache.thrift.meta_data.FieldMetaData("results", org.apache.thrift.TFieldRequirementType.DEFAULT,
132 new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
133 new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TKeyValue.class))));
134 tmpMap.put(_Fields.MORE, new org.apache.thrift.meta_data.FieldMetaData("more", org.apache.thrift.TFieldRequirementType.DEFAULT,
135 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
136 metaDataMap = Collections.unmodifiableMap(tmpMap);
137 org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ScanResult.class, metaDataMap);
138 }
139
140 public ScanResult() {
141 }
142
143 public ScanResult(
144 List<TKeyValue> results,
145 boolean more)
146 {
147 this();
148 this.results = results;
149 this.more = more;
150 setMoreIsSet(true);
151 }
152
153 /**
154 * Performs a deep copy on <i>other</i>.
155 */
156 public ScanResult(ScanResult other) {
157 __isset_bitfield = other.__isset_bitfield;
158 if (other.isSetResults()) {
159 List<TKeyValue> __this__results = new ArrayList<TKeyValue>();
160 for (TKeyValue other_element : other.results) {
161 __this__results.add(new TKeyValue(other_element));
162 }
163 this.results = __this__results;
164 }
165 this.more = other.more;
166 }
167
168 public ScanResult deepCopy() {
169 return new ScanResult(this);
170 }
171
172 @Override
173 public void clear() {
174 this.results = null;
175 setMoreIsSet(false);
176 this.more = false;
177 }
178
179 public int getResultsSize() {
180 return (this.results == null) ? 0 : this.results.size();
181 }
182
183 public java.util.Iterator<TKeyValue> getResultsIterator() {
184 return (this.results == null) ? null : this.results.iterator();
185 }
186
187 public void addToResults(TKeyValue elem) {
188 if (this.results == null) {
189 this.results = new ArrayList<TKeyValue>();
190 }
191 this.results.add(elem);
192 }
193
194 public List<TKeyValue> getResults() {
195 return this.results;
196 }
197
198 public ScanResult setResults(List<TKeyValue> results) {
199 this.results = results;
200 return this;
201 }
202
203 public void unsetResults() {
204 this.results = null;
205 }
206
207 /** Returns true if field results is set (has been assigned a value) and false otherwise */
208 public boolean isSetResults() {
209 return this.results != null;
210 }
211
212 public void setResultsIsSet(boolean value) {
213 if (!value) {
214 this.results = null;
215 }
216 }
217
218 public boolean isMore() {
219 return this.more;
220 }
221
222 public ScanResult setMore(boolean more) {
223 this.more = more;
224 setMoreIsSet(true);
225 return this;
226 }
227
228 public void unsetMore() {
229 __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __MORE_ISSET_ID);
230 }
231
232 /** Returns true if field more is set (has been assigned a value) and false otherwise */
233 public boolean isSetMore() {
234 return EncodingUtils.testBit(__isset_bitfield, __MORE_ISSET_ID);
235 }
236
237 public void setMoreIsSet(boolean value) {
238 __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __MORE_ISSET_ID, value);
239 }
240
241 public void setFieldValue(_Fields field, Object value) {
242 switch (field) {
243 case RESULTS:
244 if (value == null) {
245 unsetResults();
246 } else {
247 setResults((List<TKeyValue>)value);
248 }
249 break;
250
251 case MORE:
252 if (value == null) {
253 unsetMore();
254 } else {
255 setMore((Boolean)value);
256 }
257 break;
258
259 }
260 }
261
262 public Object getFieldValue(_Fields field) {
263 switch (field) {
264 case RESULTS:
265 return getResults();
266
267 case MORE:
268 return Boolean.valueOf(isMore());
269
270 }
271 throw new IllegalStateException();
272 }
273
274 /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
275 public boolean isSet(_Fields field) {
276 if (field == null) {
277 throw new IllegalArgumentException();
278 }
279
280 switch (field) {
281 case RESULTS:
282 return isSetResults();
283 case MORE:
284 return isSetMore();
285 }
286 throw new IllegalStateException();
287 }
288
289 @Override
290 public boolean equals(Object that) {
291 if (that == null)
292 return false;
293 if (that instanceof ScanResult)
294 return this.equals((ScanResult)that);
295 return false;
296 }
297
298 public boolean equals(ScanResult that) {
299 if (that == null)
300 return false;
301
302 boolean this_present_results = true && this.isSetResults();
303 boolean that_present_results = true && that.isSetResults();
304 if (this_present_results || that_present_results) {
305 if (!(this_present_results && that_present_results))
306 return false;
307 if (!this.results.equals(that.results))
308 return false;
309 }
310
311 boolean this_present_more = true;
312 boolean that_present_more = true;
313 if (this_present_more || that_present_more) {
314 if (!(this_present_more && that_present_more))
315 return false;
316 if (this.more != that.more)
317 return false;
318 }
319
320 return true;
321 }
322
323 @Override
324 public int hashCode() {
325 return 0;
326 }
327
328 public int compareTo(ScanResult other) {
329 if (!getClass().equals(other.getClass())) {
330 return getClass().getName().compareTo(other.getClass().getName());
331 }
332
333 int lastComparison = 0;
334 ScanResult typedOther = (ScanResult)other;
335
336 lastComparison = Boolean.valueOf(isSetResults()).compareTo(typedOther.isSetResults());
337 if (lastComparison != 0) {
338 return lastComparison;
339 }
340 if (isSetResults()) {
341 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.results, typedOther.results);
342 if (lastComparison != 0) {
343 return lastComparison;
344 }
345 }
346 lastComparison = Boolean.valueOf(isSetMore()).compareTo(typedOther.isSetMore());
347 if (lastComparison != 0) {
348 return lastComparison;
349 }
350 if (isSetMore()) {
351 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.more, typedOther.more);
352 if (lastComparison != 0) {
353 return lastComparison;
354 }
355 }
356 return 0;
357 }
358
359 public _Fields fieldForId(int fieldId) {
360 return _Fields.findByThriftId(fieldId);
361 }
362
363 public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
364 schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
365 }
366
367 public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
368 schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
369 }
370
371 @Override
372 public String toString() {
373 StringBuilder sb = new StringBuilder("ScanResult(");
374 boolean first = true;
375
376 sb.append("results:");
377 if (this.results == null) {
378 sb.append("null");
379 } else {
380 sb.append(this.results);
381 }
382 first = false;
383 if (!first) sb.append(", ");
384 sb.append("more:");
385 sb.append(this.more);
386 first = false;
387 sb.append(")");
388 return sb.toString();
389 }
390
391 public void validate() throws org.apache.thrift.TException {
392
393
394 }
395
396 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
397 try {
398 write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
399 } catch (org.apache.thrift.TException te) {
400 throw new java.io.IOException(te);
401 }
402 }
403
404 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
405 try {
406
407 __isset_bitfield = 0;
408 read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
409 } catch (org.apache.thrift.TException te) {
410 throw new java.io.IOException(te);
411 }
412 }
413
414 private static class ScanResultStandardSchemeFactory implements SchemeFactory {
415 public ScanResultStandardScheme getScheme() {
416 return new ScanResultStandardScheme();
417 }
418 }
419
420 private static class ScanResultStandardScheme extends StandardScheme<ScanResult> {
421
422 public void read(org.apache.thrift.protocol.TProtocol iprot, ScanResult struct) throws org.apache.thrift.TException {
423 org.apache.thrift.protocol.TField schemeField;
424 iprot.readStructBegin();
425 while (true)
426 {
427 schemeField = iprot.readFieldBegin();
428 if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
429 break;
430 }
431 switch (schemeField.id) {
432 case 1:
433 if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
434 {
435 org.apache.thrift.protocol.TList _list8 = iprot.readListBegin();
436 struct.results = new ArrayList<TKeyValue>(_list8.size);
437 for (int _i9 = 0; _i9 < _list8.size; ++_i9)
438 {
439 TKeyValue _elem10;
440 _elem10 = new TKeyValue();
441 _elem10.read(iprot);
442 struct.results.add(_elem10);
443 }
444 iprot.readListEnd();
445 }
446 struct.setResultsIsSet(true);
447 } else {
448 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
449 }
450 break;
451 case 2:
452 if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
453 struct.more = iprot.readBool();
454 struct.setMoreIsSet(true);
455 } else {
456 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
457 }
458 break;
459 default:
460 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
461 }
462 iprot.readFieldEnd();
463 }
464 iprot.readStructEnd();
465
466
467 struct.validate();
468 }
469
470 public void write(org.apache.thrift.protocol.TProtocol oprot, ScanResult struct) throws org.apache.thrift.TException {
471 struct.validate();
472
473 oprot.writeStructBegin(STRUCT_DESC);
474 if (struct.results != null) {
475 oprot.writeFieldBegin(RESULTS_FIELD_DESC);
476 {
477 oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.results.size()));
478 for (TKeyValue _iter11 : struct.results)
479 {
480 _iter11.write(oprot);
481 }
482 oprot.writeListEnd();
483 }
484 oprot.writeFieldEnd();
485 }
486 oprot.writeFieldBegin(MORE_FIELD_DESC);
487 oprot.writeBool(struct.more);
488 oprot.writeFieldEnd();
489 oprot.writeFieldStop();
490 oprot.writeStructEnd();
491 }
492
493 }
494
495 private static class ScanResultTupleSchemeFactory implements SchemeFactory {
496 public ScanResultTupleScheme getScheme() {
497 return new ScanResultTupleScheme();
498 }
499 }
500
501 private static class ScanResultTupleScheme extends TupleScheme<ScanResult> {
502
503 @Override
504 public void write(org.apache.thrift.protocol.TProtocol prot, ScanResult struct) throws org.apache.thrift.TException {
505 TTupleProtocol oprot = (TTupleProtocol) prot;
506 BitSet optionals = new BitSet();
507 if (struct.isSetResults()) {
508 optionals.set(0);
509 }
510 if (struct.isSetMore()) {
511 optionals.set(1);
512 }
513 oprot.writeBitSet(optionals, 2);
514 if (struct.isSetResults()) {
515 {
516 oprot.writeI32(struct.results.size());
517 for (TKeyValue _iter12 : struct.results)
518 {
519 _iter12.write(oprot);
520 }
521 }
522 }
523 if (struct.isSetMore()) {
524 oprot.writeBool(struct.more);
525 }
526 }
527
528 @Override
529 public void read(org.apache.thrift.protocol.TProtocol prot, ScanResult struct) throws org.apache.thrift.TException {
530 TTupleProtocol iprot = (TTupleProtocol) prot;
531 BitSet incoming = iprot.readBitSet(2);
532 if (incoming.get(0)) {
533 {
534 org.apache.thrift.protocol.TList _list13 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
535 struct.results = new ArrayList<TKeyValue>(_list13.size);
536 for (int _i14 = 0; _i14 < _list13.size; ++_i14)
537 {
538 TKeyValue _elem15;
539 _elem15 = new TKeyValue();
540 _elem15.read(iprot);
541 struct.results.add(_elem15);
542 }
543 }
544 struct.setResultsIsSet(true);
545 }
546 if (incoming.get(1)) {
547 struct.more = iprot.readBool();
548 struct.setMoreIsSet(true);
549 }
550 }
551 }
552
553 }
554