/**
 * Autogenerated by Thrift Compiler (0.13.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.eclipse.hawk.service.api;

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

  private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField POSITION_FIELD_DESC = new org.apache.thrift.protocol.TField("position", org.apache.thrift.protocol.TType.I32, (short)2);
  private static final org.apache.thrift.protocol.TField POSITIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("positions", org.apache.thrift.protocol.TType.LIST, (short)3);
  private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.STRING, (short)4);
  private static final org.apache.thrift.protocol.TField IDS_FIELD_DESC = new org.apache.thrift.protocol.TField("ids", org.apache.thrift.protocol.TType.LIST, (short)5);
  private static final org.apache.thrift.protocol.TField MIXED_FIELD_DESC = new org.apache.thrift.protocol.TField("mixed", org.apache.thrift.protocol.TType.LIST, (short)6);

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

  public @org.apache.thrift.annotation.Nullable java.lang.String name; // required
  public int position; // optional
  public @org.apache.thrift.annotation.Nullable java.util.List<java.lang.Integer> positions; // optional
  public @org.apache.thrift.annotation.Nullable java.lang.String id; // optional
  public @org.apache.thrift.annotation.Nullable java.util.List<java.lang.String> ids; // optional
  public @org.apache.thrift.annotation.Nullable java.util.List<MixedReference> mixed; // 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 {
    NAME((short)1, "name"),
    POSITION((short)2, "position"),
    POSITIONS((short)3, "positions"),
    ID((short)4, "id"),
    IDS((short)5, "ids"),
    MIXED((short)6, "mixed");

    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: // NAME
          return NAME;
        case 2: // POSITION
          return POSITION;
        case 3: // POSITIONS
          return POSITIONS;
        case 4: // ID
          return ID;
        case 5: // IDS
          return IDS;
        case 6: // MIXED
          return MIXED;
        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 __POSITION_ISSET_ID = 0;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.POSITION,_Fields.POSITIONS,_Fields.ID,_Fields.IDS,_Fields.MIXED};
  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.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.POSITION, new org.apache.thrift.meta_data.FieldMetaData("position", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.POSITIONS, new org.apache.thrift.meta_data.FieldMetaData("positions", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))));
    tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.IDS, new org.apache.thrift.meta_data.FieldMetaData("ids", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
    tmpMap.put(_Fields.MIXED, new org.apache.thrift.meta_data.FieldMetaData("mixed", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, MixedReference.class))));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ReferenceSlot.class, metaDataMap);
  }

  public ReferenceSlot() {
  }

  public ReferenceSlot(
    java.lang.String name)
  {
    this();
    this.name = name;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public ReferenceSlot(ReferenceSlot other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetName()) {
      this.name = other.name;
    }
    this.position = other.position;
    if (other.isSetPositions()) {
      java.util.List<java.lang.Integer> __this__positions = new java.util.ArrayList<java.lang.Integer>(other.positions);
      this.positions = __this__positions;
    }
    if (other.isSetId()) {
      this.id = other.id;
    }
    if (other.isSetIds()) {
      java.util.List<java.lang.String> __this__ids = new java.util.ArrayList<java.lang.String>(other.ids);
      this.ids = __this__ids;
    }
    if (other.isSetMixed()) {
      java.util.List<MixedReference> __this__mixed = new java.util.ArrayList<MixedReference>(other.mixed.size());
      for (MixedReference other_element : other.mixed) {
        __this__mixed.add(new MixedReference(other_element));
      }
      this.mixed = __this__mixed;
    }
  }

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

  @Override
  public void clear() {
    this.name = null;
    setPositionIsSet(false);
    this.position = 0;
    this.positions = null;
    this.id = null;
    this.ids = null;
    this.mixed = null;
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getName() {
    return this.name;
  }

  public ReferenceSlot setName(@org.apache.thrift.annotation.Nullable java.lang.String name) {
    this.name = name;
    return this;
  }

  public void unsetName() {
    this.name = null;
  }

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

  public void setNameIsSet(boolean value) {
    if (!value) {
      this.name = null;
    }
  }

  public int getPosition() {
    return this.position;
  }

  public ReferenceSlot setPosition(int position) {
    this.position = position;
    setPositionIsSet(true);
    return this;
  }

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

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

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

  public int getPositionsSize() {
    return (this.positions == null) ? 0 : this.positions.size();
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<java.lang.Integer> getPositionsIterator() {
    return (this.positions == null) ? null : this.positions.iterator();
  }

  public void addToPositions(int elem) {
    if (this.positions == null) {
      this.positions = new java.util.ArrayList<java.lang.Integer>();
    }
    this.positions.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<java.lang.Integer> getPositions() {
    return this.positions;
  }

  public ReferenceSlot setPositions(@org.apache.thrift.annotation.Nullable java.util.List<java.lang.Integer> positions) {
    this.positions = positions;
    return this;
  }

  public void unsetPositions() {
    this.positions = null;
  }

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

  public void setPositionsIsSet(boolean value) {
    if (!value) {
      this.positions = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getId() {
    return this.id;
  }

  public ReferenceSlot setId(@org.apache.thrift.annotation.Nullable java.lang.String id) {
    this.id = id;
    return this;
  }

  public void unsetId() {
    this.id = null;
  }

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

  public void setIdIsSet(boolean value) {
    if (!value) {
      this.id = null;
    }
  }

  public int getIdsSize() {
    return (this.ids == null) ? 0 : this.ids.size();
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<java.lang.String> getIdsIterator() {
    return (this.ids == null) ? null : this.ids.iterator();
  }

  public void addToIds(java.lang.String elem) {
    if (this.ids == null) {
      this.ids = new java.util.ArrayList<java.lang.String>();
    }
    this.ids.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<java.lang.String> getIds() {
    return this.ids;
  }

  public ReferenceSlot setIds(@org.apache.thrift.annotation.Nullable java.util.List<java.lang.String> ids) {
    this.ids = ids;
    return this;
  }

  public void unsetIds() {
    this.ids = null;
  }

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

  public void setIdsIsSet(boolean value) {
    if (!value) {
      this.ids = null;
    }
  }

  public int getMixedSize() {
    return (this.mixed == null) ? 0 : this.mixed.size();
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<MixedReference> getMixedIterator() {
    return (this.mixed == null) ? null : this.mixed.iterator();
  }

  public void addToMixed(MixedReference elem) {
    if (this.mixed == null) {
      this.mixed = new java.util.ArrayList<MixedReference>();
    }
    this.mixed.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<MixedReference> getMixed() {
    return this.mixed;
  }

  public ReferenceSlot setMixed(@org.apache.thrift.annotation.Nullable java.util.List<MixedReference> mixed) {
    this.mixed = mixed;
    return this;
  }

  public void unsetMixed() {
    this.mixed = null;
  }

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

  public void setMixedIsSet(boolean value) {
    if (!value) {
      this.mixed = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case NAME:
      if (value == null) {
        unsetName();
      } else {
        setName((java.lang.String)value);
      }
      break;

    case POSITION:
      if (value == null) {
        unsetPosition();
      } else {
        setPosition((java.lang.Integer)value);
      }
      break;

    case POSITIONS:
      if (value == null) {
        unsetPositions();
      } else {
        setPositions((java.util.List<java.lang.Integer>)value);
      }
      break;

    case ID:
      if (value == null) {
        unsetId();
      } else {
        setId((java.lang.String)value);
      }
      break;

    case IDS:
      if (value == null) {
        unsetIds();
      } else {
        setIds((java.util.List<java.lang.String>)value);
      }
      break;

    case MIXED:
      if (value == null) {
        unsetMixed();
      } else {
        setMixed((java.util.List<MixedReference>)value);
      }
      break;

    }
  }

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

    case POSITION:
      return getPosition();

    case POSITIONS:
      return getPositions();

    case ID:
      return getId();

    case IDS:
      return getIds();

    case MIXED:
      return getMixed();

    }
    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 NAME:
      return isSetName();
    case POSITION:
      return isSetPosition();
    case POSITIONS:
      return isSetPositions();
    case ID:
      return isSetId();
    case IDS:
      return isSetIds();
    case MIXED:
      return isSetMixed();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_name = true && this.isSetName();
    boolean that_present_name = true && that.isSetName();
    if (this_present_name || that_present_name) {
      if (!(this_present_name && that_present_name))
        return false;
      if (!this.name.equals(that.name))
        return false;
    }

    boolean this_present_position = true && this.isSetPosition();
    boolean that_present_position = true && that.isSetPosition();
    if (this_present_position || that_present_position) {
      if (!(this_present_position && that_present_position))
        return false;
      if (this.position != that.position)
        return false;
    }

    boolean this_present_positions = true && this.isSetPositions();
    boolean that_present_positions = true && that.isSetPositions();
    if (this_present_positions || that_present_positions) {
      if (!(this_present_positions && that_present_positions))
        return false;
      if (!this.positions.equals(that.positions))
        return false;
    }

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

    boolean this_present_ids = true && this.isSetIds();
    boolean that_present_ids = true && that.isSetIds();
    if (this_present_ids || that_present_ids) {
      if (!(this_present_ids && that_present_ids))
        return false;
      if (!this.ids.equals(that.ids))
        return false;
    }

    boolean this_present_mixed = true && this.isSetMixed();
    boolean that_present_mixed = true && that.isSetMixed();
    if (this_present_mixed || that_present_mixed) {
      if (!(this_present_mixed && that_present_mixed))
        return false;
      if (!this.mixed.equals(that.mixed))
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287);
    if (isSetName())
      hashCode = hashCode * 8191 + name.hashCode();

    hashCode = hashCode * 8191 + ((isSetPosition()) ? 131071 : 524287);
    if (isSetPosition())
      hashCode = hashCode * 8191 + position;

    hashCode = hashCode * 8191 + ((isSetPositions()) ? 131071 : 524287);
    if (isSetPositions())
      hashCode = hashCode * 8191 + positions.hashCode();

    hashCode = hashCode * 8191 + ((isSetId()) ? 131071 : 524287);
    if (isSetId())
      hashCode = hashCode * 8191 + id.hashCode();

    hashCode = hashCode * 8191 + ((isSetIds()) ? 131071 : 524287);
    if (isSetIds())
      hashCode = hashCode * 8191 + ids.hashCode();

    hashCode = hashCode * 8191 + ((isSetMixed()) ? 131071 : 524287);
    if (isSetMixed())
      hashCode = hashCode * 8191 + mixed.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.valueOf(isSetName()).compareTo(other.isSetName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetName()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetPosition()).compareTo(other.isSetPosition());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPosition()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.position, other.position);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetPositions()).compareTo(other.isSetPositions());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPositions()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.positions, other.positions);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetId()).compareTo(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.valueOf(isSetIds()).compareTo(other.isSetIds());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIds()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ids, other.ids);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetMixed()).compareTo(other.isSetMixed());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMixed()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.mixed, other.mixed);
      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("ReferenceSlot(");
    boolean first = true;

    sb.append("name:");
    if (this.name == null) {
      sb.append("null");
    } else {
      sb.append(this.name);
    }
    first = false;
    if (isSetPosition()) {
      if (!first) sb.append(", ");
      sb.append("position:");
      sb.append(this.position);
      first = false;
    }
    if (isSetPositions()) {
      if (!first) sb.append(", ");
      sb.append("positions:");
      if (this.positions == null) {
        sb.append("null");
      } else {
        sb.append(this.positions);
      }
      first = false;
    }
    if (isSetId()) {
      if (!first) sb.append(", ");
      sb.append("id:");
      if (this.id == null) {
        sb.append("null");
      } else {
        sb.append(this.id);
      }
      first = false;
    }
    if (isSetIds()) {
      if (!first) sb.append(", ");
      sb.append("ids:");
      if (this.ids == null) {
        sb.append("null");
      } else {
        sb.append(this.ids);
      }
      first = false;
    }
    if (isSetMixed()) {
      if (!first) sb.append(", ");
      sb.append("mixed:");
      if (this.mixed == null) {
        sb.append("null");
      } else {
        sb.append(this.mixed);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (name == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'name' was not present! Struct: " + toString());
    }
    // 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 ReferenceSlotStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public ReferenceSlotStandardScheme getScheme() {
      return new ReferenceSlotStandardScheme();
    }
  }

  private static class ReferenceSlotStandardScheme extends org.apache.thrift.scheme.StandardScheme<ReferenceSlot> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, ReferenceSlot 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: // NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.name = iprot.readString();
              struct.setNameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // POSITION
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.position = iprot.readI32();
              struct.setPositionIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // POSITIONS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list88 = iprot.readListBegin();
                struct.positions = new java.util.ArrayList<java.lang.Integer>(_list88.size);
                int _elem89;
                for (int _i90 = 0; _i90 < _list88.size; ++_i90)
                {
                  _elem89 = iprot.readI32();
                  struct.positions.add(_elem89);
                }
                iprot.readListEnd();
              }
              struct.setPositionsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.id = iprot.readString();
              struct.setIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // IDS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list91 = iprot.readListBegin();
                struct.ids = new java.util.ArrayList<java.lang.String>(_list91.size);
                @org.apache.thrift.annotation.Nullable java.lang.String _elem92;
                for (int _i93 = 0; _i93 < _list91.size; ++_i93)
                {
                  _elem92 = iprot.readString();
                  struct.ids.add(_elem92);
                }
                iprot.readListEnd();
              }
              struct.setIdsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // MIXED
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list94 = iprot.readListBegin();
                struct.mixed = new java.util.ArrayList<MixedReference>(_list94.size);
                @org.apache.thrift.annotation.Nullable MixedReference _elem95;
                for (int _i96 = 0; _i96 < _list94.size; ++_i96)
                {
                  _elem95 = new MixedReference();
                  _elem95.read(iprot);
                  struct.mixed.add(_elem95);
                }
                iprot.readListEnd();
              }
              struct.setMixedIsSet(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, ReferenceSlot struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.name != null) {
        oprot.writeFieldBegin(NAME_FIELD_DESC);
        oprot.writeString(struct.name);
        oprot.writeFieldEnd();
      }
      if (struct.isSetPosition()) {
        oprot.writeFieldBegin(POSITION_FIELD_DESC);
        oprot.writeI32(struct.position);
        oprot.writeFieldEnd();
      }
      if (struct.positions != null) {
        if (struct.isSetPositions()) {
          oprot.writeFieldBegin(POSITIONS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I32, struct.positions.size()));
            for (int _iter97 : struct.positions)
            {
              oprot.writeI32(_iter97);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.id != null) {
        if (struct.isSetId()) {
          oprot.writeFieldBegin(ID_FIELD_DESC);
          oprot.writeString(struct.id);
          oprot.writeFieldEnd();
        }
      }
      if (struct.ids != null) {
        if (struct.isSetIds()) {
          oprot.writeFieldBegin(IDS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.ids.size()));
            for (java.lang.String _iter98 : struct.ids)
            {
              oprot.writeString(_iter98);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.mixed != null) {
        if (struct.isSetMixed()) {
          oprot.writeFieldBegin(MIXED_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.mixed.size()));
            for (MixedReference _iter99 : struct.mixed)
            {
              _iter99.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

  private static class ReferenceSlotTupleScheme extends org.apache.thrift.scheme.TupleScheme<ReferenceSlot> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, ReferenceSlot struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      oprot.writeString(struct.name);
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetPosition()) {
        optionals.set(0);
      }
      if (struct.isSetPositions()) {
        optionals.set(1);
      }
      if (struct.isSetId()) {
        optionals.set(2);
      }
      if (struct.isSetIds()) {
        optionals.set(3);
      }
      if (struct.isSetMixed()) {
        optionals.set(4);
      }
      oprot.writeBitSet(optionals, 5);
      if (struct.isSetPosition()) {
        oprot.writeI32(struct.position);
      }
      if (struct.isSetPositions()) {
        {
          oprot.writeI32(struct.positions.size());
          for (int _iter100 : struct.positions)
          {
            oprot.writeI32(_iter100);
          }
        }
      }
      if (struct.isSetId()) {
        oprot.writeString(struct.id);
      }
      if (struct.isSetIds()) {
        {
          oprot.writeI32(struct.ids.size());
          for (java.lang.String _iter101 : struct.ids)
          {
            oprot.writeString(_iter101);
          }
        }
      }
      if (struct.isSetMixed()) {
        {
          oprot.writeI32(struct.mixed.size());
          for (MixedReference _iter102 : struct.mixed)
          {
            _iter102.write(oprot);
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, ReferenceSlot struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.name = iprot.readString();
      struct.setNameIsSet(true);
      java.util.BitSet incoming = iprot.readBitSet(5);
      if (incoming.get(0)) {
        struct.position = iprot.readI32();
        struct.setPositionIsSet(true);
      }
      if (incoming.get(1)) {
        {
          org.apache.thrift.protocol.TList _list103 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I32, iprot.readI32());
          struct.positions = new java.util.ArrayList<java.lang.Integer>(_list103.size);
          int _elem104;
          for (int _i105 = 0; _i105 < _list103.size; ++_i105)
          {
            _elem104 = iprot.readI32();
            struct.positions.add(_elem104);
          }
        }
        struct.setPositionsIsSet(true);
      }
      if (incoming.get(2)) {
        struct.id = iprot.readString();
        struct.setIdIsSet(true);
      }
      if (incoming.get(3)) {
        {
          org.apache.thrift.protocol.TList _list106 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
          struct.ids = new java.util.ArrayList<java.lang.String>(_list106.size);
          @org.apache.thrift.annotation.Nullable java.lang.String _elem107;
          for (int _i108 = 0; _i108 < _list106.size; ++_i108)
          {
            _elem107 = iprot.readString();
            struct.ids.add(_elem107);
          }
        }
        struct.setIdsIsSet(true);
      }
      if (incoming.get(4)) {
        {
          org.apache.thrift.protocol.TList _list109 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
          struct.mixed = new java.util.ArrayList<MixedReference>(_list109.size);
          @org.apache.thrift.annotation.Nullable MixedReference _elem110;
          for (int _i111 = 0; _i111 < _list109.size; ++_i111)
          {
            _elem110 = new MixedReference();
            _elem110.read(iprot);
            struct.mixed.add(_elem110);
          }
        }
        struct.setMixedIsSet(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();
  }
}

