/**
 * Autogenerated by Thrift Compiler (0.9.2)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package com.xiaojukeji.carrera.thrift.consumer;

import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;

import javax.annotation.Generated;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.Collections;
import java.util.EnumMap;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2018-10-31")
public class ConsumeResult implements org.apache.thrift.TBase<ConsumeResult, ConsumeResult._Fields>, java.io.Serializable, Cloneable, Comparable<ConsumeResult> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ConsumeResult");

  private static final org.apache.thrift.protocol.TField CONTEXT_FIELD_DESC = new org.apache.thrift.protocol.TField("context", org.apache.thrift.protocol.TType.STRUCT, (short)1);
  private static final org.apache.thrift.protocol.TField SUCCESS_OFFSETS_FIELD_DESC = new org.apache.thrift.protocol.TField("successOffsets", org.apache.thrift.protocol.TType.LIST, (short)3);
  private static final org.apache.thrift.protocol.TField FAIL_OFFSETS_FIELD_DESC = new org.apache.thrift.protocol.TField("failOffsets", org.apache.thrift.protocol.TType.LIST, (short)4);
  private static final org.apache.thrift.protocol.TField NEXT_RESULT_FIELD_DESC = new org.apache.thrift.protocol.TField("nextResult", org.apache.thrift.protocol.TType.STRUCT, (short)10);

  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
  static {
    schemes.put(StandardScheme.class, new ConsumeResultStandardSchemeFactory());
    schemes.put(TupleScheme.class, new ConsumeResultTupleSchemeFactory());
  }

  public Context context; // required
  public List<Long> successOffsets; // required
  public List<Long> failOffsets; // required
  public ConsumeResult nextResult; // 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 {
    CONTEXT((short)1, "context"),
    SUCCESS_OFFSETS((short)3, "successOffsets"),
    FAIL_OFFSETS((short)4, "failOffsets"),
    NEXT_RESULT((short)10, "nextResult");

    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: // CONTEXT
          return CONTEXT;
        case 3: // SUCCESS_OFFSETS
          return SUCCESS_OFFSETS;
        case 4: // FAIL_OFFSETS
          return FAIL_OFFSETS;
        case 10: // NEXT_RESULT
          return NEXT_RESULT;
        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 _Fields optionals[] = {_Fields.NEXT_RESULT};
  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.CONTEXT, new org.apache.thrift.meta_data.FieldMetaData("context", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Context.class)));
    tmpMap.put(_Fields.SUCCESS_OFFSETS, new org.apache.thrift.meta_data.FieldMetaData("successOffsets", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        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.I64))));
    tmpMap.put(_Fields.FAIL_OFFSETS, new org.apache.thrift.meta_data.FieldMetaData("failOffsets", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        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.I64))));
    tmpMap.put(_Fields.NEXT_RESULT, new org.apache.thrift.meta_data.FieldMetaData("nextResult", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT        , "ConsumeResult")));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ConsumeResult.class, metaDataMap);
  }

  public ConsumeResult() {
  }

  public ConsumeResult(
    Context context,
    List<Long> successOffsets,
    List<Long> failOffsets)
  {
    this();
    this.context = context;
    this.successOffsets = successOffsets;
    this.failOffsets = failOffsets;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public ConsumeResult(ConsumeResult other) {
    if (other.isSetContext()) {
      this.context = new Context(other.context);
    }
    if (other.isSetSuccessOffsets()) {
      List<Long> __this__successOffsets = new ArrayList<Long>(other.successOffsets);
      this.successOffsets = __this__successOffsets;
    }
    if (other.isSetFailOffsets()) {
      List<Long> __this__failOffsets = new ArrayList<Long>(other.failOffsets);
      this.failOffsets = __this__failOffsets;
    }
    if (other.isSetNextResult()) {
      this.nextResult = other.nextResult;
    }
  }

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

  @Override
  public void clear() {
    this.context = null;
    this.successOffsets = null;
    this.failOffsets = null;
    this.nextResult = null;
  }

  public Context getContext() {
    return this.context;
  }

  public ConsumeResult setContext(Context context) {
    this.context = context;
    return this;
  }

  public void unsetContext() {
    this.context = null;
  }

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

  public void setContextIsSet(boolean value) {
    if (!value) {
      this.context = null;
    }
  }

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

  public java.util.Iterator<Long> getSuccessOffsetsIterator() {
    return (this.successOffsets == null) ? null : this.successOffsets.iterator();
  }

  public void addToSuccessOffsets(long elem) {
    if (this.successOffsets == null) {
      this.successOffsets = new ArrayList<Long>();
    }
    this.successOffsets.add(elem);
  }

  public List<Long> getSuccessOffsets() {
    return this.successOffsets;
  }

  public ConsumeResult setSuccessOffsets(List<Long> successOffsets) {
    this.successOffsets = successOffsets;
    return this;
  }

  public void unsetSuccessOffsets() {
    this.successOffsets = null;
  }

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

  public void setSuccessOffsetsIsSet(boolean value) {
    if (!value) {
      this.successOffsets = null;
    }
  }

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

  public java.util.Iterator<Long> getFailOffsetsIterator() {
    return (this.failOffsets == null) ? null : this.failOffsets.iterator();
  }

  public void addToFailOffsets(long elem) {
    if (this.failOffsets == null) {
      this.failOffsets = new ArrayList<Long>();
    }
    this.failOffsets.add(elem);
  }

  public List<Long> getFailOffsets() {
    return this.failOffsets;
  }

  public ConsumeResult setFailOffsets(List<Long> failOffsets) {
    this.failOffsets = failOffsets;
    return this;
  }

  public void unsetFailOffsets() {
    this.failOffsets = null;
  }

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

  public void setFailOffsetsIsSet(boolean value) {
    if (!value) {
      this.failOffsets = null;
    }
  }

  public ConsumeResult getNextResult() {
    return this.nextResult;
  }

  public ConsumeResult setNextResult(ConsumeResult nextResult) {
    this.nextResult = nextResult;
    return this;
  }

  public void unsetNextResult() {
    this.nextResult = null;
  }

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

  public void setNextResultIsSet(boolean value) {
    if (!value) {
      this.nextResult = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case CONTEXT:
      if (value == null) {
        unsetContext();
      } else {
        setContext((Context)value);
      }
      break;

    case SUCCESS_OFFSETS:
      if (value == null) {
        unsetSuccessOffsets();
      } else {
        setSuccessOffsets((List<Long>)value);
      }
      break;

    case FAIL_OFFSETS:
      if (value == null) {
        unsetFailOffsets();
      } else {
        setFailOffsets((List<Long>)value);
      }
      break;

    case NEXT_RESULT:
      if (value == null) {
        unsetNextResult();
      } else {
        setNextResult((ConsumeResult)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case CONTEXT:
      return getContext();

    case SUCCESS_OFFSETS:
      return getSuccessOffsets();

    case FAIL_OFFSETS:
      return getFailOffsets();

    case NEXT_RESULT:
      return getNextResult();

    }
    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 CONTEXT:
      return isSetContext();
    case SUCCESS_OFFSETS:
      return isSetSuccessOffsets();
    case FAIL_OFFSETS:
      return isSetFailOffsets();
    case NEXT_RESULT:
      return isSetNextResult();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_context = true && this.isSetContext();
    boolean that_present_context = true && that.isSetContext();
    if (this_present_context || that_present_context) {
      if (!(this_present_context && that_present_context))
        return false;
      if (!this.context.equals(that.context))
        return false;
    }

    boolean this_present_successOffsets = true && this.isSetSuccessOffsets();
    boolean that_present_successOffsets = true && that.isSetSuccessOffsets();
    if (this_present_successOffsets || that_present_successOffsets) {
      if (!(this_present_successOffsets && that_present_successOffsets))
        return false;
      if (!this.successOffsets.equals(that.successOffsets))
        return false;
    }

    boolean this_present_failOffsets = true && this.isSetFailOffsets();
    boolean that_present_failOffsets = true && that.isSetFailOffsets();
    if (this_present_failOffsets || that_present_failOffsets) {
      if (!(this_present_failOffsets && that_present_failOffsets))
        return false;
      if (!this.failOffsets.equals(that.failOffsets))
        return false;
    }

    boolean this_present_nextResult = true && this.isSetNextResult();
    boolean that_present_nextResult = true && that.isSetNextResult();
    if (this_present_nextResult || that_present_nextResult) {
      if (!(this_present_nextResult && that_present_nextResult))
        return false;
      if (!this.nextResult.equals(that.nextResult))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    List<Object> list = new ArrayList<Object>();

    boolean present_context = true && (isSetContext());
    list.add(present_context);
    if (present_context)
      list.add(context);

    boolean present_successOffsets = true && (isSetSuccessOffsets());
    list.add(present_successOffsets);
    if (present_successOffsets)
      list.add(successOffsets);

    boolean present_failOffsets = true && (isSetFailOffsets());
    list.add(present_failOffsets);
    if (present_failOffsets)
      list.add(failOffsets);

    boolean present_nextResult = true && (isSetNextResult());
    list.add(present_nextResult);
    if (present_nextResult)
      list.add(nextResult);

    return list.hashCode();
  }

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

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetContext()).compareTo(other.isSetContext());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetContext()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.context, other.context);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetSuccessOffsets()).compareTo(other.isSetSuccessOffsets());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSuccessOffsets()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.successOffsets, other.successOffsets);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetFailOffsets()).compareTo(other.isSetFailOffsets());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFailOffsets()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.failOffsets, other.failOffsets);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetNextResult()).compareTo(other.isSetNextResult());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNextResult()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nextResult, other.nextResult);
      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 {
    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
  }

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

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

    sb.append("context:");
    if (this.context == null) {
      sb.append("null");
    } else {
      sb.append(this.context);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("successOffsets:");
    if (this.successOffsets == null) {
      sb.append("null");
    } else {
      sb.append(this.successOffsets);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("failOffsets:");
    if (this.failOffsets == null) {
      sb.append("null");
    } else {
      sb.append(this.failOffsets);
    }
    first = false;
    if (isSetNextResult()) {
      if (!first) sb.append(", ");
      sb.append("nextResult:");
      if (this.nextResult == null) {
        sb.append("null");
      } else {
        sb.append(this.nextResult);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // check for sub-struct validity
    if (context != null) {
      context.validate();
    }
  }

  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 {
      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 ConsumeResultStandardSchemeFactory implements SchemeFactory {
    public ConsumeResultStandardScheme getScheme() {
      return new ConsumeResultStandardScheme();
    }
  }

  private static class ConsumeResultStandardScheme extends StandardScheme<ConsumeResult> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, ConsumeResult 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: // CONTEXT
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.context = new Context();
              struct.context.read(iprot);
              struct.setContextIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // SUCCESS_OFFSETS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list10 = iprot.readListBegin();
                struct.successOffsets = new ArrayList<Long>(_list10.size);
                long _elem11;
                for (int _i12 = 0; _i12 < _list10.size; ++_i12)
                {
                  _elem11 = iprot.readI64();
                  struct.successOffsets.add(_elem11);
                }
                iprot.readListEnd();
              }
              struct.setSuccessOffsetsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // FAIL_OFFSETS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list13 = iprot.readListBegin();
                struct.failOffsets = new ArrayList<Long>(_list13.size);
                long _elem14;
                for (int _i15 = 0; _i15 < _list13.size; ++_i15)
                {
                  _elem14 = iprot.readI64();
                  struct.failOffsets.add(_elem14);
                }
                iprot.readListEnd();
              }
              struct.setFailOffsetsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 10: // NEXT_RESULT
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.nextResult = new ConsumeResult();
              struct.nextResult.read(iprot);
              struct.setNextResultIsSet(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, ConsumeResult struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.context != null) {
        oprot.writeFieldBegin(CONTEXT_FIELD_DESC);
        struct.context.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.successOffsets != null) {
        oprot.writeFieldBegin(SUCCESS_OFFSETS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I64, struct.successOffsets.size()));
          for (long _iter16 : struct.successOffsets)
          {
            oprot.writeI64(_iter16);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.failOffsets != null) {
        oprot.writeFieldBegin(FAIL_OFFSETS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I64, struct.failOffsets.size()));
          for (long _iter17 : struct.failOffsets)
          {
            oprot.writeI64(_iter17);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.nextResult != null) {
        if (struct.isSetNextResult()) {
          oprot.writeFieldBegin(NEXT_RESULT_FIELD_DESC);
          struct.nextResult.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class ConsumeResultTupleSchemeFactory implements SchemeFactory {
    public ConsumeResultTupleScheme getScheme() {
      return new ConsumeResultTupleScheme();
    }
  }

  private static class ConsumeResultTupleScheme extends TupleScheme<ConsumeResult> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, ConsumeResult struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetContext()) {
        optionals.set(0);
      }
      if (struct.isSetSuccessOffsets()) {
        optionals.set(1);
      }
      if (struct.isSetFailOffsets()) {
        optionals.set(2);
      }
      if (struct.isSetNextResult()) {
        optionals.set(3);
      }
      oprot.writeBitSet(optionals, 4);
      if (struct.isSetContext()) {
        struct.context.write(oprot);
      }
      if (struct.isSetSuccessOffsets()) {
        {
          oprot.writeI32(struct.successOffsets.size());
          for (long _iter18 : struct.successOffsets)
          {
            oprot.writeI64(_iter18);
          }
        }
      }
      if (struct.isSetFailOffsets()) {
        {
          oprot.writeI32(struct.failOffsets.size());
          for (long _iter19 : struct.failOffsets)
          {
            oprot.writeI64(_iter19);
          }
        }
      }
      if (struct.isSetNextResult()) {
        struct.nextResult.write(oprot);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, ConsumeResult struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(4);
      if (incoming.get(0)) {
        struct.context = new Context();
        struct.context.read(iprot);
        struct.setContextIsSet(true);
      }
      if (incoming.get(1)) {
        {
          org.apache.thrift.protocol.TList _list20 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I64, iprot.readI32());
          struct.successOffsets = new ArrayList<Long>(_list20.size);
          long _elem21;
          for (int _i22 = 0; _i22 < _list20.size; ++_i22)
          {
            _elem21 = iprot.readI64();
            struct.successOffsets.add(_elem21);
          }
        }
        struct.setSuccessOffsetsIsSet(true);
      }
      if (incoming.get(2)) {
        {
          org.apache.thrift.protocol.TList _list23 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I64, iprot.readI32());
          struct.failOffsets = new ArrayList<Long>(_list23.size);
          long _elem24;
          for (int _i25 = 0; _i25 < _list23.size; ++_i25)
          {
            _elem24 = iprot.readI64();
            struct.failOffsets.add(_elem24);
          }
        }
        struct.setFailOffsetsIsSet(true);
      }
      if (incoming.get(3)) {
        struct.nextResult = new ConsumeResult();
        struct.nextResult.read(iprot);
        struct.setNextResultIsSet(true);
      }
    }
  }

}

