Exemplo n.º 1
0
    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();
    }
Exemplo n.º 2
0
 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();
 }