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

  private static final org.apache.thrift.protocol.TField PO_RAISED_FIELD_DESC = new org.apache.thrift.protocol.TField("poRaised", org.apache.thrift.protocol.TType.I32, (short)1);
  private static final org.apache.thrift.protocol.TField PO_ESTIMATE_FIELD_DESC = new org.apache.thrift.protocol.TField("poEstimate", org.apache.thrift.protocol.TType.I32, (short)2);
  private static final org.apache.thrift.protocol.TField REVERSAL_INITIATED_FIELD_DESC = new org.apache.thrift.protocol.TField("reversalInitiated", org.apache.thrift.protocol.TType.I32, (short)3);
  private static final org.apache.thrift.protocol.TField REVERSAL_ESTIMATE_FIELD_DESC = new org.apache.thrift.protocol.TField("reversalEstimate", org.apache.thrift.protocol.TType.I32, (short)4);

  private int poRaised; // required
  private int poEstimate; // required
  private int reversalInitiated; // required
  private int reversalEstimate; // 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 {
    PO_RAISED((short)1, "poRaised"),
    PO_ESTIMATE((short)2, "poEstimate"),
    REVERSAL_INITIATED((short)3, "reversalInitiated"),
    REVERSAL_ESTIMATE((short)4, "reversalEstimate");

    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: // PO_RAISED
          return PO_RAISED;
        case 2: // PO_ESTIMATE
          return PO_ESTIMATE;
        case 3: // REVERSAL_INITIATED
          return REVERSAL_INITIATED;
        case 4: // REVERSAL_ESTIMATE
          return REVERSAL_ESTIMATE;
        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 __PORAISED_ISSET_ID = 0;
  private static final int __POESTIMATE_ISSET_ID = 1;
  private static final int __REVERSALINITIATED_ISSET_ID = 2;
  private static final int __REVERSALESTIMATE_ISSET_ID = 3;
  private BitSet __isset_bit_vector = new BitSet(4);

  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.PO_RAISED, new org.apache.thrift.meta_data.FieldMetaData("poRaised", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.PO_ESTIMATE, new org.apache.thrift.meta_data.FieldMetaData("poEstimate", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.REVERSAL_INITIATED, new org.apache.thrift.meta_data.FieldMetaData("reversalInitiated", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.REVERSAL_ESTIMATE, new org.apache.thrift.meta_data.FieldMetaData("reversalEstimate", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TimeoutSummary.class, metaDataMap);
  }

  public TimeoutSummary() {
  }

  public TimeoutSummary(
    int poRaised,
    int poEstimate,
    int reversalInitiated,
    int reversalEstimate)
  {
    this();
    this.poRaised = poRaised;
    setPoRaisedIsSet(true);
    this.poEstimate = poEstimate;
    setPoEstimateIsSet(true);
    this.reversalInitiated = reversalInitiated;
    setReversalInitiatedIsSet(true);
    this.reversalEstimate = reversalEstimate;
    setReversalEstimateIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TimeoutSummary(TimeoutSummary other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.poRaised = other.poRaised;
    this.poEstimate = other.poEstimate;
    this.reversalInitiated = other.reversalInitiated;
    this.reversalEstimate = other.reversalEstimate;
  }

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

  @Override
  public void clear() {
    setPoRaisedIsSet(false);
    this.poRaised = 0;
    setPoEstimateIsSet(false);
    this.poEstimate = 0;
    setReversalInitiatedIsSet(false);
    this.reversalInitiated = 0;
    setReversalEstimateIsSet(false);
    this.reversalEstimate = 0;
  }

  public int getPoRaised() {
    return this.poRaised;
  }

  public void setPoRaised(int poRaised) {
    this.poRaised = poRaised;
    setPoRaisedIsSet(true);
  }

  public void unsetPoRaised() {
    __isset_bit_vector.clear(__PORAISED_ISSET_ID);
  }

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

  public void setPoRaisedIsSet(boolean value) {
    __isset_bit_vector.set(__PORAISED_ISSET_ID, value);
  }

  public int getPoEstimate() {
    return this.poEstimate;
  }

  public void setPoEstimate(int poEstimate) {
    this.poEstimate = poEstimate;
    setPoEstimateIsSet(true);
  }

  public void unsetPoEstimate() {
    __isset_bit_vector.clear(__POESTIMATE_ISSET_ID);
  }

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

  public void setPoEstimateIsSet(boolean value) {
    __isset_bit_vector.set(__POESTIMATE_ISSET_ID, value);
  }

  public int getReversalInitiated() {
    return this.reversalInitiated;
  }

  public void setReversalInitiated(int reversalInitiated) {
    this.reversalInitiated = reversalInitiated;
    setReversalInitiatedIsSet(true);
  }

  public void unsetReversalInitiated() {
    __isset_bit_vector.clear(__REVERSALINITIATED_ISSET_ID);
  }

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

  public void setReversalInitiatedIsSet(boolean value) {
    __isset_bit_vector.set(__REVERSALINITIATED_ISSET_ID, value);
  }

  public int getReversalEstimate() {
    return this.reversalEstimate;
  }

  public void setReversalEstimate(int reversalEstimate) {
    this.reversalEstimate = reversalEstimate;
    setReversalEstimateIsSet(true);
  }

  public void unsetReversalEstimate() {
    __isset_bit_vector.clear(__REVERSALESTIMATE_ISSET_ID);
  }

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

  public void setReversalEstimateIsSet(boolean value) {
    __isset_bit_vector.set(__REVERSALESTIMATE_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case PO_RAISED:
      if (value == null) {
        unsetPoRaised();
      } else {
        setPoRaised((Integer)value);
      }
      break;

    case PO_ESTIMATE:
      if (value == null) {
        unsetPoEstimate();
      } else {
        setPoEstimate((Integer)value);
      }
      break;

    case REVERSAL_INITIATED:
      if (value == null) {
        unsetReversalInitiated();
      } else {
        setReversalInitiated((Integer)value);
      }
      break;

    case REVERSAL_ESTIMATE:
      if (value == null) {
        unsetReversalEstimate();
      } else {
        setReversalEstimate((Integer)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case PO_RAISED:
      return Integer.valueOf(getPoRaised());

    case PO_ESTIMATE:
      return Integer.valueOf(getPoEstimate());

    case REVERSAL_INITIATED:
      return Integer.valueOf(getReversalInitiated());

    case REVERSAL_ESTIMATE:
      return Integer.valueOf(getReversalEstimate());

    }
    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 PO_RAISED:
      return isSetPoRaised();
    case PO_ESTIMATE:
      return isSetPoEstimate();
    case REVERSAL_INITIATED:
      return isSetReversalInitiated();
    case REVERSAL_ESTIMATE:
      return isSetReversalEstimate();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_poRaised = true;
    boolean that_present_poRaised = true;
    if (this_present_poRaised || that_present_poRaised) {
      if (!(this_present_poRaised && that_present_poRaised))
        return false;
      if (this.poRaised != that.poRaised)
        return false;
    }

    boolean this_present_poEstimate = true;
    boolean that_present_poEstimate = true;
    if (this_present_poEstimate || that_present_poEstimate) {
      if (!(this_present_poEstimate && that_present_poEstimate))
        return false;
      if (this.poEstimate != that.poEstimate)
        return false;
    }

    boolean this_present_reversalInitiated = true;
    boolean that_present_reversalInitiated = true;
    if (this_present_reversalInitiated || that_present_reversalInitiated) {
      if (!(this_present_reversalInitiated && that_present_reversalInitiated))
        return false;
      if (this.reversalInitiated != that.reversalInitiated)
        return false;
    }

    boolean this_present_reversalEstimate = true;
    boolean that_present_reversalEstimate = true;
    if (this_present_reversalEstimate || that_present_reversalEstimate) {
      if (!(this_present_reversalEstimate && that_present_reversalEstimate))
        return false;
      if (this.reversalEstimate != that.reversalEstimate)
        return false;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetPoRaised()).compareTo(typedOther.isSetPoRaised());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPoRaised()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.poRaised, typedOther.poRaised);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetPoEstimate()).compareTo(typedOther.isSetPoEstimate());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPoEstimate()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.poEstimate, typedOther.poEstimate);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetReversalInitiated()).compareTo(typedOther.isSetReversalInitiated());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetReversalInitiated()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.reversalInitiated, typedOther.reversalInitiated);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetReversalEstimate()).compareTo(typedOther.isSetReversalEstimate());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetReversalEstimate()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.reversalEstimate, typedOther.reversalEstimate);
      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: // PO_RAISED
          if (field.type == org.apache.thrift.protocol.TType.I32) {
            this.poRaised = iprot.readI32();
            setPoRaisedIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // PO_ESTIMATE
          if (field.type == org.apache.thrift.protocol.TType.I32) {
            this.poEstimate = iprot.readI32();
            setPoEstimateIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // REVERSAL_INITIATED
          if (field.type == org.apache.thrift.protocol.TType.I32) {
            this.reversalInitiated = iprot.readI32();
            setReversalInitiatedIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // REVERSAL_ESTIMATE
          if (field.type == org.apache.thrift.protocol.TType.I32) {
            this.reversalEstimate = iprot.readI32();
            setReversalEstimateIsSet(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(PO_RAISED_FIELD_DESC);
    oprot.writeI32(this.poRaised);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(PO_ESTIMATE_FIELD_DESC);
    oprot.writeI32(this.poEstimate);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(REVERSAL_INITIATED_FIELD_DESC);
    oprot.writeI32(this.reversalInitiated);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(REVERSAL_ESTIMATE_FIELD_DESC);
    oprot.writeI32(this.reversalEstimate);
    oprot.writeFieldEnd();
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("poRaised:");
    sb.append(this.poRaised);
    first = false;
    if (!first) sb.append(", ");
    sb.append("poEstimate:");
    sb.append(this.poEstimate);
    first = false;
    if (!first) sb.append(", ");
    sb.append("reversalInitiated:");
    sb.append(this.reversalInitiated);
    first = false;
    if (!first) sb.append(", ");
    sb.append("reversalEstimate:");
    sb.append(this.reversalEstimate);
    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);
    }
  }

}