Example #1
0
 @Override
 public void write(org.apache.thrift.protocol.TProtocol prot, Type struct)
     throws org.apache.thrift.TException {
   TTupleProtocol oprot = (TTupleProtocol) prot;
   BitSet optionals = new BitSet();
   if (struct.isSetTypes()) {
     optionals.set(0);
   }
   if (struct.isSetRoot()) {
     optionals.set(1);
   }
   oprot.writeBitSet(optionals, 2);
   if (struct.isSetTypes()) {
     {
       oprot.writeI32(struct.types.size());
       for (Map.Entry<Integer, Typ> _iter5 : struct.types.entrySet()) {
         oprot.writeI32(_iter5.getKey());
         _iter5.getValue().write(oprot);
       }
     }
   }
   if (struct.isSetRoot()) {
     oprot.writeI32(struct.root);
   }
 }
Example #2
0
  public int compareTo(Type other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;
    Type typedOther = (Type) other;

    lastComparison = Boolean.valueOf(isSetTypes()).compareTo(typedOther.isSetTypes());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTypes()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.types, typedOther.types);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetRoot()).compareTo(typedOther.isSetRoot());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRoot()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.root, typedOther.root);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }