PageRenderTime 40ms CodeModel.GetById 10ms app.highlight 25ms RepoModel.GetById 1ms app.codeStats 0ms

/tags/release-0.0.0-rc0/hive/external/ql/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/ql/plan/api/Graph.java

#
Java | 569 lines | 460 code | 72 blank | 37 comment | 112 complexity | 27c36e0805d488ee282c9d0353cb7b8f MD5 | raw file
  1/**
  2 * Autogenerated by Thrift
  3 *
  4 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
  5 */
  6package org.apache.hadoop.hive.ql.plan.api;
  7
  8import java.util.List;
  9import java.util.ArrayList;
 10import java.util.Map;
 11import java.util.HashMap;
 12import java.util.EnumMap;
 13import java.util.Set;
 14import java.util.HashSet;
 15import java.util.EnumSet;
 16import java.util.Collections;
 17import java.util.BitSet;
 18import java.nio.ByteBuffer;
 19import java.util.Arrays;
 20import org.slf4j.Logger;
 21import org.slf4j.LoggerFactory;
 22
 23import org.apache.thrift.*;
 24import org.apache.thrift.async.*;
 25import org.apache.thrift.meta_data.*;
 26import org.apache.thrift.transport.*;
 27import org.apache.thrift.protocol.*;
 28
 29public class Graph implements TBase<Graph, Graph._Fields>, java.io.Serializable, Cloneable {
 30  private static final TStruct STRUCT_DESC = new TStruct("Graph");
 31
 32  private static final TField NODE_TYPE_FIELD_DESC = new TField("nodeType", TType.I32, (short)1);
 33  private static final TField ROOTS_FIELD_DESC = new TField("roots", TType.LIST, (short)2);
 34  private static final TField ADJACENCY_LIST_FIELD_DESC = new TField("adjacencyList", TType.LIST, (short)3);
 35
 36  private NodeType nodeType;
 37  private List<String> roots;
 38  private List<Adjacency> adjacencyList;
 39
 40  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
 41  public enum _Fields implements TFieldIdEnum {
 42    /**
 43     * 
 44     * @see NodeType
 45     */
 46    NODE_TYPE((short)1, "nodeType"),
 47    ROOTS((short)2, "roots"),
 48    ADJACENCY_LIST((short)3, "adjacencyList");
 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     * Find the _Fields constant that matches fieldId, or null if its not found.
 60     */
 61    public static _Fields findByThriftId(int fieldId) {
 62      switch(fieldId) {
 63        case 1: // NODE_TYPE
 64          return NODE_TYPE;
 65        case 2: // ROOTS
 66          return ROOTS;
 67        case 3: // ADJACENCY_LIST
 68          return ADJACENCY_LIST;
 69        default:
 70          return null;
 71      }
 72    }
 73
 74    /**
 75     * Find the _Fields constant that matches fieldId, throwing an exception
 76     * if it is not found.
 77     */
 78    public static _Fields findByThriftIdOrThrow(int fieldId) {
 79      _Fields fields = findByThriftId(fieldId);
 80      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
 81      return fields;
 82    }
 83
 84    /**
 85     * Find the _Fields constant that matches name, or null if its not found.
 86     */
 87    public static _Fields findByName(String name) {
 88      return byName.get(name);
 89    }
 90
 91    private final short _thriftId;
 92    private final String _fieldName;
 93
 94    _Fields(short thriftId, String fieldName) {
 95      _thriftId = thriftId;
 96      _fieldName = fieldName;
 97    }
 98
 99    public short getThriftFieldId() {
100      return _thriftId;
101    }
102
103    public String getFieldName() {
104      return _fieldName;
105    }
106  }
107
108  // isset id assignments
109
110  public static final Map<_Fields, FieldMetaData> metaDataMap;
111  static {
112    Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
113    tmpMap.put(_Fields.NODE_TYPE, new FieldMetaData("nodeType", TFieldRequirementType.DEFAULT, 
114        new EnumMetaData(TType.ENUM, NodeType.class)));
115    tmpMap.put(_Fields.ROOTS, new FieldMetaData("roots", TFieldRequirementType.DEFAULT, 
116        new ListMetaData(TType.LIST, 
117            new FieldValueMetaData(TType.STRING))));
118    tmpMap.put(_Fields.ADJACENCY_LIST, new FieldMetaData("adjacencyList", TFieldRequirementType.DEFAULT, 
119        new ListMetaData(TType.LIST, 
120            new StructMetaData(TType.STRUCT, Adjacency.class))));
121    metaDataMap = Collections.unmodifiableMap(tmpMap);
122    FieldMetaData.addStructMetaDataMap(Graph.class, metaDataMap);
123  }
124
125  public Graph() {
126  }
127
128  public Graph(
129    NodeType nodeType,
130    List<String> roots,
131    List<Adjacency> adjacencyList)
132  {
133    this();
134    this.nodeType = nodeType;
135    this.roots = roots;
136    this.adjacencyList = adjacencyList;
137  }
138
139  /**
140   * Performs a deep copy on <i>other</i>.
141   */
142  public Graph(Graph other) {
143    if (other.isSetNodeType()) {
144      this.nodeType = other.nodeType;
145    }
146    if (other.isSetRoots()) {
147      List<String> __this__roots = new ArrayList<String>();
148      for (String other_element : other.roots) {
149        __this__roots.add(other_element);
150      }
151      this.roots = __this__roots;
152    }
153    if (other.isSetAdjacencyList()) {
154      List<Adjacency> __this__adjacencyList = new ArrayList<Adjacency>();
155      for (Adjacency other_element : other.adjacencyList) {
156        __this__adjacencyList.add(new Adjacency(other_element));
157      }
158      this.adjacencyList = __this__adjacencyList;
159    }
160  }
161
162  public Graph deepCopy() {
163    return new Graph(this);
164  }
165
166  @Override
167  public void clear() {
168    this.nodeType = null;
169    this.roots = null;
170    this.adjacencyList = null;
171  }
172
173  /**
174   * 
175   * @see NodeType
176   */
177  public NodeType getNodeType() {
178    return this.nodeType;
179  }
180
181  /**
182   * 
183   * @see NodeType
184   */
185  public void setNodeType(NodeType nodeType) {
186    this.nodeType = nodeType;
187  }
188
189  public void unsetNodeType() {
190    this.nodeType = null;
191  }
192
193  /** Returns true if field nodeType is set (has been asigned a value) and false otherwise */
194  public boolean isSetNodeType() {
195    return this.nodeType != null;
196  }
197
198  public void setNodeTypeIsSet(boolean value) {
199    if (!value) {
200      this.nodeType = null;
201    }
202  }
203
204  public int getRootsSize() {
205    return (this.roots == null) ? 0 : this.roots.size();
206  }
207
208  public java.util.Iterator<String> getRootsIterator() {
209    return (this.roots == null) ? null : this.roots.iterator();
210  }
211
212  public void addToRoots(String elem) {
213    if (this.roots == null) {
214      this.roots = new ArrayList<String>();
215    }
216    this.roots.add(elem);
217  }
218
219  public List<String> getRoots() {
220    return this.roots;
221  }
222
223  public void setRoots(List<String> roots) {
224    this.roots = roots;
225  }
226
227  public void unsetRoots() {
228    this.roots = null;
229  }
230
231  /** Returns true if field roots is set (has been asigned a value) and false otherwise */
232  public boolean isSetRoots() {
233    return this.roots != null;
234  }
235
236  public void setRootsIsSet(boolean value) {
237    if (!value) {
238      this.roots = null;
239    }
240  }
241
242  public int getAdjacencyListSize() {
243    return (this.adjacencyList == null) ? 0 : this.adjacencyList.size();
244  }
245
246  public java.util.Iterator<Adjacency> getAdjacencyListIterator() {
247    return (this.adjacencyList == null) ? null : this.adjacencyList.iterator();
248  }
249
250  public void addToAdjacencyList(Adjacency elem) {
251    if (this.adjacencyList == null) {
252      this.adjacencyList = new ArrayList<Adjacency>();
253    }
254    this.adjacencyList.add(elem);
255  }
256
257  public List<Adjacency> getAdjacencyList() {
258    return this.adjacencyList;
259  }
260
261  public void setAdjacencyList(List<Adjacency> adjacencyList) {
262    this.adjacencyList = adjacencyList;
263  }
264
265  public void unsetAdjacencyList() {
266    this.adjacencyList = null;
267  }
268
269  /** Returns true if field adjacencyList is set (has been asigned a value) and false otherwise */
270  public boolean isSetAdjacencyList() {
271    return this.adjacencyList != null;
272  }
273
274  public void setAdjacencyListIsSet(boolean value) {
275    if (!value) {
276      this.adjacencyList = null;
277    }
278  }
279
280  public void setFieldValue(_Fields field, Object value) {
281    switch (field) {
282    case NODE_TYPE:
283      if (value == null) {
284        unsetNodeType();
285      } else {
286        setNodeType((NodeType)value);
287      }
288      break;
289
290    case ROOTS:
291      if (value == null) {
292        unsetRoots();
293      } else {
294        setRoots((List<String>)value);
295      }
296      break;
297
298    case ADJACENCY_LIST:
299      if (value == null) {
300        unsetAdjacencyList();
301      } else {
302        setAdjacencyList((List<Adjacency>)value);
303      }
304      break;
305
306    }
307  }
308
309  public Object getFieldValue(_Fields field) {
310    switch (field) {
311    case NODE_TYPE:
312      return getNodeType();
313
314    case ROOTS:
315      return getRoots();
316
317    case ADJACENCY_LIST:
318      return getAdjacencyList();
319
320    }
321    throw new IllegalStateException();
322  }
323
324  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
325  public boolean isSet(_Fields field) {
326    if (field == null) {
327      throw new IllegalArgumentException();
328    }
329
330    switch (field) {
331    case NODE_TYPE:
332      return isSetNodeType();
333    case ROOTS:
334      return isSetRoots();
335    case ADJACENCY_LIST:
336      return isSetAdjacencyList();
337    }
338    throw new IllegalStateException();
339  }
340
341  @Override
342  public boolean equals(Object that) {
343    if (that == null)
344      return false;
345    if (that instanceof Graph)
346      return this.equals((Graph)that);
347    return false;
348  }
349
350  public boolean equals(Graph that) {
351    if (that == null)
352      return false;
353
354    boolean this_present_nodeType = true && this.isSetNodeType();
355    boolean that_present_nodeType = true && that.isSetNodeType();
356    if (this_present_nodeType || that_present_nodeType) {
357      if (!(this_present_nodeType && that_present_nodeType))
358        return false;
359      if (!this.nodeType.equals(that.nodeType))
360        return false;
361    }
362
363    boolean this_present_roots = true && this.isSetRoots();
364    boolean that_present_roots = true && that.isSetRoots();
365    if (this_present_roots || that_present_roots) {
366      if (!(this_present_roots && that_present_roots))
367        return false;
368      if (!this.roots.equals(that.roots))
369        return false;
370    }
371
372    boolean this_present_adjacencyList = true && this.isSetAdjacencyList();
373    boolean that_present_adjacencyList = true && that.isSetAdjacencyList();
374    if (this_present_adjacencyList || that_present_adjacencyList) {
375      if (!(this_present_adjacencyList && that_present_adjacencyList))
376        return false;
377      if (!this.adjacencyList.equals(that.adjacencyList))
378        return false;
379    }
380
381    return true;
382  }
383
384  @Override
385  public int hashCode() {
386    return 0;
387  }
388
389  public int compareTo(Graph other) {
390    if (!getClass().equals(other.getClass())) {
391      return getClass().getName().compareTo(other.getClass().getName());
392    }
393
394    int lastComparison = 0;
395    Graph typedOther = (Graph)other;
396
397    lastComparison = Boolean.valueOf(isSetNodeType()).compareTo(typedOther.isSetNodeType());
398    if (lastComparison != 0) {
399      return lastComparison;
400    }
401    if (isSetNodeType()) {
402      lastComparison = TBaseHelper.compareTo(this.nodeType, typedOther.nodeType);
403      if (lastComparison != 0) {
404        return lastComparison;
405      }
406    }
407    lastComparison = Boolean.valueOf(isSetRoots()).compareTo(typedOther.isSetRoots());
408    if (lastComparison != 0) {
409      return lastComparison;
410    }
411    if (isSetRoots()) {
412      lastComparison = TBaseHelper.compareTo(this.roots, typedOther.roots);
413      if (lastComparison != 0) {
414        return lastComparison;
415      }
416    }
417    lastComparison = Boolean.valueOf(isSetAdjacencyList()).compareTo(typedOther.isSetAdjacencyList());
418    if (lastComparison != 0) {
419      return lastComparison;
420    }
421    if (isSetAdjacencyList()) {
422      lastComparison = TBaseHelper.compareTo(this.adjacencyList, typedOther.adjacencyList);
423      if (lastComparison != 0) {
424        return lastComparison;
425      }
426    }
427    return 0;
428  }
429
430  public _Fields fieldForId(int fieldId) {
431    return _Fields.findByThriftId(fieldId);
432  }
433
434  public void read(TProtocol iprot) throws TException {
435    TField field;
436    iprot.readStructBegin();
437    while (true)
438    {
439      field = iprot.readFieldBegin();
440      if (field.type == TType.STOP) { 
441        break;
442      }
443      switch (field.id) {
444        case 1: // NODE_TYPE
445          if (field.type == TType.I32) {
446            this.nodeType = NodeType.findByValue(iprot.readI32());
447          } else { 
448            TProtocolUtil.skip(iprot, field.type);
449          }
450          break;
451        case 2: // ROOTS
452          if (field.type == TType.LIST) {
453            {
454              TList _list4 = iprot.readListBegin();
455              this.roots = new ArrayList<String>(_list4.size);
456              for (int _i5 = 0; _i5 < _list4.size; ++_i5)
457              {
458                String _elem6;
459                _elem6 = iprot.readString();
460                this.roots.add(_elem6);
461              }
462              iprot.readListEnd();
463            }
464          } else { 
465            TProtocolUtil.skip(iprot, field.type);
466          }
467          break;
468        case 3: // ADJACENCY_LIST
469          if (field.type == TType.LIST) {
470            {
471              TList _list7 = iprot.readListBegin();
472              this.adjacencyList = new ArrayList<Adjacency>(_list7.size);
473              for (int _i8 = 0; _i8 < _list7.size; ++_i8)
474              {
475                Adjacency _elem9;
476                _elem9 = new Adjacency();
477                _elem9.read(iprot);
478                this.adjacencyList.add(_elem9);
479              }
480              iprot.readListEnd();
481            }
482          } else { 
483            TProtocolUtil.skip(iprot, field.type);
484          }
485          break;
486        default:
487          TProtocolUtil.skip(iprot, field.type);
488      }
489      iprot.readFieldEnd();
490    }
491    iprot.readStructEnd();
492    validate();
493  }
494
495  public void write(TProtocol oprot) throws TException {
496    validate();
497
498    oprot.writeStructBegin(STRUCT_DESC);
499    if (this.nodeType != null) {
500      oprot.writeFieldBegin(NODE_TYPE_FIELD_DESC);
501      oprot.writeI32(this.nodeType.getValue());
502      oprot.writeFieldEnd();
503    }
504    if (this.roots != null) {
505      oprot.writeFieldBegin(ROOTS_FIELD_DESC);
506      {
507        oprot.writeListBegin(new TList(TType.STRING, this.roots.size()));
508        for (String _iter10 : this.roots)
509        {
510          oprot.writeString(_iter10);
511        }
512        oprot.writeListEnd();
513      }
514      oprot.writeFieldEnd();
515    }
516    if (this.adjacencyList != null) {
517      oprot.writeFieldBegin(ADJACENCY_LIST_FIELD_DESC);
518      {
519        oprot.writeListBegin(new TList(TType.STRUCT, this.adjacencyList.size()));
520        for (Adjacency _iter11 : this.adjacencyList)
521        {
522          _iter11.write(oprot);
523        }
524        oprot.writeListEnd();
525      }
526      oprot.writeFieldEnd();
527    }
528    oprot.writeFieldStop();
529    oprot.writeStructEnd();
530  }
531
532  @Override
533  public String toString() {
534    StringBuilder sb = new StringBuilder("Graph(");
535    boolean first = true;
536
537    sb.append("nodeType:");
538    if (this.nodeType == null) {
539      sb.append("null");
540    } else {
541      sb.append(this.nodeType);
542    }
543    first = false;
544    if (!first) sb.append(", ");
545    sb.append("roots:");
546    if (this.roots == null) {
547      sb.append("null");
548    } else {
549      sb.append(this.roots);
550    }
551    first = false;
552    if (!first) sb.append(", ");
553    sb.append("adjacencyList:");
554    if (this.adjacencyList == null) {
555      sb.append("null");
556    } else {
557      sb.append(this.adjacencyList);
558    }
559    first = false;
560    sb.append(")");
561    return sb.toString();
562  }
563
564  public void validate() throws TException {
565    // check for required fields
566  }
567
568}
569