@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); } }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, Type struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { { org.apache.thrift.protocol.TMap _map6 = new org.apache.thrift.protocol.TMap( org.apache.thrift.protocol.TType.I32, org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); struct.types = new HashMap<Integer, Typ>(2 * _map6.size); for (int _i7 = 0; _i7 < _map6.size; ++_i7) { int _key8; // required Typ _val9; // required _key8 = iprot.readI32(); _val9 = new Typ(); _val9.read(iprot); struct.types.put(_key8, _val9); } } struct.setTypesIsSet(true); } if (incoming.get(1)) { struct.root = iprot.readI32(); struct.setRootIsSet(true); } }
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; }
public void read(org.apache.thrift.protocol.TProtocol iprot, Type 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: // TYPES if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { org.apache.thrift.protocol.TMap _map0 = iprot.readMapBegin(); struct.types = new HashMap<Integer, Typ>(2 * _map0.size); for (int _i1 = 0; _i1 < _map0.size; ++_i1) { int _key2; // required Typ _val3; // required _key2 = iprot.readI32(); _val3 = new Typ(); _val3.read(iprot); struct.types.put(_key2, _val3); } iprot.readMapEnd(); } struct.setTypesIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // ROOT if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.root = iprot.readI32(); struct.setRootIsSet(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(); // check for required fields of primitive type, which can't be checked in the validate method struct.validate(); }
public void write(org.apache.thrift.protocol.TProtocol oprot, Type struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.types != null) { oprot.writeFieldBegin(TYPES_FIELD_DESC); { oprot.writeMapBegin( new org.apache.thrift.protocol.TMap( org.apache.thrift.protocol.TType.I32, org.apache.thrift.protocol.TType.STRUCT, struct.types.size())); for (Map.Entry<Integer, Typ> _iter4 : struct.types.entrySet()) { oprot.writeI32(_iter4.getKey()); _iter4.getValue().write(oprot); } oprot.writeMapEnd(); } oprot.writeFieldEnd(); } oprot.writeFieldBegin(ROOT_FIELD_DESC); oprot.writeI32(struct.root); oprot.writeFieldEnd(); oprot.writeFieldStop(); oprot.writeStructEnd(); }
public boolean equals(Type that) { if (that == null) return false; boolean this_present_types = true && this.isSetTypes(); boolean that_present_types = true && that.isSetTypes(); if (this_present_types || that_present_types) { if (!(this_present_types && that_present_types)) return false; if (!this.types.equals(that.types)) return false; } boolean this_present_root = true; boolean that_present_root = true; if (this_present_root || that_present_root) { if (!(this_present_root && that_present_root)) return false; if (this.root != that.root) return false; } return true; }
/** Performs a deep copy on <i>other</i>. */ public Type(Type other) { __isset_bit_vector.clear(); __isset_bit_vector.or(other.__isset_bit_vector); if (other.isSetTypes()) { Map<Integer, Typ> __this__types = new HashMap<Integer, Typ>(); for (Map.Entry<Integer, Typ> other_element : other.types.entrySet()) { Integer other_element_key = other_element.getKey(); Typ other_element_value = other_element.getValue(); Integer __this__types_copy_key = other_element_key; Typ __this__types_copy_value = new Typ(other_element_value); __this__types.put(__this__types_copy_key, __this__types_copy_value); } this.types = __this__types; } this.root = other.root; }