Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

/**
 * Autogenerated by Thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 */
package in.shop2020.model.v1.user;

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.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.thrift.*;
import org.apache.thrift.meta_data.*;
import org.apache.thrift.protocol.*;

/**
 * Internal information to be used by system. various variables which aid in serving the user are identified and put here
 * *
 */
public class UserInternalInfo implements TBase<UserInternalInfo._Fields>, java.io.Serializable, Cloneable, Comparable<UserInternalInfo> {
  private static final TStruct STRUCT_DESC = new TStruct("UserInternalInfo");

  private static final TField USER_ID_FIELD_DESC = new TField("userId", TType.I64, (short)1);
  private static final TField GEO_ZONE_FIELD_DESC = new TField("geoZone", TType.I64, (short)2);
  private static final TField SHIPMENT_ZONE_FIELD_DESC = new TField("shipmentZone", TType.I64, (short)3);
  private static final TField TAX_ZONE_FIELD_DESC = new TField("taxZone", TType.I64, (short)4);
  private static final TField USER_RANK_SCORE_FIELD_DESC = new TField("userRankScore", TType.DOUBLE, (short)5);

  private long userId;
  private long geoZone;
  private long shipmentZone;
  private long taxZone;
  private double userRankScore;

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements TFieldIdEnum {
    USER_ID((short)1, "userId"),
    GEO_ZONE((short)2, "geoZone"),
    SHIPMENT_ZONE((short)3, "shipmentZone"),
    TAX_ZONE((short)4, "taxZone"),
    USER_RANK_SCORE((short)5, "userRankScore");

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

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

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      return byId.get(fieldId);
    }

    /**
     * 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 __USERID_ISSET_ID = 0;
  private static final int __GEOZONE_ISSET_ID = 1;
  private static final int __SHIPMENTZONE_ISSET_ID = 2;
  private static final int __TAXZONE_ISSET_ID = 3;
  private static final int __USERRANKSCORE_ISSET_ID = 4;
  private BitSet __isset_bit_vector = new BitSet(5);

  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
    put(_Fields.USER_ID, new FieldMetaData("userId", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.GEO_ZONE, new FieldMetaData("geoZone", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.SHIPMENT_ZONE, new FieldMetaData("shipmentZone", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.TAX_ZONE, new FieldMetaData("taxZone", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.USER_RANK_SCORE, new FieldMetaData("userRankScore", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.DOUBLE)));
  }});

  static {
    FieldMetaData.addStructMetaDataMap(UserInternalInfo.class, metaDataMap);
  }

  public UserInternalInfo() {
  }

  public UserInternalInfo(
    long userId,
    long geoZone,
    long shipmentZone,
    long taxZone,
    double userRankScore)
  {
    this();
    this.userId = userId;
    setUserIdIsSet(true);
    this.geoZone = geoZone;
    setGeoZoneIsSet(true);
    this.shipmentZone = shipmentZone;
    setShipmentZoneIsSet(true);
    this.taxZone = taxZone;
    setTaxZoneIsSet(true);
    this.userRankScore = userRankScore;
    setUserRankScoreIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public UserInternalInfo(UserInternalInfo other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.userId = other.userId;
    this.geoZone = other.geoZone;
    this.shipmentZone = other.shipmentZone;
    this.taxZone = other.taxZone;
    this.userRankScore = other.userRankScore;
  }

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

  @Deprecated
  public UserInternalInfo clone() {
    return new UserInternalInfo(this);
  }

  public long getUserId() {
    return this.userId;
  }

  public UserInternalInfo setUserId(long userId) {
    this.userId = userId;
    setUserIdIsSet(true);
    return this;
  }

  public void unsetUserId() {
    __isset_bit_vector.clear(__USERID_ISSET_ID);
  }

  /** Returns true if field userId is set (has been asigned a value) and false otherwise */
  public boolean isSetUserId() {
    return __isset_bit_vector.get(__USERID_ISSET_ID);
  }

  public void setUserIdIsSet(boolean value) {
    __isset_bit_vector.set(__USERID_ISSET_ID, value);
  }

  public long getGeoZone() {
    return this.geoZone;
  }

  public UserInternalInfo setGeoZone(long geoZone) {
    this.geoZone = geoZone;
    setGeoZoneIsSet(true);
    return this;
  }

  public void unsetGeoZone() {
    __isset_bit_vector.clear(__GEOZONE_ISSET_ID);
  }

  /** Returns true if field geoZone is set (has been asigned a value) and false otherwise */
  public boolean isSetGeoZone() {
    return __isset_bit_vector.get(__GEOZONE_ISSET_ID);
  }

  public void setGeoZoneIsSet(boolean value) {
    __isset_bit_vector.set(__GEOZONE_ISSET_ID, value);
  }

  public long getShipmentZone() {
    return this.shipmentZone;
  }

  public UserInternalInfo setShipmentZone(long shipmentZone) {
    this.shipmentZone = shipmentZone;
    setShipmentZoneIsSet(true);
    return this;
  }

  public void unsetShipmentZone() {
    __isset_bit_vector.clear(__SHIPMENTZONE_ISSET_ID);
  }

  /** Returns true if field shipmentZone is set (has been asigned a value) and false otherwise */
  public boolean isSetShipmentZone() {
    return __isset_bit_vector.get(__SHIPMENTZONE_ISSET_ID);
  }

  public void setShipmentZoneIsSet(boolean value) {
    __isset_bit_vector.set(__SHIPMENTZONE_ISSET_ID, value);
  }

  public long getTaxZone() {
    return this.taxZone;
  }

  public UserInternalInfo setTaxZone(long taxZone) {
    this.taxZone = taxZone;
    setTaxZoneIsSet(true);
    return this;
  }

  public void unsetTaxZone() {
    __isset_bit_vector.clear(__TAXZONE_ISSET_ID);
  }

  /** Returns true if field taxZone is set (has been asigned a value) and false otherwise */
  public boolean isSetTaxZone() {
    return __isset_bit_vector.get(__TAXZONE_ISSET_ID);
  }

  public void setTaxZoneIsSet(boolean value) {
    __isset_bit_vector.set(__TAXZONE_ISSET_ID, value);
  }

  public double getUserRankScore() {
    return this.userRankScore;
  }

  public UserInternalInfo setUserRankScore(double userRankScore) {
    this.userRankScore = userRankScore;
    setUserRankScoreIsSet(true);
    return this;
  }

  public void unsetUserRankScore() {
    __isset_bit_vector.clear(__USERRANKSCORE_ISSET_ID);
  }

  /** Returns true if field userRankScore is set (has been asigned a value) and false otherwise */
  public boolean isSetUserRankScore() {
    return __isset_bit_vector.get(__USERRANKSCORE_ISSET_ID);
  }

  public void setUserRankScoreIsSet(boolean value) {
    __isset_bit_vector.set(__USERRANKSCORE_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case USER_ID:
      if (value == null) {
        unsetUserId();
      } else {
        setUserId((Long)value);
      }
      break;

    case GEO_ZONE:
      if (value == null) {
        unsetGeoZone();
      } else {
        setGeoZone((Long)value);
      }
      break;

    case SHIPMENT_ZONE:
      if (value == null) {
        unsetShipmentZone();
      } else {
        setShipmentZone((Long)value);
      }
      break;

    case TAX_ZONE:
      if (value == null) {
        unsetTaxZone();
      } else {
        setTaxZone((Long)value);
      }
      break;

    case USER_RANK_SCORE:
      if (value == null) {
        unsetUserRankScore();
      } else {
        setUserRankScore((Double)value);
      }
      break;

    }
  }

  public void setFieldValue(int fieldID, Object value) {
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case USER_ID:
      return new Long(getUserId());

    case GEO_ZONE:
      return new Long(getGeoZone());

    case SHIPMENT_ZONE:
      return new Long(getShipmentZone());

    case TAX_ZONE:
      return new Long(getTaxZone());

    case USER_RANK_SCORE:
      return new Double(getUserRankScore());

    }
    throw new IllegalStateException();
  }

  public Object getFieldValue(int fieldId) {
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
  }

  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    switch (field) {
    case USER_ID:
      return isSetUserId();
    case GEO_ZONE:
      return isSetGeoZone();
    case SHIPMENT_ZONE:
      return isSetShipmentZone();
    case TAX_ZONE:
      return isSetTaxZone();
    case USER_RANK_SCORE:
      return isSetUserRankScore();
    }
    throw new IllegalStateException();
  }

  public boolean isSet(int fieldID) {
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
  }

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

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

    boolean this_present_userId = true;
    boolean that_present_userId = true;
    if (this_present_userId || that_present_userId) {
      if (!(this_present_userId && that_present_userId))
        return false;
      if (this.userId != that.userId)
        return false;
    }

    boolean this_present_geoZone = true;
    boolean that_present_geoZone = true;
    if (this_present_geoZone || that_present_geoZone) {
      if (!(this_present_geoZone && that_present_geoZone))
        return false;
      if (this.geoZone != that.geoZone)
        return false;
    }

    boolean this_present_shipmentZone = true;
    boolean that_present_shipmentZone = true;
    if (this_present_shipmentZone || that_present_shipmentZone) {
      if (!(this_present_shipmentZone && that_present_shipmentZone))
        return false;
      if (this.shipmentZone != that.shipmentZone)
        return false;
    }

    boolean this_present_taxZone = true;
    boolean that_present_taxZone = true;
    if (this_present_taxZone || that_present_taxZone) {
      if (!(this_present_taxZone && that_present_taxZone))
        return false;
      if (this.taxZone != that.taxZone)
        return false;
    }

    boolean this_present_userRankScore = true;
    boolean that_present_userRankScore = true;
    if (this_present_userRankScore || that_present_userRankScore) {
      if (!(this_present_userRankScore && that_present_userRankScore))
        return false;
      if (this.userRankScore != that.userRankScore)
        return false;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetUserId()).compareTo(isSetUserId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(userId, typedOther.userId);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetGeoZone()).compareTo(isSetGeoZone());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(geoZone, typedOther.geoZone);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetShipmentZone()).compareTo(isSetShipmentZone());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(shipmentZone, typedOther.shipmentZone);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetTaxZone()).compareTo(isSetTaxZone());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(taxZone, typedOther.taxZone);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetUserRankScore()).compareTo(isSetUserRankScore());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(userRankScore, typedOther.userRankScore);
    if (lastComparison != 0) {
      return lastComparison;
    }
    return 0;
  }

  public void read(TProtocol iprot) throws TException {
    TField field;
    iprot.readStructBegin();
    while (true)
    {
      field = iprot.readFieldBegin();
      if (field.type == TType.STOP) { 
        break;
      }
      _Fields fieldId = _Fields.findByThriftId(field.id);
      if (fieldId == null) {
        TProtocolUtil.skip(iprot, field.type);
      } else {
        switch (fieldId) {
          case USER_ID:
            if (field.type == TType.I64) {
              this.userId = iprot.readI64();
              setUserIdIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case GEO_ZONE:
            if (field.type == TType.I64) {
              this.geoZone = iprot.readI64();
              setGeoZoneIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case SHIPMENT_ZONE:
            if (field.type == TType.I64) {
              this.shipmentZone = iprot.readI64();
              setShipmentZoneIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case TAX_ZONE:
            if (field.type == TType.I64) {
              this.taxZone = iprot.readI64();
              setTaxZoneIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case USER_RANK_SCORE:
            if (field.type == TType.DOUBLE) {
              this.userRankScore = iprot.readDouble();
              setUserRankScoreIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
        }
        iprot.readFieldEnd();
      }
    }
    iprot.readStructEnd();
    validate();
  }

  public void write(TProtocol oprot) throws TException {
    validate();

    oprot.writeStructBegin(STRUCT_DESC);
    oprot.writeFieldBegin(USER_ID_FIELD_DESC);
    oprot.writeI64(this.userId);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(GEO_ZONE_FIELD_DESC);
    oprot.writeI64(this.geoZone);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(SHIPMENT_ZONE_FIELD_DESC);
    oprot.writeI64(this.shipmentZone);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(TAX_ZONE_FIELD_DESC);
    oprot.writeI64(this.taxZone);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(USER_RANK_SCORE_FIELD_DESC);
    oprot.writeDouble(this.userRankScore);
    oprot.writeFieldEnd();
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("userId:");
    sb.append(this.userId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("geoZone:");
    sb.append(this.geoZone);
    first = false;
    if (!first) sb.append(", ");
    sb.append("shipmentZone:");
    sb.append(this.shipmentZone);
    first = false;
    if (!first) sb.append(", ");
    sb.append("taxZone:");
    sb.append(this.taxZone);
    first = false;
    if (!first) sb.append(", ");
    sb.append("userRankScore:");
    sb.append(this.userRankScore);
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws TException {
    // check for required fields
  }

}