Exemple #1
0
  public boolean equals(Graph that) {
    if (that == null) return false;

    boolean this_present_nodeType = true && this.isSetNodeType();
    boolean that_present_nodeType = true && that.isSetNodeType();
    if (this_present_nodeType || that_present_nodeType) {
      if (!(this_present_nodeType && that_present_nodeType)) return false;
      if (!this.nodeType.equals(that.nodeType)) return false;
    }

    boolean this_present_roots = true && this.isSetRoots();
    boolean that_present_roots = true && that.isSetRoots();
    if (this_present_roots || that_present_roots) {
      if (!(this_present_roots && that_present_roots)) return false;
      if (!this.roots.equals(that.roots)) return false;
    }

    boolean this_present_adjacencyList = true && this.isSetAdjacencyList();
    boolean that_present_adjacencyList = true && that.isSetAdjacencyList();
    if (this_present_adjacencyList || that_present_adjacencyList) {
      if (!(this_present_adjacencyList && that_present_adjacencyList)) return false;
      if (!this.adjacencyList.equals(that.adjacencyList)) return false;
    }

    return true;
  }
Exemple #2
0
 /** Performs a deep copy on <i>other</i>. */
 public Graph(Graph other) {
   if (other.isSetNodeType()) {
     this.nodeType = other.nodeType;
   }
   if (other.isSetRoots()) {
     List<String> __this__roots = new ArrayList<String>(other.roots);
     this.roots = __this__roots;
   }
   if (other.isSetAdjacencyList()) {
     List<Adjacency> __this__adjacencyList = new ArrayList<Adjacency>(other.adjacencyList.size());
     for (Adjacency other_element : other.adjacencyList) {
       __this__adjacencyList.add(new Adjacency(other_element));
     }
     this.adjacencyList = __this__adjacencyList;
   }
 }
Exemple #3
0
  @Override
  public int compareTo(Graph other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetNodeType()).compareTo(other.isSetNodeType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNodeType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nodeType, other.nodeType);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetRoots()).compareTo(other.isSetRoots());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRoots()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roots, other.roots);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetAdjacencyList()).compareTo(other.isSetAdjacencyList());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAdjacencyList()) {
      lastComparison =
          org.apache.thrift.TBaseHelper.compareTo(this.adjacencyList, other.adjacencyList);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }
Exemple #4
0
 @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);
       }
     }
   }
 }
Exemple #5
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();
    }
Exemple #6
0
 @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);
   }
 }
Exemple #7
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();
 }