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.logistics;

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

  private static final org.apache.thrift.protocol.TField LOCATION_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("locationId", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField SAME_STATE_FIELD_DESC = new org.apache.thrift.protocol.TField("sameState", org.apache.thrift.protocol.TType.BOOL, (short)2);
  private static final org.apache.thrift.protocol.TField IS_COD_FIELD_DESC = new org.apache.thrift.protocol.TField("isCod", org.apache.thrift.protocol.TType.BOOL, (short)3);
  private static final org.apache.thrift.protocol.TField IS_OTG_FIELD_DESC = new org.apache.thrift.protocol.TField("isOtg", org.apache.thrift.protocol.TType.BOOL, (short)4);
  private static final org.apache.thrift.protocol.TField MIN_DELAY_FIELD_DESC = new org.apache.thrift.protocol.TField("minDelay", org.apache.thrift.protocol.TType.I64, (short)5);
  private static final org.apache.thrift.protocol.TField MAX_DELAY_FIELD_DESC = new org.apache.thrift.protocol.TField("maxDelay", org.apache.thrift.protocol.TType.I64, (short)6);

  private long locationId; // required
  private boolean sameState; // required
  private boolean isCod; // required
  private boolean isOtg; // required
  private long minDelay; // required
  private long maxDelay; // 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 {
    LOCATION_ID((short)1, "locationId"),
    SAME_STATE((short)2, "sameState"),
    IS_COD((short)3, "isCod"),
    IS_OTG((short)4, "isOtg"),
    MIN_DELAY((short)5, "minDelay"),
    MAX_DELAY((short)6, "maxDelay");

    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: // LOCATION_ID
          return LOCATION_ID;
        case 2: // SAME_STATE
          return SAME_STATE;
        case 3: // IS_COD
          return IS_COD;
        case 4: // IS_OTG
          return IS_OTG;
        case 5: // MIN_DELAY
          return MIN_DELAY;
        case 6: // MAX_DELAY
          return MAX_DELAY;
        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 __LOCATIONID_ISSET_ID = 0;
  private static final int __SAMESTATE_ISSET_ID = 1;
  private static final int __ISCOD_ISSET_ID = 2;
  private static final int __ISOTG_ISSET_ID = 3;
  private static final int __MINDELAY_ISSET_ID = 4;
  private static final int __MAXDELAY_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.LOCATION_ID, new org.apache.thrift.meta_data.FieldMetaData("locationId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.SAME_STATE, new org.apache.thrift.meta_data.FieldMetaData("sameState", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.IS_COD, new org.apache.thrift.meta_data.FieldMetaData("isCod", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.IS_OTG, new org.apache.thrift.meta_data.FieldMetaData("isOtg", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.MIN_DELAY, new org.apache.thrift.meta_data.FieldMetaData("minDelay", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.MAX_DELAY, new org.apache.thrift.meta_data.FieldMetaData("maxDelay", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(LocationInfo.class, metaDataMap);
  }

  public LocationInfo() {
  }

  public LocationInfo(
    long locationId,
    boolean sameState,
    boolean isCod,
    boolean isOtg,
    long minDelay,
    long maxDelay)
  {
    this();
    this.locationId = locationId;
    setLocationIdIsSet(true);
    this.sameState = sameState;
    setSameStateIsSet(true);
    this.isCod = isCod;
    setIsCodIsSet(true);
    this.isOtg = isOtg;
    setIsOtgIsSet(true);
    this.minDelay = minDelay;
    setMinDelayIsSet(true);
    this.maxDelay = maxDelay;
    setMaxDelayIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public LocationInfo(LocationInfo other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.locationId = other.locationId;
    this.sameState = other.sameState;
    this.isCod = other.isCod;
    this.isOtg = other.isOtg;
    this.minDelay = other.minDelay;
    this.maxDelay = other.maxDelay;
  }

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

  @Override
  public void clear() {
    setLocationIdIsSet(false);
    this.locationId = 0;
    setSameStateIsSet(false);
    this.sameState = false;
    setIsCodIsSet(false);
    this.isCod = false;
    setIsOtgIsSet(false);
    this.isOtg = false;
    setMinDelayIsSet(false);
    this.minDelay = 0;
    setMaxDelayIsSet(false);
    this.maxDelay = 0;
  }

  public long getLocationId() {
    return this.locationId;
  }

  public void setLocationId(long locationId) {
    this.locationId = locationId;
    setLocationIdIsSet(true);
  }

  public void unsetLocationId() {
    __isset_bit_vector.clear(__LOCATIONID_ISSET_ID);
  }

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

  public void setLocationIdIsSet(boolean value) {
    __isset_bit_vector.set(__LOCATIONID_ISSET_ID, value);
  }

  public boolean isSameState() {
    return this.sameState;
  }

  public void setSameState(boolean sameState) {
    this.sameState = sameState;
    setSameStateIsSet(true);
  }

  public void unsetSameState() {
    __isset_bit_vector.clear(__SAMESTATE_ISSET_ID);
  }

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

  public void setSameStateIsSet(boolean value) {
    __isset_bit_vector.set(__SAMESTATE_ISSET_ID, value);
  }

  public boolean isIsCod() {
    return this.isCod;
  }

  public void setIsCod(boolean isCod) {
    this.isCod = isCod;
    setIsCodIsSet(true);
  }

  public void unsetIsCod() {
    __isset_bit_vector.clear(__ISCOD_ISSET_ID);
  }

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

  public void setIsCodIsSet(boolean value) {
    __isset_bit_vector.set(__ISCOD_ISSET_ID, value);
  }

  public boolean isIsOtg() {
    return this.isOtg;
  }

  public void setIsOtg(boolean isOtg) {
    this.isOtg = isOtg;
    setIsOtgIsSet(true);
  }

  public void unsetIsOtg() {
    __isset_bit_vector.clear(__ISOTG_ISSET_ID);
  }

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

  public void setIsOtgIsSet(boolean value) {
    __isset_bit_vector.set(__ISOTG_ISSET_ID, value);
  }

  public long getMinDelay() {
    return this.minDelay;
  }

  public void setMinDelay(long minDelay) {
    this.minDelay = minDelay;
    setMinDelayIsSet(true);
  }

  public void unsetMinDelay() {
    __isset_bit_vector.clear(__MINDELAY_ISSET_ID);
  }

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

  public void setMinDelayIsSet(boolean value) {
    __isset_bit_vector.set(__MINDELAY_ISSET_ID, value);
  }

  public long getMaxDelay() {
    return this.maxDelay;
  }

  public void setMaxDelay(long maxDelay) {
    this.maxDelay = maxDelay;
    setMaxDelayIsSet(true);
  }

  public void unsetMaxDelay() {
    __isset_bit_vector.clear(__MAXDELAY_ISSET_ID);
  }

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

  public void setMaxDelayIsSet(boolean value) {
    __isset_bit_vector.set(__MAXDELAY_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case LOCATION_ID:
      if (value == null) {
        unsetLocationId();
      } else {
        setLocationId((Long)value);
      }
      break;

    case SAME_STATE:
      if (value == null) {
        unsetSameState();
      } else {
        setSameState((Boolean)value);
      }
      break;

    case IS_COD:
      if (value == null) {
        unsetIsCod();
      } else {
        setIsCod((Boolean)value);
      }
      break;

    case IS_OTG:
      if (value == null) {
        unsetIsOtg();
      } else {
        setIsOtg((Boolean)value);
      }
      break;

    case MIN_DELAY:
      if (value == null) {
        unsetMinDelay();
      } else {
        setMinDelay((Long)value);
      }
      break;

    case MAX_DELAY:
      if (value == null) {
        unsetMaxDelay();
      } else {
        setMaxDelay((Long)value);
      }
      break;

    }
  }

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

    case SAME_STATE:
      return Boolean.valueOf(isSameState());

    case IS_COD:
      return Boolean.valueOf(isIsCod());

    case IS_OTG:
      return Boolean.valueOf(isIsOtg());

    case MIN_DELAY:
      return Long.valueOf(getMinDelay());

    case MAX_DELAY:
      return Long.valueOf(getMaxDelay());

    }
    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 LOCATION_ID:
      return isSetLocationId();
    case SAME_STATE:
      return isSetSameState();
    case IS_COD:
      return isSetIsCod();
    case IS_OTG:
      return isSetIsOtg();
    case MIN_DELAY:
      return isSetMinDelay();
    case MAX_DELAY:
      return isSetMaxDelay();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_locationId = true;
    boolean that_present_locationId = true;
    if (this_present_locationId || that_present_locationId) {
      if (!(this_present_locationId && that_present_locationId))
        return false;
      if (this.locationId != that.locationId)
        return false;
    }

    boolean this_present_sameState = true;
    boolean that_present_sameState = true;
    if (this_present_sameState || that_present_sameState) {
      if (!(this_present_sameState && that_present_sameState))
        return false;
      if (this.sameState != that.sameState)
        return false;
    }

    boolean this_present_isCod = true;
    boolean that_present_isCod = true;
    if (this_present_isCod || that_present_isCod) {
      if (!(this_present_isCod && that_present_isCod))
        return false;
      if (this.isCod != that.isCod)
        return false;
    }

    boolean this_present_isOtg = true;
    boolean that_present_isOtg = true;
    if (this_present_isOtg || that_present_isOtg) {
      if (!(this_present_isOtg && that_present_isOtg))
        return false;
      if (this.isOtg != that.isOtg)
        return false;
    }

    boolean this_present_minDelay = true;
    boolean that_present_minDelay = true;
    if (this_present_minDelay || that_present_minDelay) {
      if (!(this_present_minDelay && that_present_minDelay))
        return false;
      if (this.minDelay != that.minDelay)
        return false;
    }

    boolean this_present_maxDelay = true;
    boolean that_present_maxDelay = true;
    if (this_present_maxDelay || that_present_maxDelay) {
      if (!(this_present_maxDelay && that_present_maxDelay))
        return false;
      if (this.maxDelay != that.maxDelay)
        return false;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetLocationId()).compareTo(typedOther.isSetLocationId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetLocationId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.locationId, typedOther.locationId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetSameState()).compareTo(typedOther.isSetSameState());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSameState()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sameState, typedOther.sameState);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetIsCod()).compareTo(typedOther.isSetIsCod());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIsCod()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isCod, typedOther.isCod);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetIsOtg()).compareTo(typedOther.isSetIsOtg());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIsOtg()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isOtg, typedOther.isOtg);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetMinDelay()).compareTo(typedOther.isSetMinDelay());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMinDelay()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.minDelay, typedOther.minDelay);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetMaxDelay()).compareTo(typedOther.isSetMaxDelay());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMaxDelay()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.maxDelay, typedOther.maxDelay);
      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: // LOCATION_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.locationId = iprot.readI64();
            setLocationIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // SAME_STATE
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
            this.sameState = iprot.readBool();
            setSameStateIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // IS_COD
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
            this.isCod = iprot.readBool();
            setIsCodIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // IS_OTG
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
            this.isOtg = iprot.readBool();
            setIsOtgIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 5: // MIN_DELAY
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.minDelay = iprot.readI64();
            setMinDelayIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 6: // MAX_DELAY
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.maxDelay = iprot.readI64();
            setMaxDelayIsSet(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(LOCATION_ID_FIELD_DESC);
    oprot.writeI64(this.locationId);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(SAME_STATE_FIELD_DESC);
    oprot.writeBool(this.sameState);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(IS_COD_FIELD_DESC);
    oprot.writeBool(this.isCod);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(IS_OTG_FIELD_DESC);
    oprot.writeBool(this.isOtg);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(MIN_DELAY_FIELD_DESC);
    oprot.writeI64(this.minDelay);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(MAX_DELAY_FIELD_DESC);
    oprot.writeI64(this.maxDelay);
    oprot.writeFieldEnd();
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("locationId:");
    sb.append(this.locationId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("sameState:");
    sb.append(this.sameState);
    first = false;
    if (!first) sb.append(", ");
    sb.append("isCod:");
    sb.append(this.isCod);
    first = false;
    if (!first) sb.append(", ");
    sb.append("isOtg:");
    sb.append(this.isOtg);
    first = false;
    if (!first) sb.append(", ");
    sb.append("minDelay:");
    sb.append(this.minDelay);
    first = false;
    if (!first) sb.append(", ");
    sb.append("maxDelay:");
    sb.append(this.maxDelay);
    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);
    }
  }

}