URingPaxos-master/clients/dMap/src/java/ch/usi/da/dmap/thrift/gen/RangeCommand.java
/**
 * Autogenerated by Thrift Compiler (0.14.1)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package ch.usi.da.dmap.thrift.gen;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.14.1)", date = "2021-04-23")
public class RangeCommand implements org.apache.thrift.TBase<RangeCommand, RangeCommand._Fields>, java.io.Serializable, Cloneable, Comparable<RangeCommand> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RangeCommand");

  private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("type", org.apache.thrift.protocol.TType.I32, (short)2);
  private static final org.apache.thrift.protocol.TField FROMKEY_FIELD_DESC = new org.apache.thrift.protocol.TField("fromkey", org.apache.thrift.protocol.TType.STRING, (short)3);
  private static final org.apache.thrift.protocol.TField TOKEY_FIELD_DESC = new org.apache.thrift.protocol.TField("tokey", org.apache.thrift.protocol.TType.STRING, (short)4);
  private static final org.apache.thrift.protocol.TField FROMID_FIELD_DESC = new org.apache.thrift.protocol.TField("fromid", org.apache.thrift.protocol.TType.I32, (short)5);
  private static final org.apache.thrift.protocol.TField TOID_FIELD_DESC = new org.apache.thrift.protocol.TField("toid", org.apache.thrift.protocol.TType.I32, (short)6);
  private static final org.apache.thrift.protocol.TField SNAPSHOT_FIELD_DESC = new org.apache.thrift.protocol.TField("snapshot", org.apache.thrift.protocol.TType.I64, (short)7);
  private static final org.apache.thrift.protocol.TField PARTITION_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("partition_version", org.apache.thrift.protocol.TType.I64, (short)8);
  private static final org.apache.thrift.protocol.TField MAP_NUMBER_FIELD_DESC = new org.apache.thrift.protocol.TField("map_number", org.apache.thrift.protocol.TType.I32, (short)9);

  private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new RangeCommandStandardSchemeFactory();
  private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new RangeCommandTupleSchemeFactory();

  public long id; // required
  /**
   * 
   * @see RangeType
   */
  public @org.apache.thrift.annotation.Nullable RangeType type; // required
  public @org.apache.thrift.annotation.Nullable java.nio.ByteBuffer fromkey; // optional
  public @org.apache.thrift.annotation.Nullable java.nio.ByteBuffer tokey; // optional
  public int fromid; // optional
  public int toid; // optional
  public long snapshot; // optional
  public long partition_version; // required
  public int map_number; // optional

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    ID((short)1, "id"),
    /**
     * 
     * @see RangeType
     */
    TYPE((short)2, "type"),
    FROMKEY((short)3, "fromkey"),
    TOKEY((short)4, "tokey"),
    FROMID((short)5, "fromid"),
    TOID((short)6, "toid"),
    SNAPSHOT((short)7, "snapshot"),
    PARTITION_VERSION((short)8, "partition_version"),
    MAP_NUMBER((short)9, "map_number");

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

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

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // ID
          return ID;
        case 2: // TYPE
          return TYPE;
        case 3: // FROMKEY
          return FROMKEY;
        case 4: // TOKEY
          return TOKEY;
        case 5: // FROMID
          return FROMID;
        case 6: // TOID
          return TOID;
        case 7: // SNAPSHOT
          return SNAPSHOT;
        case 8: // PARTITION_VERSION
          return PARTITION_VERSION;
        case 9: // MAP_NUMBER
          return MAP_NUMBER;
        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 java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByName(java.lang.String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final java.lang.String _fieldName;

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

    public short getThriftFieldId() {
      return _thriftId;
    }

    public java.lang.String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final int __ID_ISSET_ID = 0;
  private static final int __FROMID_ISSET_ID = 1;
  private static final int __TOID_ISSET_ID = 2;
  private static final int __SNAPSHOT_ISSET_ID = 3;
  private static final int __PARTITION_VERSION_ISSET_ID = 4;
  private static final int __MAP_NUMBER_ISSET_ID = 5;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.FROMKEY,_Fields.TOKEY,_Fields.FROMID,_Fields.TOID,_Fields.SNAPSHOT,_Fields.MAP_NUMBER};
  public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.TYPE, new org.apache.thrift.meta_data.FieldMetaData("type", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, RangeType.class)));
    tmpMap.put(_Fields.FROMKEY, new org.apache.thrift.meta_data.FieldMetaData("fromkey", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , true)));
    tmpMap.put(_Fields.TOKEY, new org.apache.thrift.meta_data.FieldMetaData("tokey", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , true)));
    tmpMap.put(_Fields.FROMID, new org.apache.thrift.meta_data.FieldMetaData("fromid", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.TOID, new org.apache.thrift.meta_data.FieldMetaData("toid", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.SNAPSHOT, new org.apache.thrift.meta_data.FieldMetaData("snapshot", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.PARTITION_VERSION, new org.apache.thrift.meta_data.FieldMetaData("partition_version", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.MAP_NUMBER, new org.apache.thrift.meta_data.FieldMetaData("map_number", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(RangeCommand.class, metaDataMap);
  }

  public RangeCommand() {
  }

  public RangeCommand(
    long id,
    RangeType type,
    long partition_version)
  {
    this();
    this.id = id;
    setIdIsSet(true);
    this.type = type;
    this.partition_version = partition_version;
    setPartition_versionIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public RangeCommand(RangeCommand other) {
    __isset_bitfield = other.__isset_bitfield;
    this.id = other.id;
    if (other.isSetType()) {
      this.type = other.type;
    }
    if (other.isSetFromkey()) {
      this.fromkey = org.apache.thrift.TBaseHelper.copyBinary(other.fromkey);
    }
    if (other.isSetTokey()) {
      this.tokey = org.apache.thrift.TBaseHelper.copyBinary(other.tokey);
    }
    this.fromid = other.fromid;
    this.toid = other.toid;
    this.snapshot = other.snapshot;
    this.partition_version = other.partition_version;
    this.map_number = other.map_number;
  }

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

  @Override
  public void clear() {
    setIdIsSet(false);
    this.id = 0;
    this.type = null;
    this.fromkey = null;
    this.tokey = null;
    setFromidIsSet(false);
    this.fromid = 0;
    setToidIsSet(false);
    this.toid = 0;
    setSnapshotIsSet(false);
    this.snapshot = 0;
    setPartition_versionIsSet(false);
    this.partition_version = 0;
    setMap_numberIsSet(false);
    this.map_number = 0;
  }

  public long getId() {
    return this.id;
  }

  public RangeCommand setId(long id) {
    this.id = id;
    setIdIsSet(true);
    return this;
  }

  public void unsetId() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __ID_ISSET_ID);
  }

  /** Returns true if field id is set (has been assigned a value) and false otherwise */
  public boolean isSetId() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __ID_ISSET_ID);
  }

  public void setIdIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __ID_ISSET_ID, value);
  }

  /**
   * 
   * @see RangeType
   */
  @org.apache.thrift.annotation.Nullable
  public RangeType getType() {
    return this.type;
  }

  /**
   * 
   * @see RangeType
   */
  public RangeCommand setType(@org.apache.thrift.annotation.Nullable RangeType type) {
    this.type = type;
    return this;
  }

  public void unsetType() {
    this.type = null;
  }

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

  public void setTypeIsSet(boolean value) {
    if (!value) {
      this.type = null;
    }
  }

  public byte[] getFromkey() {
    setFromkey(org.apache.thrift.TBaseHelper.rightSize(fromkey));
    return fromkey == null ? null : fromkey.array();
  }

  public java.nio.ByteBuffer bufferForFromkey() {
    return org.apache.thrift.TBaseHelper.copyBinary(fromkey);
  }

  public RangeCommand setFromkey(byte[] fromkey) {
    this.fromkey = fromkey == null ? (java.nio.ByteBuffer)null   : java.nio.ByteBuffer.wrap(fromkey.clone());
    return this;
  }

  public RangeCommand setFromkey(@org.apache.thrift.annotation.Nullable java.nio.ByteBuffer fromkey) {
    this.fromkey = org.apache.thrift.TBaseHelper.copyBinary(fromkey);
    return this;
  }

  public void unsetFromkey() {
    this.fromkey = null;
  }

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

  public void setFromkeyIsSet(boolean value) {
    if (!value) {
      this.fromkey = null;
    }
  }

  public byte[] getTokey() {
    setTokey(org.apache.thrift.TBaseHelper.rightSize(tokey));
    return tokey == null ? null : tokey.array();
  }

  public java.nio.ByteBuffer bufferForTokey() {
    return org.apache.thrift.TBaseHelper.copyBinary(tokey);
  }

  public RangeCommand setTokey(byte[] tokey) {
    this.tokey = tokey == null ? (java.nio.ByteBuffer)null   : java.nio.ByteBuffer.wrap(tokey.clone());
    return this;
  }

  public RangeCommand setTokey(@org.apache.thrift.annotation.Nullable java.nio.ByteBuffer tokey) {
    this.tokey = org.apache.thrift.TBaseHelper.copyBinary(tokey);
    return this;
  }

  public void unsetTokey() {
    this.tokey = null;
  }

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

  public void setTokeyIsSet(boolean value) {
    if (!value) {
      this.tokey = null;
    }
  }

  public int getFromid() {
    return this.fromid;
  }

  public RangeCommand setFromid(int fromid) {
    this.fromid = fromid;
    setFromidIsSet(true);
    return this;
  }

  public void unsetFromid() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __FROMID_ISSET_ID);
  }

  /** Returns true if field fromid is set (has been assigned a value) and false otherwise */
  public boolean isSetFromid() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __FROMID_ISSET_ID);
  }

  public void setFromidIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __FROMID_ISSET_ID, value);
  }

  public int getToid() {
    return this.toid;
  }

  public RangeCommand setToid(int toid) {
    this.toid = toid;
    setToidIsSet(true);
    return this;
  }

  public void unsetToid() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __TOID_ISSET_ID);
  }

  /** Returns true if field toid is set (has been assigned a value) and false otherwise */
  public boolean isSetToid() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __TOID_ISSET_ID);
  }

  public void setToidIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __TOID_ISSET_ID, value);
  }

  public long getSnapshot() {
    return this.snapshot;
  }

  public RangeCommand setSnapshot(long snapshot) {
    this.snapshot = snapshot;
    setSnapshotIsSet(true);
    return this;
  }

  public void unsetSnapshot() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __SNAPSHOT_ISSET_ID);
  }

  /** Returns true if field snapshot is set (has been assigned a value) and false otherwise */
  public boolean isSetSnapshot() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __SNAPSHOT_ISSET_ID);
  }

  public void setSnapshotIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __SNAPSHOT_ISSET_ID, value);
  }

  public long getPartition_version() {
    return this.partition_version;
  }

  public RangeCommand setPartition_version(long partition_version) {
    this.partition_version = partition_version;
    setPartition_versionIsSet(true);
    return this;
  }

  public void unsetPartition_version() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __PARTITION_VERSION_ISSET_ID);
  }

  /** Returns true if field partition_version is set (has been assigned a value) and false otherwise */
  public boolean isSetPartition_version() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __PARTITION_VERSION_ISSET_ID);
  }

  public void setPartition_versionIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __PARTITION_VERSION_ISSET_ID, value);
  }

  public int getMap_number() {
    return this.map_number;
  }

  public RangeCommand setMap_number(int map_number) {
    this.map_number = map_number;
    setMap_numberIsSet(true);
    return this;
  }

  public void unsetMap_number() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __MAP_NUMBER_ISSET_ID);
  }

  /** Returns true if field map_number is set (has been assigned a value) and false otherwise */
  public boolean isSetMap_number() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __MAP_NUMBER_ISSET_ID);
  }

  public void setMap_numberIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __MAP_NUMBER_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case ID:
      if (value == null) {
        unsetId();
      } else {
        setId((java.lang.Long)value);
      }
      break;

    case TYPE:
      if (value == null) {
        unsetType();
      } else {
        setType((RangeType)value);
      }
      break;

    case FROMKEY:
      if (value == null) {
        unsetFromkey();
      } else {
        if (value instanceof byte[]) {
          setFromkey((byte[])value);
        } else {
          setFromkey((java.nio.ByteBuffer)value);
        }
      }
      break;

    case TOKEY:
      if (value == null) {
        unsetTokey();
      } else {
        if (value instanceof byte[]) {
          setTokey((byte[])value);
        } else {
          setTokey((java.nio.ByteBuffer)value);
        }
      }
      break;

    case FROMID:
      if (value == null) {
        unsetFromid();
      } else {
        setFromid((java.lang.Integer)value);
      }
      break;

    case TOID:
      if (value == null) {
        unsetToid();
      } else {
        setToid((java.lang.Integer)value);
      }
      break;

    case SNAPSHOT:
      if (value == null) {
        unsetSnapshot();
      } else {
        setSnapshot((java.lang.Long)value);
      }
      break;

    case PARTITION_VERSION:
      if (value == null) {
        unsetPartition_version();
      } else {
        setPartition_version((java.lang.Long)value);
      }
      break;

    case MAP_NUMBER:
      if (value == null) {
        unsetMap_number();
      } else {
        setMap_number((java.lang.Integer)value);
      }
      break;

    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.Object getFieldValue(_Fields field) {
    switch (field) {
    case ID:
      return getId();

    case TYPE:
      return getType();

    case FROMKEY:
      return getFromkey();

    case TOKEY:
      return getTokey();

    case FROMID:
      return getFromid();

    case TOID:
      return getToid();

    case SNAPSHOT:
      return getSnapshot();

    case PARTITION_VERSION:
      return getPartition_version();

    case MAP_NUMBER:
      return getMap_number();

    }
    throw new java.lang.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 java.lang.IllegalArgumentException();
    }

    switch (field) {
    case ID:
      return isSetId();
    case TYPE:
      return isSetType();
    case FROMKEY:
      return isSetFromkey();
    case TOKEY:
      return isSetTokey();
    case FROMID:
      return isSetFromid();
    case TOID:
      return isSetToid();
    case SNAPSHOT:
      return isSetSnapshot();
    case PARTITION_VERSION:
      return isSetPartition_version();
    case MAP_NUMBER:
      return isSetMap_number();
    }
    throw new java.lang.IllegalStateException();
  }

  @Override
  public boolean equals(java.lang.Object that) {
    if (that instanceof RangeCommand)
      return this.equals((RangeCommand)that);
    return false;
  }

  public boolean equals(RangeCommand that) {
    if (that == null)
      return false;
    if (this == that)
      return true;

    boolean this_present_id = true;
    boolean that_present_id = true;
    if (this_present_id || that_present_id) {
      if (!(this_present_id && that_present_id))
        return false;
      if (this.id != that.id)
        return false;
    }

    boolean this_present_type = true && this.isSetType();
    boolean that_present_type = true && that.isSetType();
    if (this_present_type || that_present_type) {
      if (!(this_present_type && that_present_type))
        return false;
      if (!this.type.equals(that.type))
        return false;
    }

    boolean this_present_fromkey = true && this.isSetFromkey();
    boolean that_present_fromkey = true && that.isSetFromkey();
    if (this_present_fromkey || that_present_fromkey) {
      if (!(this_present_fromkey && that_present_fromkey))
        return false;
      if (!this.fromkey.equals(that.fromkey))
        return false;
    }

    boolean this_present_tokey = true && this.isSetTokey();
    boolean that_present_tokey = true && that.isSetTokey();
    if (this_present_tokey || that_present_tokey) {
      if (!(this_present_tokey && that_present_tokey))
        return false;
      if (!this.tokey.equals(that.tokey))
        return false;
    }

    boolean this_present_fromid = true && this.isSetFromid();
    boolean that_present_fromid = true && that.isSetFromid();
    if (this_present_fromid || that_present_fromid) {
      if (!(this_present_fromid && that_present_fromid))
        return false;
      if (this.fromid != that.fromid)
        return false;
    }

    boolean this_present_toid = true && this.isSetToid();
    boolean that_present_toid = true && that.isSetToid();
    if (this_present_toid || that_present_toid) {
      if (!(this_present_toid && that_present_toid))
        return false;
      if (this.toid != that.toid)
        return false;
    }

    boolean this_present_snapshot = true && this.isSetSnapshot();
    boolean that_present_snapshot = true && that.isSetSnapshot();
    if (this_present_snapshot || that_present_snapshot) {
      if (!(this_present_snapshot && that_present_snapshot))
        return false;
      if (this.snapshot != that.snapshot)
        return false;
    }

    boolean this_present_partition_version = true;
    boolean that_present_partition_version = true;
    if (this_present_partition_version || that_present_partition_version) {
      if (!(this_present_partition_version && that_present_partition_version))
        return false;
      if (this.partition_version != that.partition_version)
        return false;
    }

    boolean this_present_map_number = true && this.isSetMap_number();
    boolean that_present_map_number = true && that.isSetMap_number();
    if (this_present_map_number || that_present_map_number) {
      if (!(this_present_map_number && that_present_map_number))
        return false;
      if (this.map_number != that.map_number)
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    int hashCode = 1;

    hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(id);

    hashCode = hashCode * 8191 + ((isSetType()) ? 131071 : 524287);
    if (isSetType())
      hashCode = hashCode * 8191 + type.getValue();

    hashCode = hashCode * 8191 + ((isSetFromkey()) ? 131071 : 524287);
    if (isSetFromkey())
      hashCode = hashCode * 8191 + fromkey.hashCode();

    hashCode = hashCode * 8191 + ((isSetTokey()) ? 131071 : 524287);
    if (isSetTokey())
      hashCode = hashCode * 8191 + tokey.hashCode();

    hashCode = hashCode * 8191 + ((isSetFromid()) ? 131071 : 524287);
    if (isSetFromid())
      hashCode = hashCode * 8191 + fromid;

    hashCode = hashCode * 8191 + ((isSetToid()) ? 131071 : 524287);
    if (isSetToid())
      hashCode = hashCode * 8191 + toid;

    hashCode = hashCode * 8191 + ((isSetSnapshot()) ? 131071 : 524287);
    if (isSetSnapshot())
      hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(snapshot);

    hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(partition_version);

    hashCode = hashCode * 8191 + ((isSetMap_number()) ? 131071 : 524287);
    if (isSetMap_number())
      hashCode = hashCode * 8191 + map_number;

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetId(), other.isSetId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, other.id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetType(), other.isSetType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type, other.type);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetFromkey(), other.isSetFromkey());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFromkey()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fromkey, other.fromkey);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetTokey(), other.isSetTokey());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTokey()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tokey, other.tokey);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetFromid(), other.isSetFromid());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFromid()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fromid, other.fromid);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetToid(), other.isSetToid());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetToid()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.toid, other.toid);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetSnapshot(), other.isSetSnapshot());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSnapshot()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.snapshot, other.snapshot);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetPartition_version(), other.isSetPartition_version());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPartition_version()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.partition_version, other.partition_version);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetMap_number(), other.isSetMap_number());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMap_number()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.map_number, other.map_number);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  @org.apache.thrift.annotation.Nullable
  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    scheme(iprot).read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    scheme(oprot).write(oprot, this);
  }

  @Override
  public java.lang.String toString() {
    java.lang.StringBuilder sb = new java.lang.StringBuilder("RangeCommand(");
    boolean first = true;

    sb.append("id:");
    sb.append(this.id);
    first = false;
    if (!first) sb.append(", ");
    sb.append("type:");
    if (this.type == null) {
      sb.append("null");
    } else {
      sb.append(this.type);
    }
    first = false;
    if (isSetFromkey()) {
      if (!first) sb.append(", ");
      sb.append("fromkey:");
      if (this.fromkey == null) {
        sb.append("null");
      } else {
        org.apache.thrift.TBaseHelper.toString(this.fromkey, sb);
      }
      first = false;
    }
    if (isSetTokey()) {
      if (!first) sb.append(", ");
      sb.append("tokey:");
      if (this.tokey == null) {
        sb.append("null");
      } else {
        org.apache.thrift.TBaseHelper.toString(this.tokey, sb);
      }
      first = false;
    }
    if (isSetFromid()) {
      if (!first) sb.append(", ");
      sb.append("fromid:");
      sb.append(this.fromid);
      first = false;
    }
    if (isSetToid()) {
      if (!first) sb.append(", ");
      sb.append("toid:");
      sb.append(this.toid);
      first = false;
    }
    if (isSetSnapshot()) {
      if (!first) sb.append(", ");
      sb.append("snapshot:");
      sb.append(this.snapshot);
      first = false;
    }
    if (!first) sb.append(", ");
    sb.append("partition_version:");
    sb.append(this.partition_version);
    first = false;
    if (isSetMap_number()) {
      if (!first) sb.append(", ");
      sb.append("map_number:");
      sb.append(this.map_number);
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

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

  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, java.lang.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_bitfield = 0;
      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);
    }
  }

  private static class RangeCommandStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public RangeCommandStandardScheme getScheme() {
      return new RangeCommandStandardScheme();
    }
  }

  private static class RangeCommandStandardScheme extends org.apache.thrift.scheme.StandardScheme<RangeCommand> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, RangeCommand struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
          break;
        }
        switch (schemeField.id) {
          case 1: // ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.id = iprot.readI64();
              struct.setIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.type = ch.usi.da.dmap.thrift.gen.RangeType.findByValue(iprot.readI32());
              struct.setTypeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // FROMKEY
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.fromkey = iprot.readBinary();
              struct.setFromkeyIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // TOKEY
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.tokey = iprot.readBinary();
              struct.setTokeyIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // FROMID
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.fromid = iprot.readI32();
              struct.setFromidIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // TOID
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.toid = iprot.readI32();
              struct.setToidIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // SNAPSHOT
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.snapshot = iprot.readI64();
              struct.setSnapshotIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // PARTITION_VERSION
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.partition_version = iprot.readI64();
              struct.setPartition_versionIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 9: // MAP_NUMBER
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.map_number = iprot.readI32();
              struct.setMap_numberIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

      // check for required fields of primitive type, which can't be checked in the validate method
      struct.validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(ID_FIELD_DESC);
      oprot.writeI64(struct.id);
      oprot.writeFieldEnd();
      if (struct.type != null) {
        oprot.writeFieldBegin(TYPE_FIELD_DESC);
        oprot.writeI32(struct.type.getValue());
        oprot.writeFieldEnd();
      }
      if (struct.fromkey != null) {
        if (struct.isSetFromkey()) {
          oprot.writeFieldBegin(FROMKEY_FIELD_DESC);
          oprot.writeBinary(struct.fromkey);
          oprot.writeFieldEnd();
        }
      }
      if (struct.tokey != null) {
        if (struct.isSetTokey()) {
          oprot.writeFieldBegin(TOKEY_FIELD_DESC);
          oprot.writeBinary(struct.tokey);
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetFromid()) {
        oprot.writeFieldBegin(FROMID_FIELD_DESC);
        oprot.writeI32(struct.fromid);
        oprot.writeFieldEnd();
      }
      if (struct.isSetToid()) {
        oprot.writeFieldBegin(TOID_FIELD_DESC);
        oprot.writeI32(struct.toid);
        oprot.writeFieldEnd();
      }
      if (struct.isSetSnapshot()) {
        oprot.writeFieldBegin(SNAPSHOT_FIELD_DESC);
        oprot.writeI64(struct.snapshot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(PARTITION_VERSION_FIELD_DESC);
      oprot.writeI64(struct.partition_version);
      oprot.writeFieldEnd();
      if (struct.isSetMap_number()) {
        oprot.writeFieldBegin(MAP_NUMBER_FIELD_DESC);
        oprot.writeI32(struct.map_number);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class RangeCommandTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public RangeCommandTupleScheme getScheme() {
      return new RangeCommandTupleScheme();
    }
  }

  private static class RangeCommandTupleScheme extends org.apache.thrift.scheme.TupleScheme<RangeCommand> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, RangeCommand struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetId()) {
        optionals.set(0);
      }
      if (struct.isSetType()) {
        optionals.set(1);
      }
      if (struct.isSetFromkey()) {
        optionals.set(2);
      }
      if (struct.isSetTokey()) {
        optionals.set(3);
      }
      if (struct.isSetFromid()) {
        optionals.set(4);
      }
      if (struct.isSetToid()) {
        optionals.set(5);
      }
      if (struct.isSetSnapshot()) {
        optionals.set(6);
      }
      if (struct.isSetPartition_version()) {
        optionals.set(7);
      }
      if (struct.isSetMap_number()) {
        optionals.set(8);
      }
      oprot.writeBitSet(optionals, 9);
      if (struct.isSetId()) {
        oprot.writeI64(struct.id);
      }
      if (struct.isSetType()) {
        oprot.writeI32(struct.type.getValue());
      }
      if (struct.isSetFromkey()) {
        oprot.writeBinary(struct.fromkey);
      }
      if (struct.isSetTokey()) {
        oprot.writeBinary(struct.tokey);
      }
      if (struct.isSetFromid()) {
        oprot.writeI32(struct.fromid);
      }
      if (struct.isSetToid()) {
        oprot.writeI32(struct.toid);
      }
      if (struct.isSetSnapshot()) {
        oprot.writeI64(struct.snapshot);
      }
      if (struct.isSetPartition_version()) {
        oprot.writeI64(struct.partition_version);
      }
      if (struct.isSetMap_number()) {
        oprot.writeI32(struct.map_number);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, RangeCommand struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet incoming = iprot.readBitSet(9);
      if (incoming.get(0)) {
        struct.id = iprot.readI64();
        struct.setIdIsSet(true);
      }
      if (incoming.get(1)) {
        struct.type = ch.usi.da.dmap.thrift.gen.RangeType.findByValue(iprot.readI32());
        struct.setTypeIsSet(true);
      }
      if (incoming.get(2)) {
        struct.fromkey = iprot.readBinary();
        struct.setFromkeyIsSet(true);
      }
      if (incoming.get(3)) {
        struct.tokey = iprot.readBinary();
        struct.setTokeyIsSet(true);
      }
      if (incoming.get(4)) {
        struct.fromid = iprot.readI32();
        struct.setFromidIsSet(true);
      }
      if (incoming.get(5)) {
        struct.toid = iprot.readI32();
        struct.setToidIsSet(true);
      }
      if (incoming.get(6)) {
        struct.snapshot = iprot.readI64();
        struct.setSnapshotIsSet(true);
      }
      if (incoming.get(7)) {
        struct.partition_version = iprot.readI64();
        struct.setPartition_versionIsSet(true);
      }
      if (incoming.get(8)) {
        struct.map_number = iprot.readI32();
        struct.setMap_numberIsSet(true);
      }
    }
  }

  private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
    return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
  }
}

