Example #1
0
  @Override
  public int compareTo(SharedStruct other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetKey()).compareTo(other.isSetKey());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetKey()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.key, other.key);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetValue()).compareTo(other.isSetValue());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetValue()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.value, other.value);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }
Example #2
0
 /** Performs a deep copy on <i>other</i>. */
 public SharedStruct(SharedStruct other) {
   __isset_bitfield = other.__isset_bitfield;
   this.key = other.key;
   if (other.isSetValue()) {
     this.value = other.value;
   }
 }
Example #3
0
 @Override
 public void write(org.apache.thrift.protocol.TProtocol prot, SharedStruct struct)
     throws org.apache.thrift.TException {
   TTupleProtocol oprot = (TTupleProtocol) prot;
   BitSet optionals = new BitSet();
   if (struct.isSetKey()) {
     optionals.set(0);
   }
   if (struct.isSetValue()) {
     optionals.set(1);
   }
   oprot.writeBitSet(optionals, 2);
   if (struct.isSetKey()) {
     oprot.writeI32(struct.key);
   }
   if (struct.isSetValue()) {
     oprot.writeString(struct.value);
   }
 }
Example #4
0
  public boolean equals(SharedStruct that) {
    if (that == null) return false;

    boolean this_present_key = true;
    boolean that_present_key = true;
    if (this_present_key || that_present_key) {
      if (!(this_present_key && that_present_key)) return false;
      if (this.key != that.key) return false;
    }

    boolean this_present_value = true && this.isSetValue();
    boolean that_present_value = true && that.isSetValue();
    if (this_present_value || that_present_value) {
      if (!(this_present_value && that_present_value)) return false;
      if (!this.value.equals(that.value)) return false;
    }

    return true;
  }