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