All Downloads are FREE. Search and download functionalities are using the official Maven repository.

co.cask.tephra.distributed.thrift.TTransaction Maven / Gradle / Ivy

/*
 * Copyright © 2015 Cask Data, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

/**
 * Autogenerated by Thrift Compiler (0.9.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package co.cask.tephra.distributed.thrift;

import org.apache.thrift.EncodingUtils;
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 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;

public class TTransaction implements org.apache.thrift.TBase, java.io.Serializable, Cloneable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TTransaction");

  private static final org.apache.thrift.protocol.TField WRITE_POINTER_FIELD_DESC = new org.apache.thrift.protocol.TField("writePointer", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField READ_POINTER_FIELD_DESC = new org.apache.thrift.protocol.TField("readPointer", org.apache.thrift.protocol.TType.I64, (short)2);
  private static final org.apache.thrift.protocol.TField INVALIDS_FIELD_DESC = new org.apache.thrift.protocol.TField("invalids", org.apache.thrift.protocol.TType.LIST, (short)3);
  private static final org.apache.thrift.protocol.TField IN_PROGRESS_FIELD_DESC = new org.apache.thrift.protocol.TField("inProgress", org.apache.thrift.protocol.TType.LIST, (short)4);
  private static final org.apache.thrift.protocol.TField FIRST_SHORT_FIELD_DESC = new org.apache.thrift.protocol.TField("firstShort", org.apache.thrift.protocol.TType.I64, (short)5);
  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)6);

  private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
  static {
    schemes.put(StandardScheme.class, new TTransactionStandardSchemeFactory());
    schemes.put(TupleScheme.class, new TTransactionTupleSchemeFactory());
  }

  public long writePointer; // required
  public long readPointer; // required
  public List invalids; // required
  public List inProgress; // required
  public long firstShort; // required
  /**
   * 
   * @see TTransactionType
   */
  public TTransactionType type; // required

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    WRITE_POINTER((short)1, "writePointer"),
    READ_POINTER((short)2, "readPointer"),
    INVALIDS((short)3, "invalids"),
    IN_PROGRESS((short)4, "inProgress"),
    FIRST_SHORT((short)5, "firstShort"),
    /**
     * 
     * @see TTransactionType
     */
    TYPE((short)6, "type");

    private static final Map byName = new HashMap();

    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: // WRITE_POINTER
          return WRITE_POINTER;
        case 2: // READ_POINTER
          return READ_POINTER;
        case 3: // INVALIDS
          return INVALIDS;
        case 4: // IN_PROGRESS
          return IN_PROGRESS;
        case 5: // FIRST_SHORT
          return FIRST_SHORT;
        case 6: // TYPE
          return TYPE;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    public static _Fields findByName(String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final String _fieldName;

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

    public short getThriftFieldId() {
      return _thriftId;
    }

    public String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final int __WRITEPOINTER_ISSET_ID = 0;
  private static final int __READPOINTER_ISSET_ID = 1;
  private static final int __FIRSTSHORT_ISSET_ID = 2;
  private byte __isset_bitfield = 0;
  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.WRITE_POINTER, new org.apache.thrift.meta_data.FieldMetaData("writePointer", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.READ_POINTER, new org.apache.thrift.meta_data.FieldMetaData("readPointer", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.INVALIDS, new org.apache.thrift.meta_data.FieldMetaData("invalids", 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.IN_PROGRESS, new org.apache.thrift.meta_data.FieldMetaData("inProgress", 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.FIRST_SHORT, new org.apache.thrift.meta_data.FieldMetaData("firstShort", 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, TTransactionType.class)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TTransaction.class, metaDataMap);
  }

  public TTransaction() {
  }

  public TTransaction(
    long writePointer,
    long readPointer,
    List invalids,
    List inProgress,
    long firstShort,
    TTransactionType type)
  {
    this();
    this.writePointer = writePointer;
    setWritePointerIsSet(true);
    this.readPointer = readPointer;
    setReadPointerIsSet(true);
    this.invalids = invalids;
    this.inProgress = inProgress;
    this.firstShort = firstShort;
    setFirstShortIsSet(true);
    this.type = type;
  }

  /**
   * Performs a deep copy on other.
   */
  public TTransaction(TTransaction other) {
    __isset_bitfield = other.__isset_bitfield;
    this.writePointer = other.writePointer;
    this.readPointer = other.readPointer;
    if (other.isSetInvalids()) {
      List __this__invalids = new ArrayList();
      for (Long other_element : other.invalids) {
        __this__invalids.add(other_element);
      }
      this.invalids = __this__invalids;
    }
    if (other.isSetInProgress()) {
      List __this__inProgress = new ArrayList();
      for (Long other_element : other.inProgress) {
        __this__inProgress.add(other_element);
      }
      this.inProgress = __this__inProgress;
    }
    this.firstShort = other.firstShort;
    if (other.isSetType()) {
      this.type = other.type;
    }
  }

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

  @Override
  public void clear() {
    setWritePointerIsSet(false);
    this.writePointer = 0;
    setReadPointerIsSet(false);
    this.readPointer = 0;
    this.invalids = null;
    this.inProgress = null;
    setFirstShortIsSet(false);
    this.firstShort = 0;
    this.type = null;
  }

  public long getWritePointer() {
    return this.writePointer;
  }

  public TTransaction setWritePointer(long writePointer) {
    this.writePointer = writePointer;
    setWritePointerIsSet(true);
    return this;
  }

  public void unsetWritePointer() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __WRITEPOINTER_ISSET_ID);
  }

  /** Returns true if field writePointer is set (has been assigned a value) and false otherwise */
  public boolean isSetWritePointer() {
    return EncodingUtils.testBit(__isset_bitfield, __WRITEPOINTER_ISSET_ID);
  }

  public void setWritePointerIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __WRITEPOINTER_ISSET_ID, value);
  }

  public long getReadPointer() {
    return this.readPointer;
  }

  public TTransaction setReadPointer(long readPointer) {
    this.readPointer = readPointer;
    setReadPointerIsSet(true);
    return this;
  }

  public void unsetReadPointer() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __READPOINTER_ISSET_ID);
  }

  /** Returns true if field readPointer is set (has been assigned a value) and false otherwise */
  public boolean isSetReadPointer() {
    return EncodingUtils.testBit(__isset_bitfield, __READPOINTER_ISSET_ID);
  }

  public void setReadPointerIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __READPOINTER_ISSET_ID, value);
  }

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

  public java.util.Iterator getInvalidsIterator() {
    return (this.invalids == null) ? null : this.invalids.iterator();
  }

  public void addToInvalids(long elem) {
    if (this.invalids == null) {
      this.invalids = new ArrayList();
    }
    this.invalids.add(elem);
  }

  public List getInvalids() {
    return this.invalids;
  }

  public TTransaction setInvalids(List invalids) {
    this.invalids = invalids;
    return this;
  }

  public void unsetInvalids() {
    this.invalids = null;
  }

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

  public void setInvalidsIsSet(boolean value) {
    if (!value) {
      this.invalids = null;
    }
  }

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

  public java.util.Iterator getInProgressIterator() {
    return (this.inProgress == null) ? null : this.inProgress.iterator();
  }

  public void addToInProgress(long elem) {
    if (this.inProgress == null) {
      this.inProgress = new ArrayList();
    }
    this.inProgress.add(elem);
  }

  public List getInProgress() {
    return this.inProgress;
  }

  public TTransaction setInProgress(List inProgress) {
    this.inProgress = inProgress;
    return this;
  }

  public void unsetInProgress() {
    this.inProgress = null;
  }

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

  public void setInProgressIsSet(boolean value) {
    if (!value) {
      this.inProgress = null;
    }
  }

  public long getFirstShort() {
    return this.firstShort;
  }

  public TTransaction setFirstShort(long firstShort) {
    this.firstShort = firstShort;
    setFirstShortIsSet(true);
    return this;
  }

  public void unsetFirstShort() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __FIRSTSHORT_ISSET_ID);
  }

  /** Returns true if field firstShort is set (has been assigned a value) and false otherwise */
  public boolean isSetFirstShort() {
    return EncodingUtils.testBit(__isset_bitfield, __FIRSTSHORT_ISSET_ID);
  }

  public void setFirstShortIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __FIRSTSHORT_ISSET_ID, value);
  }

  /**
   * 
   * @see TTransactionType
   */
  public TTransactionType getType() {
    return this.type;
  }

  /**
   * 
   * @see TTransactionType
   */
  public TTransaction setType(TTransactionType 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 void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case WRITE_POINTER:
      if (value == null) {
        unsetWritePointer();
      } else {
        setWritePointer((Long)value);
      }
      break;

    case READ_POINTER:
      if (value == null) {
        unsetReadPointer();
      } else {
        setReadPointer((Long) value);
      }
      break;

    case INVALIDS:
      if (value == null) {
        unsetInvalids();
      } else {
        setInvalids((List) value);
      }
      break;

    case IN_PROGRESS:
      if (value == null) {
        unsetInProgress();
      } else {
        setInProgress((List) value);
      }
      break;

    case FIRST_SHORT:
      if (value == null) {
        unsetFirstShort();
      } else {
        setFirstShort((Long) value);
      }
      break;

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

    }
  }

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

    case READ_POINTER:
      return Long.valueOf(getReadPointer());

    case INVALIDS:
      return getInvalids();

    case IN_PROGRESS:
      return getInProgress();

    case FIRST_SHORT:
      return Long.valueOf(getFirstShort());

    case TYPE:
      return getType();

    }
    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 WRITE_POINTER:
      return isSetWritePointer();
    case READ_POINTER:
      return isSetReadPointer();
    case INVALIDS:
      return isSetInvalids();
    case IN_PROGRESS:
      return isSetInProgress();
    case FIRST_SHORT:
      return isSetFirstShort();
    case TYPE:
      return isSetType();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_writePointer = true;
    boolean that_present_writePointer = true;
    if (this_present_writePointer || that_present_writePointer) {
      if (!(this_present_writePointer && that_present_writePointer))
        return false;
      if (this.writePointer != that.writePointer)
        return false;
    }

    boolean this_present_readPointer = true;
    boolean that_present_readPointer = true;
    if (this_present_readPointer || that_present_readPointer) {
      if (!(this_present_readPointer && that_present_readPointer))
        return false;
      if (this.readPointer != that.readPointer)
        return false;
    }

    boolean this_present_invalids = true && this.isSetInvalids();
    boolean that_present_invalids = true && that.isSetInvalids();
    if (this_present_invalids || that_present_invalids) {
      if (!(this_present_invalids && that_present_invalids))
        return false;
      if (!this.invalids.equals(that.invalids))
        return false;
    }

    boolean this_present_inProgress = true && this.isSetInProgress();
    boolean that_present_inProgress = true && that.isSetInProgress();
    if (this_present_inProgress || that_present_inProgress) {
      if (!(this_present_inProgress && that_present_inProgress))
        return false;
      if (!this.inProgress.equals(that.inProgress))
        return false;
    }

    boolean this_present_firstShort = true;
    boolean that_present_firstShort = true;
    if (this_present_firstShort || that_present_firstShort) {
      if (!(this_present_firstShort && that_present_firstShort))
        return false;
      if (this.firstShort != that.firstShort)
        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;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetWritePointer()).compareTo(typedOther.isSetWritePointer());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetWritePointer()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.writePointer, typedOther.writePointer);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetReadPointer()).compareTo(typedOther.isSetReadPointer());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetReadPointer()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.readPointer, typedOther.readPointer);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetInvalids()).compareTo(typedOther.isSetInvalids());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetInvalids()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.invalids, typedOther.invalids);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetInProgress()).compareTo(typedOther.isSetInProgress());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetInProgress()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.inProgress, typedOther.inProgress);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetFirstShort()).compareTo(typedOther.isSetFirstShort());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFirstShort()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.firstShort, typedOther.firstShort);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetType()).compareTo(typedOther.isSetType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type, typedOther.type);
      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("TTransaction(");
    boolean first = true;

    sb.append("writePointer:");
    sb.append(this.writePointer);
    first = false;
    if (!first) sb.append(", ");
    sb.append("readPointer:");
    sb.append(this.readPointer);
    first = false;
    if (!first) sb.append(", ");
    sb.append("invalids:");
    if (this.invalids == null) {
      sb.append("null");
    } else {
      sb.append(this.invalids);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("inProgress:");
    if (this.inProgress == null) {
      sb.append("null");
    } else {
      sb.append(this.inProgress);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("firstShort:");
    sb.append(this.firstShort);
    first = false;
    if (!first) sb.append(", ");
    sb.append("type:");
    if (this.type == null) {
      sb.append("null");
    } else {
      sb.append(this.type);
    }
    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, 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 TTransactionStandardSchemeFactory implements SchemeFactory {
    public TTransactionStandardScheme getScheme() {
      return new TTransactionStandardScheme();
    }
  }

  private static class TTransactionStandardScheme extends StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TTransaction 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: // WRITE_POINTER
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.writePointer = iprot.readI64();
              struct.setWritePointerIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // READ_POINTER
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.readPointer = iprot.readI64();
              struct.setReadPointerIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // INVALIDS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
                struct.invalids = new ArrayList(_list0.size);
                for (int _i1 = 0; _i1 < _list0.size; ++_i1)
                {
                  long _elem2; // required
                  _elem2 = iprot.readI64();
                  struct.invalids.add(_elem2);
                }
                iprot.readListEnd();
              }
              struct.setInvalidsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // IN_PROGRESS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list3 = iprot.readListBegin();
                struct.inProgress = new ArrayList(_list3.size);
                for (int _i4 = 0; _i4 < _list3.size; ++_i4)
                {
                  long _elem5; // required
                  _elem5 = iprot.readI64();
                  struct.inProgress.add(_elem5);
                }
                iprot.readListEnd();
              }
              struct.setInProgressIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // FIRST_SHORT
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.firstShort = iprot.readI64();
              struct.setFirstShortIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.type = TTransactionType.findByValue(iprot.readI32());
              struct.setTypeIsSet(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, TTransaction struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(WRITE_POINTER_FIELD_DESC);
      oprot.writeI64(struct.writePointer);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(READ_POINTER_FIELD_DESC);
      oprot.writeI64(struct.readPointer);
      oprot.writeFieldEnd();
      if (struct.invalids != null) {
        oprot.writeFieldBegin(INVALIDS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I64, struct.invalids.size()));
          for (long _iter6 : struct.invalids)
          {
            oprot.writeI64(_iter6);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.inProgress != null) {
        oprot.writeFieldBegin(IN_PROGRESS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I64, struct.inProgress.size()));
          for (long _iter7 : struct.inProgress)
          {
            oprot.writeI64(_iter7);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(FIRST_SHORT_FIELD_DESC);
      oprot.writeI64(struct.firstShort);
      oprot.writeFieldEnd();
      if (struct.type != null) {
        oprot.writeFieldBegin(TYPE_FIELD_DESC);
        oprot.writeI32(struct.type.getValue());
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class TTransactionTupleSchemeFactory implements SchemeFactory {
    public TTransactionTupleScheme getScheme() {
      return new TTransactionTupleScheme();
    }
  }

  private static class TTransactionTupleScheme extends TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TTransaction struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetWritePointer()) {
        optionals.set(0);
      }
      if (struct.isSetReadPointer()) {
        optionals.set(1);
      }
      if (struct.isSetInvalids()) {
        optionals.set(2);
      }
      if (struct.isSetInProgress()) {
        optionals.set(3);
      }
      if (struct.isSetFirstShort()) {
        optionals.set(4);
      }
      if (struct.isSetType()) {
        optionals.set(5);
      }
      oprot.writeBitSet(optionals, 6);
      if (struct.isSetWritePointer()) {
        oprot.writeI64(struct.writePointer);
      }
      if (struct.isSetReadPointer()) {
        oprot.writeI64(struct.readPointer);
      }
      if (struct.isSetInvalids()) {
        {
          oprot.writeI32(struct.invalids.size());
          for (long _iter8 : struct.invalids)
          {
            oprot.writeI64(_iter8);
          }
        }
      }
      if (struct.isSetInProgress()) {
        {
          oprot.writeI32(struct.inProgress.size());
          for (long _iter9 : struct.inProgress)
          {
            oprot.writeI64(_iter9);
          }
        }
      }
      if (struct.isSetFirstShort()) {
        oprot.writeI64(struct.firstShort);
      }
      if (struct.isSetType()) {
        oprot.writeI32(struct.type.getValue());
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TTransaction struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(6);
      if (incoming.get(0)) {
        struct.writePointer = iprot.readI64();
        struct.setWritePointerIsSet(true);
      }
      if (incoming.get(1)) {
        struct.readPointer = iprot.readI64();
        struct.setReadPointerIsSet(true);
      }
      if (incoming.get(2)) {
        {
          org.apache.thrift.protocol.TList _list10 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I64, iprot.readI32());
          struct.invalids = new ArrayList(_list10.size);
          for (int _i11 = 0; _i11 < _list10.size; ++_i11)
          {
            long _elem12; // required
            _elem12 = iprot.readI64();
            struct.invalids.add(_elem12);
          }
        }
        struct.setInvalidsIsSet(true);
      }
      if (incoming.get(3)) {
        {
          org.apache.thrift.protocol.TList _list13 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I64, iprot.readI32());
          struct.inProgress = new ArrayList(_list13.size);
          for (int _i14 = 0; _i14 < _list13.size; ++_i14)
          {
            long _elem15; // required
            _elem15 = iprot.readI64();
            struct.inProgress.add(_elem15);
          }
        }
        struct.setInProgressIsSet(true);
      }
      if (incoming.get(4)) {
        struct.firstShort = iprot.readI64();
        struct.setFirstShortIsSet(true);
      }
      if (incoming.get(5)) {
        struct.type = TTransactionType.findByValue(iprot.readI32());
        struct.setTypeIsSet(true);
      }
    }
  }

}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy