예제 #1
0
    public void write(org.apache.thrift.protocol.TProtocol oprot, Location struct)
        throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.city != null) {
        if (struct.is_set_city()) {
          oprot.writeFieldBegin(CITY_FIELD_DESC);
          oprot.writeString(struct.city);
          oprot.writeFieldEnd();
        }
      }
      if (struct.state != null) {
        if (struct.is_set_state()) {
          oprot.writeFieldBegin(STATE_FIELD_DESC);
          oprot.writeString(struct.state);
          oprot.writeFieldEnd();
        }
      }
      if (struct.country != null) {
        if (struct.is_set_country()) {
          oprot.writeFieldBegin(COUNTRY_FIELD_DESC);
          oprot.writeString(struct.country);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }
예제 #2
0
  public boolean equals(Location that) {
    if (that == null) return false;

    boolean this_present_city = true && this.is_set_city();
    boolean that_present_city = true && that.is_set_city();
    if (this_present_city || that_present_city) {
      if (!(this_present_city && that_present_city)) return false;
      if (!this.city.equals(that.city)) return false;
    }

    boolean this_present_state = true && this.is_set_state();
    boolean that_present_state = true && that.is_set_state();
    if (this_present_state || that_present_state) {
      if (!(this_present_state && that_present_state)) return false;
      if (!this.state.equals(that.state)) return false;
    }

    boolean this_present_country = true && this.is_set_country();
    boolean that_present_country = true && that.is_set_country();
    if (this_present_country || that_present_country) {
      if (!(this_present_country && that_present_country)) return false;
      if (!this.country.equals(that.country)) return false;
    }

    return true;
  }
예제 #3
0
 /** Performs a deep copy on <i>other</i>. */
 public Location(Location other) {
   if (other.is_set_city()) {
     this.city = other.city;
   }
   if (other.is_set_state()) {
     this.state = other.state;
   }
   if (other.is_set_country()) {
     this.country = other.country;
   }
 }
예제 #4
0
  public int compareTo(Location other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(is_set_city()).compareTo(other.is_set_city());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_city()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.city, other.city);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(is_set_state()).compareTo(other.is_set_state());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_state()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.state, other.state);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(is_set_country()).compareTo(other.is_set_country());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_country()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.country, other.country);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }
예제 #5
0
 public void read(org.apache.thrift.protocol.TProtocol iprot, Location 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: // CITY
         if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
           struct.city = iprot.readString();
           struct.set_city_isSet(true);
         } else {
           org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
         }
         break;
       case 2: // STATE
         if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
           struct.state = iprot.readString();
           struct.set_state_isSet(true);
         } else {
           org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
         }
         break;
       case 3: // COUNTRY
         if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
           struct.country = iprot.readString();
           struct.set_country_isSet(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();
 }
예제 #6
0
 public void read(org.apache.thrift.protocol.TProtocol prot, Location struct)
     throws org.apache.thrift.TException {
   TTupleProtocol iprot = (TTupleProtocol) prot;
   BitSet incoming = iprot.readBitSet(3);
   if (incoming.get(0)) {
     struct.city = iprot.readString();
     struct.set_city_isSet(true);
   }
   if (incoming.get(1)) {
     struct.state = iprot.readString();
     struct.set_state_isSet(true);
   }
   if (incoming.get(2)) {
     struct.country = iprot.readString();
     struct.set_country_isSet(true);
   }
 }
예제 #7
0
 public void write(org.apache.thrift.protocol.TProtocol prot, Location struct)
     throws org.apache.thrift.TException {
   TTupleProtocol oprot = (TTupleProtocol) prot;
   BitSet optionals = new BitSet();
   if (struct.is_set_city()) {
     optionals.set(0);
   }
   if (struct.is_set_state()) {
     optionals.set(1);
   }
   if (struct.is_set_country()) {
     optionals.set(2);
   }
   oprot.writeBitSet(optionals, 3);
   if (struct.is_set_city()) {
     oprot.writeString(struct.city);
   }
   if (struct.is_set_state()) {
     oprot.writeString(struct.state);
   }
   if (struct.is_set_country()) {
     oprot.writeString(struct.country);
   }
 }