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