Subversion Repositories SmartDukaan

Rev

Blame | 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.order;

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 AmazonHourlySaleSnapshot implements org.apache.thrift.TBase<AmazonHourlySaleSnapshot, AmazonHourlySaleSnapshot._Fields>, java.io.Serializable, Cloneable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AmazonHourlySaleSnapshot");

  private static final org.apache.thrift.protocol.TField SNAPSHOT_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("snapshotTime", 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("item_id", org.apache.thrift.protocol.TType.I64, (short)2);
  private static final org.apache.thrift.protocol.TField TOTAL_ORDER_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("totalOrderCount", org.apache.thrift.protocol.TType.I32, (short)3);
  private static final org.apache.thrift.protocol.TField AMAZON_FBA_INVENTORY_FIELD_DESC = new org.apache.thrift.protocol.TField("amazonFbaInventory", org.apache.thrift.protocol.TType.I64, (short)4);
  private static final org.apache.thrift.protocol.TField IS_OUT_OF_STOCK_FIELD_DESC = new org.apache.thrift.protocol.TField("isOutOfStock", org.apache.thrift.protocol.TType.BOOL, (short)5);
  private static final org.apache.thrift.protocol.TField TOTAL_SALE_FIELD_DESC = new org.apache.thrift.protocol.TField("totalSale", org.apache.thrift.protocol.TType.DOUBLE, (short)6);
  private static final org.apache.thrift.protocol.TField PROMOTION_SALE_FIELD_DESC = new org.apache.thrift.protocol.TField("promotionSale", org.apache.thrift.protocol.TType.DOUBLE, (short)7);
  private static final org.apache.thrift.protocol.TField PROMOTION_ORDER_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("promotionOrderCount", org.apache.thrift.protocol.TType.I32, (short)8);
  private static final org.apache.thrift.protocol.TField FC_LOCATION_FIELD_DESC = new org.apache.thrift.protocol.TField("fcLocation", org.apache.thrift.protocol.TType.I32, (short)9);

  private long snapshotTime; // required
  private long item_id; // required
  private int totalOrderCount; // required
  private long amazonFbaInventory; // required
  private boolean isOutOfStock; // required
  private double totalSale; // required
  private double promotionSale; // required
  private int promotionOrderCount; // required
  private AmazonFCWarehouseLocation fcLocation; // 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 {
    SNAPSHOT_TIME((short)1, "snapshotTime"),
    ITEM_ID((short)2, "item_id"),
    TOTAL_ORDER_COUNT((short)3, "totalOrderCount"),
    AMAZON_FBA_INVENTORY((short)4, "amazonFbaInventory"),
    IS_OUT_OF_STOCK((short)5, "isOutOfStock"),
    TOTAL_SALE((short)6, "totalSale"),
    PROMOTION_SALE((short)7, "promotionSale"),
    PROMOTION_ORDER_COUNT((short)8, "promotionOrderCount"),
    /**
     * 
     * @see AmazonFCWarehouseLocation
     */
    FC_LOCATION((short)9, "fcLocation");

    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: // SNAPSHOT_TIME
          return SNAPSHOT_TIME;
        case 2: // ITEM_ID
          return ITEM_ID;
        case 3: // TOTAL_ORDER_COUNT
          return TOTAL_ORDER_COUNT;
        case 4: // AMAZON_FBA_INVENTORY
          return AMAZON_FBA_INVENTORY;
        case 5: // IS_OUT_OF_STOCK
          return IS_OUT_OF_STOCK;
        case 6: // TOTAL_SALE
          return TOTAL_SALE;
        case 7: // PROMOTION_SALE
          return PROMOTION_SALE;
        case 8: // PROMOTION_ORDER_COUNT
          return PROMOTION_ORDER_COUNT;
        case 9: // FC_LOCATION
          return FC_LOCATION;
        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 __SNAPSHOTTIME_ISSET_ID = 0;
  private static final int __ITEM_ID_ISSET_ID = 1;
  private static final int __TOTALORDERCOUNT_ISSET_ID = 2;
  private static final int __AMAZONFBAINVENTORY_ISSET_ID = 3;
  private static final int __ISOUTOFSTOCK_ISSET_ID = 4;
  private static final int __TOTALSALE_ISSET_ID = 5;
  private static final int __PROMOTIONSALE_ISSET_ID = 6;
  private static final int __PROMOTIONORDERCOUNT_ISSET_ID = 7;
  private BitSet __isset_bit_vector = new BitSet(8);

  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.SNAPSHOT_TIME, new org.apache.thrift.meta_data.FieldMetaData("snapshotTime", 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("item_id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.TOTAL_ORDER_COUNT, new org.apache.thrift.meta_data.FieldMetaData("totalOrderCount", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.AMAZON_FBA_INVENTORY, new org.apache.thrift.meta_data.FieldMetaData("amazonFbaInventory", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.IS_OUT_OF_STOCK, new org.apache.thrift.meta_data.FieldMetaData("isOutOfStock", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.TOTAL_SALE, new org.apache.thrift.meta_data.FieldMetaData("totalSale", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.PROMOTION_SALE, new org.apache.thrift.meta_data.FieldMetaData("promotionSale", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.PROMOTION_ORDER_COUNT, new org.apache.thrift.meta_data.FieldMetaData("promotionOrderCount", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.FC_LOCATION, new org.apache.thrift.meta_data.FieldMetaData("fcLocation", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, AmazonFCWarehouseLocation.class)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AmazonHourlySaleSnapshot.class, metaDataMap);
  }

  public AmazonHourlySaleSnapshot() {
  }

  public AmazonHourlySaleSnapshot(
    long snapshotTime,
    long item_id,
    int totalOrderCount,
    long amazonFbaInventory,
    boolean isOutOfStock,
    double totalSale,
    double promotionSale,
    int promotionOrderCount,
    AmazonFCWarehouseLocation fcLocation)
  {
    this();
    this.snapshotTime = snapshotTime;
    setSnapshotTimeIsSet(true);
    this.item_id = item_id;
    setItem_idIsSet(true);
    this.totalOrderCount = totalOrderCount;
    setTotalOrderCountIsSet(true);
    this.amazonFbaInventory = amazonFbaInventory;
    setAmazonFbaInventoryIsSet(true);
    this.isOutOfStock = isOutOfStock;
    setIsOutOfStockIsSet(true);
    this.totalSale = totalSale;
    setTotalSaleIsSet(true);
    this.promotionSale = promotionSale;
    setPromotionSaleIsSet(true);
    this.promotionOrderCount = promotionOrderCount;
    setPromotionOrderCountIsSet(true);
    this.fcLocation = fcLocation;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public AmazonHourlySaleSnapshot(AmazonHourlySaleSnapshot other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.snapshotTime = other.snapshotTime;
    this.item_id = other.item_id;
    this.totalOrderCount = other.totalOrderCount;
    this.amazonFbaInventory = other.amazonFbaInventory;
    this.isOutOfStock = other.isOutOfStock;
    this.totalSale = other.totalSale;
    this.promotionSale = other.promotionSale;
    this.promotionOrderCount = other.promotionOrderCount;
    if (other.isSetFcLocation()) {
      this.fcLocation = other.fcLocation;
    }
  }

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

  @Override
  public void clear() {
    setSnapshotTimeIsSet(false);
    this.snapshotTime = 0;
    setItem_idIsSet(false);
    this.item_id = 0;
    setTotalOrderCountIsSet(false);
    this.totalOrderCount = 0;
    setAmazonFbaInventoryIsSet(false);
    this.amazonFbaInventory = 0;
    setIsOutOfStockIsSet(false);
    this.isOutOfStock = false;
    setTotalSaleIsSet(false);
    this.totalSale = 0.0;
    setPromotionSaleIsSet(false);
    this.promotionSale = 0.0;
    setPromotionOrderCountIsSet(false);
    this.promotionOrderCount = 0;
    this.fcLocation = null;
  }

  public long getSnapshotTime() {
    return this.snapshotTime;
  }

  public void setSnapshotTime(long snapshotTime) {
    this.snapshotTime = snapshotTime;
    setSnapshotTimeIsSet(true);
  }

  public void unsetSnapshotTime() {
    __isset_bit_vector.clear(__SNAPSHOTTIME_ISSET_ID);
  }

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

  public void setSnapshotTimeIsSet(boolean value) {
    __isset_bit_vector.set(__SNAPSHOTTIME_ISSET_ID, value);
  }

  public long getItem_id() {
    return this.item_id;
  }

  public void setItem_id(long item_id) {
    this.item_id = item_id;
    setItem_idIsSet(true);
  }

  public void unsetItem_id() {
    __isset_bit_vector.clear(__ITEM_ID_ISSET_ID);
  }

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

  public void setItem_idIsSet(boolean value) {
    __isset_bit_vector.set(__ITEM_ID_ISSET_ID, value);
  }

  public int getTotalOrderCount() {
    return this.totalOrderCount;
  }

  public void setTotalOrderCount(int totalOrderCount) {
    this.totalOrderCount = totalOrderCount;
    setTotalOrderCountIsSet(true);
  }

  public void unsetTotalOrderCount() {
    __isset_bit_vector.clear(__TOTALORDERCOUNT_ISSET_ID);
  }

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

  public void setTotalOrderCountIsSet(boolean value) {
    __isset_bit_vector.set(__TOTALORDERCOUNT_ISSET_ID, value);
  }

  public long getAmazonFbaInventory() {
    return this.amazonFbaInventory;
  }

  public void setAmazonFbaInventory(long amazonFbaInventory) {
    this.amazonFbaInventory = amazonFbaInventory;
    setAmazonFbaInventoryIsSet(true);
  }

  public void unsetAmazonFbaInventory() {
    __isset_bit_vector.clear(__AMAZONFBAINVENTORY_ISSET_ID);
  }

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

  public void setAmazonFbaInventoryIsSet(boolean value) {
    __isset_bit_vector.set(__AMAZONFBAINVENTORY_ISSET_ID, value);
  }

  public boolean isIsOutOfStock() {
    return this.isOutOfStock;
  }

  public void setIsOutOfStock(boolean isOutOfStock) {
    this.isOutOfStock = isOutOfStock;
    setIsOutOfStockIsSet(true);
  }

  public void unsetIsOutOfStock() {
    __isset_bit_vector.clear(__ISOUTOFSTOCK_ISSET_ID);
  }

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

  public void setIsOutOfStockIsSet(boolean value) {
    __isset_bit_vector.set(__ISOUTOFSTOCK_ISSET_ID, value);
  }

  public double getTotalSale() {
    return this.totalSale;
  }

  public void setTotalSale(double totalSale) {
    this.totalSale = totalSale;
    setTotalSaleIsSet(true);
  }

  public void unsetTotalSale() {
    __isset_bit_vector.clear(__TOTALSALE_ISSET_ID);
  }

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

  public void setTotalSaleIsSet(boolean value) {
    __isset_bit_vector.set(__TOTALSALE_ISSET_ID, value);
  }

  public double getPromotionSale() {
    return this.promotionSale;
  }

  public void setPromotionSale(double promotionSale) {
    this.promotionSale = promotionSale;
    setPromotionSaleIsSet(true);
  }

  public void unsetPromotionSale() {
    __isset_bit_vector.clear(__PROMOTIONSALE_ISSET_ID);
  }

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

  public void setPromotionSaleIsSet(boolean value) {
    __isset_bit_vector.set(__PROMOTIONSALE_ISSET_ID, value);
  }

  public int getPromotionOrderCount() {
    return this.promotionOrderCount;
  }

  public void setPromotionOrderCount(int promotionOrderCount) {
    this.promotionOrderCount = promotionOrderCount;
    setPromotionOrderCountIsSet(true);
  }

  public void unsetPromotionOrderCount() {
    __isset_bit_vector.clear(__PROMOTIONORDERCOUNT_ISSET_ID);
  }

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

  public void setPromotionOrderCountIsSet(boolean value) {
    __isset_bit_vector.set(__PROMOTIONORDERCOUNT_ISSET_ID, value);
  }

  /**
   * 
   * @see AmazonFCWarehouseLocation
   */
  public AmazonFCWarehouseLocation getFcLocation() {
    return this.fcLocation;
  }

  /**
   * 
   * @see AmazonFCWarehouseLocation
   */
  public void setFcLocation(AmazonFCWarehouseLocation fcLocation) {
    this.fcLocation = fcLocation;
  }

  public void unsetFcLocation() {
    this.fcLocation = null;
  }

  /** Returns true if field fcLocation is set (has been assigned a value) and false otherwise */
  public boolean isSetFcLocation() {
    return this.fcLocation != null;
  }

  public void setFcLocationIsSet(boolean value) {
    if (!value) {
      this.fcLocation = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case SNAPSHOT_TIME:
      if (value == null) {
        unsetSnapshotTime();
      } else {
        setSnapshotTime((Long)value);
      }
      break;

    case ITEM_ID:
      if (value == null) {
        unsetItem_id();
      } else {
        setItem_id((Long)value);
      }
      break;

    case TOTAL_ORDER_COUNT:
      if (value == null) {
        unsetTotalOrderCount();
      } else {
        setTotalOrderCount((Integer)value);
      }
      break;

    case AMAZON_FBA_INVENTORY:
      if (value == null) {
        unsetAmazonFbaInventory();
      } else {
        setAmazonFbaInventory((Long)value);
      }
      break;

    case IS_OUT_OF_STOCK:
      if (value == null) {
        unsetIsOutOfStock();
      } else {
        setIsOutOfStock((Boolean)value);
      }
      break;

    case TOTAL_SALE:
      if (value == null) {
        unsetTotalSale();
      } else {
        setTotalSale((Double)value);
      }
      break;

    case PROMOTION_SALE:
      if (value == null) {
        unsetPromotionSale();
      } else {
        setPromotionSale((Double)value);
      }
      break;

    case PROMOTION_ORDER_COUNT:
      if (value == null) {
        unsetPromotionOrderCount();
      } else {
        setPromotionOrderCount((Integer)value);
      }
      break;

    case FC_LOCATION:
      if (value == null) {
        unsetFcLocation();
      } else {
        setFcLocation((AmazonFCWarehouseLocation)value);
      }
      break;

    }
  }

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

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

    case TOTAL_ORDER_COUNT:
      return Integer.valueOf(getTotalOrderCount());

    case AMAZON_FBA_INVENTORY:
      return Long.valueOf(getAmazonFbaInventory());

    case IS_OUT_OF_STOCK:
      return Boolean.valueOf(isIsOutOfStock());

    case TOTAL_SALE:
      return Double.valueOf(getTotalSale());

    case PROMOTION_SALE:
      return Double.valueOf(getPromotionSale());

    case PROMOTION_ORDER_COUNT:
      return Integer.valueOf(getPromotionOrderCount());

    case FC_LOCATION:
      return getFcLocation();

    }
    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 SNAPSHOT_TIME:
      return isSetSnapshotTime();
    case ITEM_ID:
      return isSetItem_id();
    case TOTAL_ORDER_COUNT:
      return isSetTotalOrderCount();
    case AMAZON_FBA_INVENTORY:
      return isSetAmazonFbaInventory();
    case IS_OUT_OF_STOCK:
      return isSetIsOutOfStock();
    case TOTAL_SALE:
      return isSetTotalSale();
    case PROMOTION_SALE:
      return isSetPromotionSale();
    case PROMOTION_ORDER_COUNT:
      return isSetPromotionOrderCount();
    case FC_LOCATION:
      return isSetFcLocation();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_snapshotTime = true;
    boolean that_present_snapshotTime = true;
    if (this_present_snapshotTime || that_present_snapshotTime) {
      if (!(this_present_snapshotTime && that_present_snapshotTime))
        return false;
      if (this.snapshotTime != that.snapshotTime)
        return false;
    }

    boolean this_present_item_id = true;
    boolean that_present_item_id = true;
    if (this_present_item_id || that_present_item_id) {
      if (!(this_present_item_id && that_present_item_id))
        return false;
      if (this.item_id != that.item_id)
        return false;
    }

    boolean this_present_totalOrderCount = true;
    boolean that_present_totalOrderCount = true;
    if (this_present_totalOrderCount || that_present_totalOrderCount) {
      if (!(this_present_totalOrderCount && that_present_totalOrderCount))
        return false;
      if (this.totalOrderCount != that.totalOrderCount)
        return false;
    }

    boolean this_present_amazonFbaInventory = true;
    boolean that_present_amazonFbaInventory = true;
    if (this_present_amazonFbaInventory || that_present_amazonFbaInventory) {
      if (!(this_present_amazonFbaInventory && that_present_amazonFbaInventory))
        return false;
      if (this.amazonFbaInventory != that.amazonFbaInventory)
        return false;
    }

    boolean this_present_isOutOfStock = true;
    boolean that_present_isOutOfStock = true;
    if (this_present_isOutOfStock || that_present_isOutOfStock) {
      if (!(this_present_isOutOfStock && that_present_isOutOfStock))
        return false;
      if (this.isOutOfStock != that.isOutOfStock)
        return false;
    }

    boolean this_present_totalSale = true;
    boolean that_present_totalSale = true;
    if (this_present_totalSale || that_present_totalSale) {
      if (!(this_present_totalSale && that_present_totalSale))
        return false;
      if (this.totalSale != that.totalSale)
        return false;
    }

    boolean this_present_promotionSale = true;
    boolean that_present_promotionSale = true;
    if (this_present_promotionSale || that_present_promotionSale) {
      if (!(this_present_promotionSale && that_present_promotionSale))
        return false;
      if (this.promotionSale != that.promotionSale)
        return false;
    }

    boolean this_present_promotionOrderCount = true;
    boolean that_present_promotionOrderCount = true;
    if (this_present_promotionOrderCount || that_present_promotionOrderCount) {
      if (!(this_present_promotionOrderCount && that_present_promotionOrderCount))
        return false;
      if (this.promotionOrderCount != that.promotionOrderCount)
        return false;
    }

    boolean this_present_fcLocation = true && this.isSetFcLocation();
    boolean that_present_fcLocation = true && that.isSetFcLocation();
    if (this_present_fcLocation || that_present_fcLocation) {
      if (!(this_present_fcLocation && that_present_fcLocation))
        return false;
      if (!this.fcLocation.equals(that.fcLocation))
        return false;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetSnapshotTime()).compareTo(typedOther.isSetSnapshotTime());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSnapshotTime()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.snapshotTime, typedOther.snapshotTime);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetItem_id()).compareTo(typedOther.isSetItem_id());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetItem_id()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.item_id, typedOther.item_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTotalOrderCount()).compareTo(typedOther.isSetTotalOrderCount());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTotalOrderCount()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.totalOrderCount, typedOther.totalOrderCount);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetAmazonFbaInventory()).compareTo(typedOther.isSetAmazonFbaInventory());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAmazonFbaInventory()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.amazonFbaInventory, typedOther.amazonFbaInventory);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetIsOutOfStock()).compareTo(typedOther.isSetIsOutOfStock());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIsOutOfStock()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isOutOfStock, typedOther.isOutOfStock);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTotalSale()).compareTo(typedOther.isSetTotalSale());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTotalSale()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.totalSale, typedOther.totalSale);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetPromotionSale()).compareTo(typedOther.isSetPromotionSale());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPromotionSale()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.promotionSale, typedOther.promotionSale);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetPromotionOrderCount()).compareTo(typedOther.isSetPromotionOrderCount());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPromotionOrderCount()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.promotionOrderCount, typedOther.promotionOrderCount);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetFcLocation()).compareTo(typedOther.isSetFcLocation());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFcLocation()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fcLocation, typedOther.fcLocation);
      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: // SNAPSHOT_TIME
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.snapshotTime = iprot.readI64();
            setSnapshotTimeIsSet(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.item_id = iprot.readI64();
            setItem_idIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // TOTAL_ORDER_COUNT
          if (field.type == org.apache.thrift.protocol.TType.I32) {
            this.totalOrderCount = iprot.readI32();
            setTotalOrderCountIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // AMAZON_FBA_INVENTORY
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.amazonFbaInventory = iprot.readI64();
            setAmazonFbaInventoryIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 5: // IS_OUT_OF_STOCK
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
            this.isOutOfStock = iprot.readBool();
            setIsOutOfStockIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 6: // TOTAL_SALE
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
            this.totalSale = iprot.readDouble();
            setTotalSaleIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 7: // PROMOTION_SALE
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
            this.promotionSale = iprot.readDouble();
            setPromotionSaleIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 8: // PROMOTION_ORDER_COUNT
          if (field.type == org.apache.thrift.protocol.TType.I32) {
            this.promotionOrderCount = iprot.readI32();
            setPromotionOrderCountIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 9: // FC_LOCATION
          if (field.type == org.apache.thrift.protocol.TType.I32) {
            this.fcLocation = AmazonFCWarehouseLocation.findByValue(iprot.readI32());
          } 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(SNAPSHOT_TIME_FIELD_DESC);
    oprot.writeI64(this.snapshotTime);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
    oprot.writeI64(this.item_id);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(TOTAL_ORDER_COUNT_FIELD_DESC);
    oprot.writeI32(this.totalOrderCount);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(AMAZON_FBA_INVENTORY_FIELD_DESC);
    oprot.writeI64(this.amazonFbaInventory);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(IS_OUT_OF_STOCK_FIELD_DESC);
    oprot.writeBool(this.isOutOfStock);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(TOTAL_SALE_FIELD_DESC);
    oprot.writeDouble(this.totalSale);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(PROMOTION_SALE_FIELD_DESC);
    oprot.writeDouble(this.promotionSale);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(PROMOTION_ORDER_COUNT_FIELD_DESC);
    oprot.writeI32(this.promotionOrderCount);
    oprot.writeFieldEnd();
    if (this.fcLocation != null) {
      oprot.writeFieldBegin(FC_LOCATION_FIELD_DESC);
      oprot.writeI32(this.fcLocation.getValue());
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("snapshotTime:");
    sb.append(this.snapshotTime);
    first = false;
    if (!first) sb.append(", ");
    sb.append("item_id:");
    sb.append(this.item_id);
    first = false;
    if (!first) sb.append(", ");
    sb.append("totalOrderCount:");
    sb.append(this.totalOrderCount);
    first = false;
    if (!first) sb.append(", ");
    sb.append("amazonFbaInventory:");
    sb.append(this.amazonFbaInventory);
    first = false;
    if (!first) sb.append(", ");
    sb.append("isOutOfStock:");
    sb.append(this.isOutOfStock);
    first = false;
    if (!first) sb.append(", ");
    sb.append("totalSale:");
    sb.append(this.totalSale);
    first = false;
    if (!first) sb.append(", ");
    sb.append("promotionSale:");
    sb.append(this.promotionSale);
    first = false;
    if (!first) sb.append(", ");
    sb.append("promotionOrderCount:");
    sb.append(this.promotionOrderCount);
    first = false;
    if (!first) sb.append(", ");
    sb.append("fcLocation:");
    if (this.fcLocation == null) {
      sb.append("null");
    } else {
      sb.append(this.fcLocation);
    }
    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);
    }
  }

}