Example #1
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;
  }
Example #2
0
    public void write(org.apache.thrift.protocol.TProtocol oprot, Advert struct)
        throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(ID_FIELD_DESC);
      oprot.writeI32(struct.id);
      oprot.writeFieldEnd();
      if (struct.issuer != null) {
        oprot.writeFieldBegin(ISSUER_FIELD_DESC);
        struct.issuer.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.book != null) {
        oprot.writeFieldBegin(BOOK_FIELD_DESC);
        struct.book.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.advertType != null) {
        oprot.writeFieldBegin(ADVERT_TYPE_FIELD_DESC);
        oprot.writeI32(struct.advertType.getValue());
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(EXPIRES_FIELD_DESC);
      oprot.writeI64(struct.expires);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(PRICE_FIELD_DESC);
      oprot.writeDouble(struct.price);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(WINNER_FIELD_DESC);
      oprot.writeI32(struct.winner);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }
Example #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;
 }
Example #4
0
 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, Advert struct)
     throws org.apache.thrift.TException {
   TTupleProtocol iprot = (TTupleProtocol) prot;
   BitSet incoming = iprot.readBitSet(7);
   if (incoming.get(0)) {
     struct.id = iprot.readI32();
     struct.setIdIsSet(true);
   }
   if (incoming.get(1)) {
     struct.issuer = new com.booktion.thrift.User();
     struct.issuer.read(iprot);
     struct.setIssuerIsSet(true);
   }
   if (incoming.get(2)) {
     struct.book = new com.booktion.thrift.Book();
     struct.book.read(iprot);
     struct.setBookIsSet(true);
   }
   if (incoming.get(3)) {
     struct.advertType = com.booktion.thrift.AdvertType.findByValue(iprot.readI32());
     struct.setAdvertTypeIsSet(true);
   }
   if (incoming.get(4)) {
     struct.expires = iprot.readI64();
     struct.setExpiresIsSet(true);
   }
   if (incoming.get(5)) {
     struct.price = iprot.readDouble();
     struct.setPriceIsSet(true);
   }
   if (incoming.get(6)) {
     struct.winner = iprot.readI32();
     struct.setWinnerIsSet(true);
   }
 }
Example #5
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);
   }
 }
Example #6
0
    public void read(org.apache.thrift.protocol.TProtocol iprot, Advert 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: // ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.id = iprot.readI32();
              struct.setIdIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // ISSUER
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.issuer = new com.booktion.thrift.User();
              struct.issuer.read(iprot);
              struct.setIssuerIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // BOOK
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.book = new com.booktion.thrift.Book();
              struct.book.read(iprot);
              struct.setBookIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // ADVERT_TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.advertType = com.booktion.thrift.AdvertType.findByValue(iprot.readI32());
              struct.setAdvertTypeIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // EXPIRES
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.expires = iprot.readI64();
              struct.setExpiresIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // PRICE
            if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) {
              struct.price = iprot.readDouble();
              struct.setPriceIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // WINNER
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.winner = iprot.readI32();
              struct.setWinnerIsSet(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();
    }
Example #7
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;
  }