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

org.apache.hadoop.hive.metastore.api.HeartbeatTxnRangeResponse Maven / Gradle / Ivy

The newest version!
/**
 * Autogenerated by Thrift Compiler (0.9.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.hadoop.hive.metastore.api;

import org.apache.commons.lang.builder.HashCodeBuilder;
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 org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class HeartbeatTxnRangeResponse 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("HeartbeatTxnRangeResponse");

  private static final org.apache.thrift.protocol.TField ABORTED_FIELD_DESC = new org.apache.thrift.protocol.TField("aborted", org.apache.thrift.protocol.TType.SET, (short)1);
  private static final org.apache.thrift.protocol.TField NOSUCH_FIELD_DESC = new org.apache.thrift.protocol.TField("nosuch", org.apache.thrift.protocol.TType.SET, (short)2);

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

  private Set aborted; // required
  private Set nosuch; // 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 {
    ABORTED((short)1, "aborted"),
    NOSUCH((short)2, "nosuch");

    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: // ABORTED
          return ABORTED;
        case 2: // NOSUCH
          return NOSUCH;
        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
  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.ABORTED, new org.apache.thrift.meta_data.FieldMetaData("aborted", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))));
    tmpMap.put(_Fields.NOSUCH, new org.apache.thrift.meta_data.FieldMetaData("nosuch", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(HeartbeatTxnRangeResponse.class, metaDataMap);
  }

  public HeartbeatTxnRangeResponse() {
  }

  public HeartbeatTxnRangeResponse(
    Set aborted,
    Set nosuch)
  {
    this();
    this.aborted = aborted;
    this.nosuch = nosuch;
  }

  /**
   * Performs a deep copy on other.
   */
  public HeartbeatTxnRangeResponse(HeartbeatTxnRangeResponse other) {
    if (other.isSetAborted()) {
      Set __this__aborted = new HashSet();
      for (Long other_element : other.aborted) {
        __this__aborted.add(other_element);
      }
      this.aborted = __this__aborted;
    }
    if (other.isSetNosuch()) {
      Set __this__nosuch = new HashSet();
      for (Long other_element : other.nosuch) {
        __this__nosuch.add(other_element);
      }
      this.nosuch = __this__nosuch;
    }
  }

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

  @Override
  public void clear() {
    this.aborted = null;
    this.nosuch = null;
  }

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

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

  public void addToAborted(long elem) {
    if (this.aborted == null) {
      this.aborted = new HashSet();
    }
    this.aborted.add(elem);
  }

  public Set getAborted() {
    return this.aborted;
  }

  public void setAborted(Set aborted) {
    this.aborted = aborted;
  }

  public void unsetAborted() {
    this.aborted = null;
  }

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

  public void setAbortedIsSet(boolean value) {
    if (!value) {
      this.aborted = null;
    }
  }

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

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

  public void addToNosuch(long elem) {
    if (this.nosuch == null) {
      this.nosuch = new HashSet();
    }
    this.nosuch.add(elem);
  }

  public Set getNosuch() {
    return this.nosuch;
  }

  public void setNosuch(Set nosuch) {
    this.nosuch = nosuch;
  }

  public void unsetNosuch() {
    this.nosuch = null;
  }

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

  public void setNosuchIsSet(boolean value) {
    if (!value) {
      this.nosuch = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case ABORTED:
      if (value == null) {
        unsetAborted();
      } else {
        setAborted((Set)value);
      }
      break;

    case NOSUCH:
      if (value == null) {
        unsetNosuch();
      } else {
        setNosuch((Set)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case ABORTED:
      return getAborted();

    case NOSUCH:
      return getNosuch();

    }
    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 ABORTED:
      return isSetAborted();
    case NOSUCH:
      return isSetNosuch();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_aborted = true && this.isSetAborted();
    boolean that_present_aborted = true && that.isSetAborted();
    if (this_present_aborted || that_present_aborted) {
      if (!(this_present_aborted && that_present_aborted))
        return false;
      if (!this.aborted.equals(that.aborted))
        return false;
    }

    boolean this_present_nosuch = true && this.isSetNosuch();
    boolean that_present_nosuch = true && that.isSetNosuch();
    if (this_present_nosuch || that_present_nosuch) {
      if (!(this_present_nosuch && that_present_nosuch))
        return false;
      if (!this.nosuch.equals(that.nosuch))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    HashCodeBuilder builder = new HashCodeBuilder();

    boolean present_aborted = true && (isSetAborted());
    builder.append(present_aborted);
    if (present_aborted)
      builder.append(aborted);

    boolean present_nosuch = true && (isSetNosuch());
    builder.append(present_nosuch);
    if (present_nosuch)
      builder.append(nosuch);

    return builder.toHashCode();
  }

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

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

    lastComparison = Boolean.valueOf(isSetAborted()).compareTo(typedOther.isSetAborted());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAborted()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.aborted, typedOther.aborted);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetNosuch()).compareTo(typedOther.isSetNosuch());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNosuch()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nosuch, typedOther.nosuch);
      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("HeartbeatTxnRangeResponse(");
    boolean first = true;

    sb.append("aborted:");
    if (this.aborted == null) {
      sb.append("null");
    } else {
      sb.append(this.aborted);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("nosuch:");
    if (this.nosuch == null) {
      sb.append("null");
    } else {
      sb.append(this.nosuch);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (!isSetAborted()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'aborted' is unset! Struct:" + toString());
    }

    if (!isSetNosuch()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'nosuch' is unset! 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, 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 HeartbeatTxnRangeResponseStandardSchemeFactory implements SchemeFactory {
    public HeartbeatTxnRangeResponseStandardScheme getScheme() {
      return new HeartbeatTxnRangeResponseStandardScheme();
    }
  }

  private static class HeartbeatTxnRangeResponseStandardScheme extends StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, HeartbeatTxnRangeResponse 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: // ABORTED
            if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
              {
                org.apache.thrift.protocol.TSet _set468 = iprot.readSetBegin();
                struct.aborted = new HashSet(2*_set468.size);
                for (int _i469 = 0; _i469 < _set468.size; ++_i469)
                {
                  long _elem470; // optional
                  _elem470 = iprot.readI64();
                  struct.aborted.add(_elem470);
                }
                iprot.readSetEnd();
              }
              struct.setAbortedIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // NOSUCH
            if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
              {
                org.apache.thrift.protocol.TSet _set471 = iprot.readSetBegin();
                struct.nosuch = new HashSet(2*_set471.size);
                for (int _i472 = 0; _i472 < _set471.size; ++_i472)
                {
                  long _elem473; // optional
                  _elem473 = iprot.readI64();
                  struct.nosuch.add(_elem473);
                }
                iprot.readSetEnd();
              }
              struct.setNosuchIsSet(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();
      struct.validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.aborted != null) {
        oprot.writeFieldBegin(ABORTED_FIELD_DESC);
        {
          oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.I64, struct.aborted.size()));
          for (long _iter474 : struct.aborted)
          {
            oprot.writeI64(_iter474);
          }
          oprot.writeSetEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.nosuch != null) {
        oprot.writeFieldBegin(NOSUCH_FIELD_DESC);
        {
          oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.I64, struct.nosuch.size()));
          for (long _iter475 : struct.nosuch)
          {
            oprot.writeI64(_iter475);
          }
          oprot.writeSetEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class HeartbeatTxnRangeResponseTupleSchemeFactory implements SchemeFactory {
    public HeartbeatTxnRangeResponseTupleScheme getScheme() {
      return new HeartbeatTxnRangeResponseTupleScheme();
    }
  }

  private static class HeartbeatTxnRangeResponseTupleScheme extends TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, HeartbeatTxnRangeResponse struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      {
        oprot.writeI32(struct.aborted.size());
        for (long _iter476 : struct.aborted)
        {
          oprot.writeI64(_iter476);
        }
      }
      {
        oprot.writeI32(struct.nosuch.size());
        for (long _iter477 : struct.nosuch)
        {
          oprot.writeI64(_iter477);
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, HeartbeatTxnRangeResponse struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      {
        org.apache.thrift.protocol.TSet _set478 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.I64, iprot.readI32());
        struct.aborted = new HashSet(2*_set478.size);
        for (int _i479 = 0; _i479 < _set478.size; ++_i479)
        {
          long _elem480; // optional
          _elem480 = iprot.readI64();
          struct.aborted.add(_elem480);
        }
      }
      struct.setAbortedIsSet(true);
      {
        org.apache.thrift.protocol.TSet _set481 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.I64, iprot.readI32());
        struct.nosuch = new HashSet(2*_set481.size);
        for (int _i482 = 0; _i482 < _set481.size; ++_i482)
        {
          long _elem483; // optional
          _elem483 = iprot.readI64();
          struct.nosuch.add(_elem483);
        }
      }
      struct.setNosuchIsSet(true);
    }
  }

}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy