示例#1
0
 @Override
 public void write(org.apache.thrift.protocol.TProtocol prot, Advert struct)
     throws org.apache.thrift.TException {
   TTupleProtocol oprot = (TTupleProtocol) prot;
   BitSet optionals = new BitSet();
   if (struct.isSetId()) {
     optionals.set(0);
   }
   if (struct.isSetIssuer()) {
     optionals.set(1);
   }
   if (struct.isSetBook()) {
     optionals.set(2);
   }
   if (struct.isSetAdvertType()) {
     optionals.set(3);
   }
   if (struct.isSetExpires()) {
     optionals.set(4);
   }
   if (struct.isSetPrice()) {
     optionals.set(5);
   }
   if (struct.isSetWinner()) {
     optionals.set(6);
   }
   oprot.writeBitSet(optionals, 7);
   if (struct.isSetId()) {
     oprot.writeI32(struct.id);
   }
   if (struct.isSetIssuer()) {
     struct.issuer.write(oprot);
   }
   if (struct.isSetBook()) {
     struct.book.write(oprot);
   }
   if (struct.isSetAdvertType()) {
     oprot.writeI32(struct.advertType.getValue());
   }
   if (struct.isSetExpires()) {
     oprot.writeI64(struct.expires);
   }
   if (struct.isSetPrice()) {
     oprot.writeDouble(struct.price);
   }
   if (struct.isSetWinner()) {
     oprot.writeI32(struct.winner);
   }
 }
示例#2
0
  public boolean equals(Advert that) {
    if (that == null) return false;

    boolean this_present_id = true;
    boolean that_present_id = true;
    if (this_present_id || that_present_id) {
      if (!(this_present_id && that_present_id)) return false;
      if (this.id != that.id) return false;
    }

    boolean this_present_issuer = true && this.isSetIssuer();
    boolean that_present_issuer = true && that.isSetIssuer();
    if (this_present_issuer || that_present_issuer) {
      if (!(this_present_issuer && that_present_issuer)) return false;
      if (!this.issuer.equals(that.issuer)) return false;
    }

    boolean this_present_book = true && this.isSetBook();
    boolean that_present_book = true && that.isSetBook();
    if (this_present_book || that_present_book) {
      if (!(this_present_book && that_present_book)) return false;
      if (!this.book.equals(that.book)) return false;
    }

    boolean this_present_advertType = true && this.isSetAdvertType();
    boolean that_present_advertType = true && that.isSetAdvertType();
    if (this_present_advertType || that_present_advertType) {
      if (!(this_present_advertType && that_present_advertType)) return false;
      if (!this.advertType.equals(that.advertType)) return false;
    }

    boolean this_present_expires = true;
    boolean that_present_expires = true;
    if (this_present_expires || that_present_expires) {
      if (!(this_present_expires && that_present_expires)) return false;
      if (this.expires != that.expires) return false;
    }

    boolean this_present_price = true;
    boolean that_present_price = true;
    if (this_present_price || that_present_price) {
      if (!(this_present_price && that_present_price)) return false;
      if (this.price != that.price) return false;
    }

    boolean this_present_winner = true;
    boolean that_present_winner = true;
    if (this_present_winner || that_present_winner) {
      if (!(this_present_winner && that_present_winner)) return false;
      if (this.winner != that.winner) return false;
    }

    return true;
  }
示例#3
0
 /** Performs a deep copy on <i>other</i>. */
 public Advert(Advert other) {
   __isset_bitfield = other.__isset_bitfield;
   this.id = other.id;
   if (other.isSetIssuer()) {
     this.issuer = new com.booktion.thrift.User(other.issuer);
   }
   if (other.isSetBook()) {
     this.book = new com.booktion.thrift.Book(other.book);
   }
   if (other.isSetAdvertType()) {
     this.advertType = other.advertType;
   }
   this.expires = other.expires;
   this.price = other.price;
   this.winner = other.winner;
 }
示例#4
0
  @Override
  public int compareTo(Advert other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetId()).compareTo(other.isSetId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, other.id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetIssuer()).compareTo(other.isSetIssuer());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIssuer()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.issuer, other.issuer);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetBook()).compareTo(other.isSetBook());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBook()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.book, other.book);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetAdvertType()).compareTo(other.isSetAdvertType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAdvertType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.advertType, other.advertType);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetExpires()).compareTo(other.isSetExpires());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetExpires()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.expires, other.expires);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetPrice()).compareTo(other.isSetPrice());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPrice()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.price, other.price);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetWinner()).compareTo(other.isSetWinner());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetWinner()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.winner, other.winner);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }