@Override public void write(org.apache.thrift.protocol.TProtocol prot, Graph struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetNodeType()) { optionals.set(0); } if (struct.isSetRoots()) { optionals.set(1); } if (struct.isSetAdjacencyList()) { optionals.set(2); } oprot.writeBitSet(optionals, 3); if (struct.isSetNodeType()) { oprot.writeI32(struct.nodeType.getValue()); } if (struct.isSetRoots()) { { oprot.writeI32(struct.roots.size()); for (String _iter16 : struct.roots) { oprot.writeString(_iter16); } } } if (struct.isSetAdjacencyList()) { { oprot.writeI32(struct.adjacencyList.size()); for (Adjacency _iter17 : struct.adjacencyList) { _iter17.write(oprot); } } } }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, Graph struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(3); if (incoming.get(0)) { struct.nodeType = org.apache.hadoop.hive.ql.plan.api.NodeType.findByValue(iprot.readI32()); struct.setNodeTypeIsSet(true); } if (incoming.get(1)) { { org.apache.thrift.protocol.TList _list18 = new org.apache.thrift.protocol.TList( org.apache.thrift.protocol.TType.STRING, iprot.readI32()); struct.roots = new ArrayList<String>(_list18.size); String _elem19; for (int _i20 = 0; _i20 < _list18.size; ++_i20) { _elem19 = iprot.readString(); struct.roots.add(_elem19); } } struct.setRootsIsSet(true); } if (incoming.get(2)) { { org.apache.thrift.protocol.TList _list21 = new org.apache.thrift.protocol.TList( org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); struct.adjacencyList = new ArrayList<Adjacency>(_list21.size); Adjacency _elem22; for (int _i23 = 0; _i23 < _list21.size; ++_i23) { _elem22 = new Adjacency(); _elem22.read(iprot); struct.adjacencyList.add(_elem22); } } struct.setAdjacencyListIsSet(true); } }
public void write(org.apache.thrift.protocol.TProtocol oprot, Graph struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.nodeType != null) { oprot.writeFieldBegin(NODE_TYPE_FIELD_DESC); oprot.writeI32(struct.nodeType.getValue()); oprot.writeFieldEnd(); } if (struct.roots != null) { oprot.writeFieldBegin(ROOTS_FIELD_DESC); { oprot.writeListBegin( new org.apache.thrift.protocol.TList( org.apache.thrift.protocol.TType.STRING, struct.roots.size())); for (String _iter14 : struct.roots) { oprot.writeString(_iter14); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } if (struct.adjacencyList != null) { oprot.writeFieldBegin(ADJACENCY_LIST_FIELD_DESC); { oprot.writeListBegin( new org.apache.thrift.protocol.TList( org.apache.thrift.protocol.TType.STRUCT, struct.adjacencyList.size())); for (Adjacency _iter15 : struct.adjacencyList) { _iter15.write(oprot); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); }
public void read(org.apache.thrift.protocol.TProtocol iprot, Graph struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) { schemeField = iprot.readFieldBegin(); if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { break; } switch (schemeField.id) { case 1: // NODE_TYPE if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.nodeType = org.apache.hadoop.hive.ql.plan.api.NodeType.findByValue(iprot.readI32()); struct.setNodeTypeIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // ROOTS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { org.apache.thrift.protocol.TList _list8 = iprot.readListBegin(); struct.roots = new ArrayList<String>(_list8.size); String _elem9; for (int _i10 = 0; _i10 < _list8.size; ++_i10) { _elem9 = iprot.readString(); struct.roots.add(_elem9); } iprot.readListEnd(); } struct.setRootsIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 3: // ADJACENCY_LIST if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { org.apache.thrift.protocol.TList _list11 = iprot.readListBegin(); struct.adjacencyList = new ArrayList<Adjacency>(_list11.size); Adjacency _elem12; for (int _i13 = 0; _i13 < _list11.size; ++_i13) { _elem12 = new Adjacency(); _elem12.read(iprot); struct.adjacencyList.add(_elem12); } iprot.readListEnd(); } struct.setAdjacencyListIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); struct.validate(); }