Subversion Repositories SmartDukaan

Rev

Rev 5945 | Blame | Compare with Previous | Last modification | View Log | RSS feed

/**
 * Autogenerated by Thrift Compiler (0.7.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 */
package in.shop2020.model.v1.inventory;

import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class VendorItemPricing implements org.apache.thrift.TBase<VendorItemPricing, VendorItemPricing._Fields>, java.io.Serializable, Cloneable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("VendorItemPricing");

  private static final org.apache.thrift.protocol.TField VENDOR_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("vendorId", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField ITEM_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("itemId", org.apache.thrift.protocol.TType.I64, (short)2);
  private static final org.apache.thrift.protocol.TField TRANSFER_PRICE_FIELD_DESC = new org.apache.thrift.protocol.TField("transferPrice", org.apache.thrift.protocol.TType.DOUBLE, (short)3);
  private static final org.apache.thrift.protocol.TField MOP_FIELD_DESC = new org.apache.thrift.protocol.TField("mop", org.apache.thrift.protocol.TType.DOUBLE, (short)4);
  private static final org.apache.thrift.protocol.TField DEALER_PRICE_FIELD_DESC = new org.apache.thrift.protocol.TField("dealerPrice", org.apache.thrift.protocol.TType.DOUBLE, (short)5);
  private static final org.apache.thrift.protocol.TField NLC_FIELD_DESC = new org.apache.thrift.protocol.TField("nlc", org.apache.thrift.protocol.TType.DOUBLE, (short)6);

  private long vendorId; // required
  private long itemId; // required
  private double transferPrice; // required
  private double mop; // required
  private double dealerPrice; // required
  private double nlc; // required

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    VENDOR_ID((short)1, "vendorId"),
    ITEM_ID((short)2, "itemId"),
    TRANSFER_PRICE((short)3, "transferPrice"),
    MOP((short)4, "mop"),
    DEALER_PRICE((short)5, "dealerPrice"),
    NLC((short)6, "nlc");

    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

    static {
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // VENDOR_ID
          return VENDOR_ID;
        case 2: // ITEM_ID
          return ITEM_ID;
        case 3: // TRANSFER_PRICE
          return TRANSFER_PRICE;
        case 4: // MOP
          return MOP;
        case 5: // DEALER_PRICE
          return DEALER_PRICE;
        case 6: // NLC
          return NLC;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    public static _Fields findByName(String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final String _fieldName;

    _Fields(short thriftId, String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final int __VENDORID_ISSET_ID = 0;
  private static final int __ITEMID_ISSET_ID = 1;
  private static final int __TRANSFERPRICE_ISSET_ID = 2;
  private static final int __MOP_ISSET_ID = 3;
  private static final int __DEALERPRICE_ISSET_ID = 4;
  private static final int __NLC_ISSET_ID = 5;
  private BitSet __isset_bit_vector = new BitSet(6);

  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.VENDOR_ID, new org.apache.thrift.meta_data.FieldMetaData("vendorId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.ITEM_ID, new org.apache.thrift.meta_data.FieldMetaData("itemId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.TRANSFER_PRICE, new org.apache.thrift.meta_data.FieldMetaData("transferPrice", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.MOP, new org.apache.thrift.meta_data.FieldMetaData("mop", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.DEALER_PRICE, new org.apache.thrift.meta_data.FieldMetaData("dealerPrice", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.NLC, new org.apache.thrift.meta_data.FieldMetaData("nlc", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(VendorItemPricing.class, metaDataMap);
  }

  public VendorItemPricing() {
  }

  public VendorItemPricing(
    long vendorId,
    long itemId,
    double transferPrice,
    double mop,
    double dealerPrice,
    double nlc)
  {
    this();
    this.vendorId = vendorId;
    setVendorIdIsSet(true);
    this.itemId = itemId;
    setItemIdIsSet(true);
    this.transferPrice = transferPrice;
    setTransferPriceIsSet(true);
    this.mop = mop;
    setMopIsSet(true);
    this.dealerPrice = dealerPrice;
    setDealerPriceIsSet(true);
    this.nlc = nlc;
    setNlcIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public VendorItemPricing(VendorItemPricing other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.vendorId = other.vendorId;
    this.itemId = other.itemId;
    this.transferPrice = other.transferPrice;
    this.mop = other.mop;
    this.dealerPrice = other.dealerPrice;
    this.nlc = other.nlc;
  }

  public VendorItemPricing deepCopy() {
    return new VendorItemPricing(this);
  }

  @Override
  public void clear() {
    setVendorIdIsSet(false);
    this.vendorId = 0;
    setItemIdIsSet(false);
    this.itemId = 0;
    setTransferPriceIsSet(false);
    this.transferPrice = 0.0;
    setMopIsSet(false);
    this.mop = 0.0;
    setDealerPriceIsSet(false);
    this.dealerPrice = 0.0;
    setNlcIsSet(false);
    this.nlc = 0.0;
  }

  public long getVendorId() {
    return this.vendorId;
  }

  public void setVendorId(long vendorId) {
    this.vendorId = vendorId;
    setVendorIdIsSet(true);
  }

  public void unsetVendorId() {
    __isset_bit_vector.clear(__VENDORID_ISSET_ID);
  }

  /** Returns true if field vendorId is set (has been assigned a value) and false otherwise */
  public boolean isSetVendorId() {
    return __isset_bit_vector.get(__VENDORID_ISSET_ID);
  }

  public void setVendorIdIsSet(boolean value) {
    __isset_bit_vector.set(__VENDORID_ISSET_ID, value);
  }

  public long getItemId() {
    return this.itemId;
  }

  public void setItemId(long itemId) {
    this.itemId = itemId;
    setItemIdIsSet(true);
  }

  public void unsetItemId() {
    __isset_bit_vector.clear(__ITEMID_ISSET_ID);
  }

  /** Returns true if field itemId is set (has been assigned a value) and false otherwise */
  public boolean isSetItemId() {
    return __isset_bit_vector.get(__ITEMID_ISSET_ID);
  }

  public void setItemIdIsSet(boolean value) {
    __isset_bit_vector.set(__ITEMID_ISSET_ID, value);
  }

  public double getTransferPrice() {
    return this.transferPrice;
  }

  public void setTransferPrice(double transferPrice) {
    this.transferPrice = transferPrice;
    setTransferPriceIsSet(true);
  }

  public void unsetTransferPrice() {
    __isset_bit_vector.clear(__TRANSFERPRICE_ISSET_ID);
  }

  /** Returns true if field transferPrice is set (has been assigned a value) and false otherwise */
  public boolean isSetTransferPrice() {
    return __isset_bit_vector.get(__TRANSFERPRICE_ISSET_ID);
  }

  public void setTransferPriceIsSet(boolean value) {
    __isset_bit_vector.set(__TRANSFERPRICE_ISSET_ID, value);
  }

  public double getMop() {
    return this.mop;
  }

  public void setMop(double mop) {
    this.mop = mop;
    setMopIsSet(true);
  }

  public void unsetMop() {
    __isset_bit_vector.clear(__MOP_ISSET_ID);
  }

  /** Returns true if field mop is set (has been assigned a value) and false otherwise */
  public boolean isSetMop() {
    return __isset_bit_vector.get(__MOP_ISSET_ID);
  }

  public void setMopIsSet(boolean value) {
    __isset_bit_vector.set(__MOP_ISSET_ID, value);
  }

  public double getDealerPrice() {
    return this.dealerPrice;
  }

  public void setDealerPrice(double dealerPrice) {
    this.dealerPrice = dealerPrice;
    setDealerPriceIsSet(true);
  }

  public void unsetDealerPrice() {
    __isset_bit_vector.clear(__DEALERPRICE_ISSET_ID);
  }

  /** Returns true if field dealerPrice is set (has been assigned a value) and false otherwise */
  public boolean isSetDealerPrice() {
    return __isset_bit_vector.get(__DEALERPRICE_ISSET_ID);
  }

  public void setDealerPriceIsSet(boolean value) {
    __isset_bit_vector.set(__DEALERPRICE_ISSET_ID, value);
  }

  public double getNlc() {
    return this.nlc;
  }

  public void setNlc(double nlc) {
    this.nlc = nlc;
    setNlcIsSet(true);
  }

  public void unsetNlc() {
    __isset_bit_vector.clear(__NLC_ISSET_ID);
  }

  /** Returns true if field nlc is set (has been assigned a value) and false otherwise */
  public boolean isSetNlc() {
    return __isset_bit_vector.get(__NLC_ISSET_ID);
  }

  public void setNlcIsSet(boolean value) {
    __isset_bit_vector.set(__NLC_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case VENDOR_ID:
      if (value == null) {
        unsetVendorId();
      } else {
        setVendorId((Long)value);
      }
      break;

    case ITEM_ID:
      if (value == null) {
        unsetItemId();
      } else {
        setItemId((Long)value);
      }
      break;

    case TRANSFER_PRICE:
      if (value == null) {
        unsetTransferPrice();
      } else {
        setTransferPrice((Double)value);
      }
      break;

    case MOP:
      if (value == null) {
        unsetMop();
      } else {
        setMop((Double)value);
      }
      break;

    case DEALER_PRICE:
      if (value == null) {
        unsetDealerPrice();
      } else {
        setDealerPrice((Double)value);
      }
      break;

    case NLC:
      if (value == null) {
        unsetNlc();
      } else {
        setNlc((Double)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case VENDOR_ID:
      return Long.valueOf(getVendorId());

    case ITEM_ID:
      return Long.valueOf(getItemId());

    case TRANSFER_PRICE:
      return Double.valueOf(getTransferPrice());

    case MOP:
      return Double.valueOf(getMop());

    case DEALER_PRICE:
      return Double.valueOf(getDealerPrice());

    case NLC:
      return Double.valueOf(getNlc());

    }
    throw new IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case VENDOR_ID:
      return isSetVendorId();
    case ITEM_ID:
      return isSetItemId();
    case TRANSFER_PRICE:
      return isSetTransferPrice();
    case MOP:
      return isSetMop();
    case DEALER_PRICE:
      return isSetDealerPrice();
    case NLC:
      return isSetNlc();
    }
    throw new IllegalStateException();
  }

  @Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof VendorItemPricing)
      return this.equals((VendorItemPricing)that);
    return false;
  }

  public boolean equals(VendorItemPricing that) {
    if (that == null)
      return false;

    boolean this_present_vendorId = true;
    boolean that_present_vendorId = true;
    if (this_present_vendorId || that_present_vendorId) {
      if (!(this_present_vendorId && that_present_vendorId))
        return false;
      if (this.vendorId != that.vendorId)
        return false;
    }

    boolean this_present_itemId = true;
    boolean that_present_itemId = true;
    if (this_present_itemId || that_present_itemId) {
      if (!(this_present_itemId && that_present_itemId))
        return false;
      if (this.itemId != that.itemId)
        return false;
    }

    boolean this_present_transferPrice = true;
    boolean that_present_transferPrice = true;
    if (this_present_transferPrice || that_present_transferPrice) {
      if (!(this_present_transferPrice && that_present_transferPrice))
        return false;
      if (this.transferPrice != that.transferPrice)
        return false;
    }

    boolean this_present_mop = true;
    boolean that_present_mop = true;
    if (this_present_mop || that_present_mop) {
      if (!(this_present_mop && that_present_mop))
        return false;
      if (this.mop != that.mop)
        return false;
    }

    boolean this_present_dealerPrice = true;
    boolean that_present_dealerPrice = true;
    if (this_present_dealerPrice || that_present_dealerPrice) {
      if (!(this_present_dealerPrice && that_present_dealerPrice))
        return false;
      if (this.dealerPrice != that.dealerPrice)
        return false;
    }

    boolean this_present_nlc = true;
    boolean that_present_nlc = true;
    if (this_present_nlc || that_present_nlc) {
      if (!(this_present_nlc && that_present_nlc))
        return false;
      if (this.nlc != that.nlc)
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    return 0;
  }

  public int compareTo(VendorItemPricing other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;
    VendorItemPricing typedOther = (VendorItemPricing)other;

    lastComparison = Boolean.valueOf(isSetVendorId()).compareTo(typedOther.isSetVendorId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetVendorId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.vendorId, typedOther.vendorId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetItemId()).compareTo(typedOther.isSetItemId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetItemId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.itemId, typedOther.itemId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTransferPrice()).compareTo(typedOther.isSetTransferPrice());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTransferPrice()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.transferPrice, typedOther.transferPrice);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetMop()).compareTo(typedOther.isSetMop());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMop()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.mop, typedOther.mop);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDealerPrice()).compareTo(typedOther.isSetDealerPrice());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDealerPrice()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dealerPrice, typedOther.dealerPrice);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetNlc()).compareTo(typedOther.isSetNlc());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNlc()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nlc, typedOther.nlc);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    org.apache.thrift.protocol.TField field;
    iprot.readStructBegin();
    while (true)
    {
      field = iprot.readFieldBegin();
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
        break;
      }
      switch (field.id) {
        case 1: // VENDOR_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.vendorId = iprot.readI64();
            setVendorIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // ITEM_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.itemId = iprot.readI64();
            setItemIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // TRANSFER_PRICE
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
            this.transferPrice = iprot.readDouble();
            setTransferPriceIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // MOP
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
            this.mop = iprot.readDouble();
            setMopIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 5: // DEALER_PRICE
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
            this.dealerPrice = iprot.readDouble();
            setDealerPriceIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 6: // NLC
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
            this.nlc = iprot.readDouble();
            setNlcIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        default:
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
      }
      iprot.readFieldEnd();
    }
    iprot.readStructEnd();
    validate();
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    validate();

    oprot.writeStructBegin(STRUCT_DESC);
    oprot.writeFieldBegin(VENDOR_ID_FIELD_DESC);
    oprot.writeI64(this.vendorId);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
    oprot.writeI64(this.itemId);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(TRANSFER_PRICE_FIELD_DESC);
    oprot.writeDouble(this.transferPrice);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(MOP_FIELD_DESC);
    oprot.writeDouble(this.mop);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(DEALER_PRICE_FIELD_DESC);
    oprot.writeDouble(this.dealerPrice);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(NLC_FIELD_DESC);
    oprot.writeDouble(this.nlc);
    oprot.writeFieldEnd();
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder("VendorItemPricing(");
    boolean first = true;

    sb.append("vendorId:");
    sb.append(this.vendorId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("itemId:");
    sb.append(this.itemId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("transferPrice:");
    sb.append(this.transferPrice);
    first = false;
    if (!first) sb.append(", ");
    sb.append("mop:");
    sb.append(this.mop);
    first = false;
    if (!first) sb.append(", ");
    sb.append("dealerPrice:");
    sb.append(this.dealerPrice);
    first = false;
    if (!first) sb.append(", ");
    sb.append("nlc:");
    sb.append(this.nlc);
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
    try {
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
      __isset_bit_vector = new BitSet(1);
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

}