/**
 * 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.hbase.thrift.generated;

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;

/**
 * An HColumnDescriptor contains information about a column family
 * such as the number of versions, compression settings, etc. It is
 * used as input when creating a table or adding a column.
 */
public class ColumnDescriptor implements org.apache.thrift.TBase<ColumnDescriptor, ColumnDescriptor._Fields>, java.io.Serializable, Cloneable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ColumnDescriptor");

  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 MAX_VERSIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("maxVersions", org.apache.thrift.protocol.TType.I32, (short)2);
  private static final org.apache.thrift.protocol.TField COMPRESSION_FIELD_DESC = new org.apache.thrift.protocol.TField("compression", org.apache.thrift.protocol.TType.STRING, (short)3);
  private static final org.apache.thrift.protocol.TField IN_MEMORY_FIELD_DESC = new org.apache.thrift.protocol.TField("inMemory", org.apache.thrift.protocol.TType.BOOL, (short)4);
  private static final org.apache.thrift.protocol.TField BLOOM_FILTER_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("bloomFilterType", org.apache.thrift.protocol.TType.STRING, (short)5);
  private static final org.apache.thrift.protocol.TField BLOOM_FILTER_VECTOR_SIZE_FIELD_DESC = new org.apache.thrift.protocol.TField("bloomFilterVectorSize", org.apache.thrift.protocol.TType.I32, (short)6);
  private static final org.apache.thrift.protocol.TField BLOOM_FILTER_NB_HASHES_FIELD_DESC = new org.apache.thrift.protocol.TField("bloomFilterNbHashes", org.apache.thrift.protocol.TType.I32, (short)7);
  private static final org.apache.thrift.protocol.TField BLOCK_CACHE_ENABLED_FIELD_DESC = new org.apache.thrift.protocol.TField("blockCacheEnabled", org.apache.thrift.protocol.TType.BOOL, (short)8);
  private static final org.apache.thrift.protocol.TField TIME_TO_LIVE_FIELD_DESC = new org.apache.thrift.protocol.TField("timeToLive", org.apache.thrift.protocol.TType.I32, (short)9);

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

  public ByteBuffer name; // required
  public int maxVersions; // required
  public String compression; // required
  public boolean inMemory; // required
  public String bloomFilterType; // required
  public int bloomFilterVectorSize; // required
  public int bloomFilterNbHashes; // required
  public boolean blockCacheEnabled; // required
  public int timeToLive; // 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 {
    NAME((short)1, "name"),
    MAX_VERSIONS((short)2, "maxVersions"),
    COMPRESSION((short)3, "compression"),
    IN_MEMORY((short)4, "inMemory"),
    BLOOM_FILTER_TYPE((short)5, "bloomFilterType"),
    BLOOM_FILTER_VECTOR_SIZE((short)6, "bloomFilterVectorSize"),
    BLOOM_FILTER_NB_HASHES((short)7, "bloomFilterNbHashes"),
    BLOCK_CACHE_ENABLED((short)8, "blockCacheEnabled"),
    TIME_TO_LIVE((short)9, "timeToLive");

    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: // NAME
          return NAME;
        case 2: // MAX_VERSIONS
          return MAX_VERSIONS;
        case 3: // COMPRESSION
          return COMPRESSION;
        case 4: // IN_MEMORY
          return IN_MEMORY;
        case 5: // BLOOM_FILTER_TYPE
          return BLOOM_FILTER_TYPE;
        case 6: // BLOOM_FILTER_VECTOR_SIZE
          return BLOOM_FILTER_VECTOR_SIZE;
        case 7: // BLOOM_FILTER_NB_HASHES
          return BLOOM_FILTER_NB_HASHES;
        case 8: // BLOCK_CACHE_ENABLED
          return BLOCK_CACHE_ENABLED;
        case 9: // TIME_TO_LIVE
          return TIME_TO_LIVE;
        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 __MAXVERSIONS_ISSET_ID = 0;
  private static final int __INMEMORY_ISSET_ID = 1;
  private static final int __BLOOMFILTERVECTORSIZE_ISSET_ID = 2;
  private static final int __BLOOMFILTERNBHASHES_ISSET_ID = 3;
  private static final int __BLOCKCACHEENABLED_ISSET_ID = 4;
  private static final int __TIMETOLIVE_ISSET_ID = 5;
  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.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , "Text")));
    tmpMap.put(_Fields.MAX_VERSIONS, new org.apache.thrift.meta_data.FieldMetaData("maxVersions", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.COMPRESSION, new org.apache.thrift.meta_data.FieldMetaData("compression", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.IN_MEMORY, new org.apache.thrift.meta_data.FieldMetaData("inMemory", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.BLOOM_FILTER_TYPE, new org.apache.thrift.meta_data.FieldMetaData("bloomFilterType", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.BLOOM_FILTER_VECTOR_SIZE, new org.apache.thrift.meta_data.FieldMetaData("bloomFilterVectorSize", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.BLOOM_FILTER_NB_HASHES, new org.apache.thrift.meta_data.FieldMetaData("bloomFilterNbHashes", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.BLOCK_CACHE_ENABLED, new org.apache.thrift.meta_data.FieldMetaData("blockCacheEnabled", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.TIME_TO_LIVE, new org.apache.thrift.meta_data.FieldMetaData("timeToLive", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ColumnDescriptor.class, metaDataMap);
  }

  public ColumnDescriptor() {
    this.maxVersions = 3;

    this.compression = "NONE";

    this.inMemory = false;

    this.bloomFilterType = "NONE";

    this.bloomFilterVectorSize = 0;

    this.bloomFilterNbHashes = 0;

    this.blockCacheEnabled = false;

    this.timeToLive = -1;

  }

  public ColumnDescriptor(
    ByteBuffer name,
    int maxVersions,
    String compression,
    boolean inMemory,
    String bloomFilterType,
    int bloomFilterVectorSize,
    int bloomFilterNbHashes,
    boolean blockCacheEnabled,
    int timeToLive)
  {
    this();
    this.name = name;
    this.maxVersions = maxVersions;
    setMaxVersionsIsSet(true);
    this.compression = compression;
    this.inMemory = inMemory;
    setInMemoryIsSet(true);
    this.bloomFilterType = bloomFilterType;
    this.bloomFilterVectorSize = bloomFilterVectorSize;
    setBloomFilterVectorSizeIsSet(true);
    this.bloomFilterNbHashes = bloomFilterNbHashes;
    setBloomFilterNbHashesIsSet(true);
    this.blockCacheEnabled = blockCacheEnabled;
    setBlockCacheEnabledIsSet(true);
    this.timeToLive = timeToLive;
    setTimeToLiveIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public ColumnDescriptor(ColumnDescriptor other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetName()) {
      this.name = other.name;
    }
    this.maxVersions = other.maxVersions;
    if (other.isSetCompression()) {
      this.compression = other.compression;
    }
    this.inMemory = other.inMemory;
    if (other.isSetBloomFilterType()) {
      this.bloomFilterType = other.bloomFilterType;
    }
    this.bloomFilterVectorSize = other.bloomFilterVectorSize;
    this.bloomFilterNbHashes = other.bloomFilterNbHashes;
    this.blockCacheEnabled = other.blockCacheEnabled;
    this.timeToLive = other.timeToLive;
  }

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

  @Override
  public void clear() {
    this.name = null;
    this.maxVersions = 3;

    this.compression = "NONE";

    this.inMemory = false;

    this.bloomFilterType = "NONE";

    this.bloomFilterVectorSize = 0;

    this.bloomFilterNbHashes = 0;

    this.blockCacheEnabled = false;

    this.timeToLive = -1;

  }

  public byte[] getName() {
    setName(org.apache.thrift.TBaseHelper.rightSize(name));
    return name == null ? null : name.array();
  }

  public ByteBuffer bufferForName() {
    return name;
  }

  public ColumnDescriptor setName(byte[] name) {
    setName(name == null ? (ByteBuffer)null : ByteBuffer.wrap(name));
    return this;
  }

  public ColumnDescriptor setName(ByteBuffer 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 getMaxVersions() {
    return this.maxVersions;
  }

  public ColumnDescriptor setMaxVersions(int maxVersions) {
    this.maxVersions = maxVersions;
    setMaxVersionsIsSet(true);
    return this;
  }

  public void unsetMaxVersions() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __MAXVERSIONS_ISSET_ID);
  }

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

  public void setMaxVersionsIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __MAXVERSIONS_ISSET_ID, value);
  }

  public String getCompression() {
    return this.compression;
  }

  public ColumnDescriptor setCompression(String compression) {
    this.compression = compression;
    return this;
  }

  public void unsetCompression() {
    this.compression = null;
  }

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

  public void setCompressionIsSet(boolean value) {
    if (!value) {
      this.compression = null;
    }
  }

  public boolean isInMemory() {
    return this.inMemory;
  }

  public ColumnDescriptor setInMemory(boolean inMemory) {
    this.inMemory = inMemory;
    setInMemoryIsSet(true);
    return this;
  }

  public void unsetInMemory() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __INMEMORY_ISSET_ID);
  }

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

  public void setInMemoryIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __INMEMORY_ISSET_ID, value);
  }

  public String getBloomFilterType() {
    return this.bloomFilterType;
  }

  public ColumnDescriptor setBloomFilterType(String bloomFilterType) {
    this.bloomFilterType = bloomFilterType;
    return this;
  }

  public void unsetBloomFilterType() {
    this.bloomFilterType = null;
  }

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

  public void setBloomFilterTypeIsSet(boolean value) {
    if (!value) {
      this.bloomFilterType = null;
    }
  }

  public int getBloomFilterVectorSize() {
    return this.bloomFilterVectorSize;
  }

  public ColumnDescriptor setBloomFilterVectorSize(int bloomFilterVectorSize) {
    this.bloomFilterVectorSize = bloomFilterVectorSize;
    setBloomFilterVectorSizeIsSet(true);
    return this;
  }

  public void unsetBloomFilterVectorSize() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __BLOOMFILTERVECTORSIZE_ISSET_ID);
  }

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

  public void setBloomFilterVectorSizeIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __BLOOMFILTERVECTORSIZE_ISSET_ID, value);
  }

  public int getBloomFilterNbHashes() {
    return this.bloomFilterNbHashes;
  }

  public ColumnDescriptor setBloomFilterNbHashes(int bloomFilterNbHashes) {
    this.bloomFilterNbHashes = bloomFilterNbHashes;
    setBloomFilterNbHashesIsSet(true);
    return this;
  }

  public void unsetBloomFilterNbHashes() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __BLOOMFILTERNBHASHES_ISSET_ID);
  }

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

  public void setBloomFilterNbHashesIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __BLOOMFILTERNBHASHES_ISSET_ID, value);
  }

  public boolean isBlockCacheEnabled() {
    return this.blockCacheEnabled;
  }

  public ColumnDescriptor setBlockCacheEnabled(boolean blockCacheEnabled) {
    this.blockCacheEnabled = blockCacheEnabled;
    setBlockCacheEnabledIsSet(true);
    return this;
  }

  public void unsetBlockCacheEnabled() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __BLOCKCACHEENABLED_ISSET_ID);
  }

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

  public void setBlockCacheEnabledIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __BLOCKCACHEENABLED_ISSET_ID, value);
  }

  public int getTimeToLive() {
    return this.timeToLive;
  }

  public ColumnDescriptor setTimeToLive(int timeToLive) {
    this.timeToLive = timeToLive;
    setTimeToLiveIsSet(true);
    return this;
  }

  public void unsetTimeToLive() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TIMETOLIVE_ISSET_ID);
  }

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

  public void setTimeToLiveIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TIMETOLIVE_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case NAME:
      if (value == null) {
        unsetName();
      } else {
        setName((ByteBuffer)value);
      }
      break;

    case MAX_VERSIONS:
      if (value == null) {
        unsetMaxVersions();
      } else {
        setMaxVersions((Integer)value);
      }
      break;

    case COMPRESSION:
      if (value == null) {
        unsetCompression();
      } else {
        setCompression((String)value);
      }
      break;

    case IN_MEMORY:
      if (value == null) {
        unsetInMemory();
      } else {
        setInMemory((Boolean)value);
      }
      break;

    case BLOOM_FILTER_TYPE:
      if (value == null) {
        unsetBloomFilterType();
      } else {
        setBloomFilterType((String)value);
      }
      break;

    case BLOOM_FILTER_VECTOR_SIZE:
      if (value == null) {
        unsetBloomFilterVectorSize();
      } else {
        setBloomFilterVectorSize((Integer)value);
      }
      break;

    case BLOOM_FILTER_NB_HASHES:
      if (value == null) {
        unsetBloomFilterNbHashes();
      } else {
        setBloomFilterNbHashes((Integer)value);
      }
      break;

    case BLOCK_CACHE_ENABLED:
      if (value == null) {
        unsetBlockCacheEnabled();
      } else {
        setBlockCacheEnabled((Boolean)value);
      }
      break;

    case TIME_TO_LIVE:
      if (value == null) {
        unsetTimeToLive();
      } else {
        setTimeToLive((Integer)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case NAME:
      return getName();

    case MAX_VERSIONS:
      return Integer.valueOf(getMaxVersions());

    case COMPRESSION:
      return getCompression();

    case IN_MEMORY:
      return Boolean.valueOf(isInMemory());

    case BLOOM_FILTER_TYPE:
      return getBloomFilterType();

    case BLOOM_FILTER_VECTOR_SIZE:
      return Integer.valueOf(getBloomFilterVectorSize());

    case BLOOM_FILTER_NB_HASHES:
      return Integer.valueOf(getBloomFilterNbHashes());

    case BLOCK_CACHE_ENABLED:
      return Boolean.valueOf(isBlockCacheEnabled());

    case TIME_TO_LIVE:
      return Integer.valueOf(getTimeToLive());

    }
    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 NAME:
      return isSetName();
    case MAX_VERSIONS:
      return isSetMaxVersions();
    case COMPRESSION:
      return isSetCompression();
    case IN_MEMORY:
      return isSetInMemory();
    case BLOOM_FILTER_TYPE:
      return isSetBloomFilterType();
    case BLOOM_FILTER_VECTOR_SIZE:
      return isSetBloomFilterVectorSize();
    case BLOOM_FILTER_NB_HASHES:
      return isSetBloomFilterNbHashes();
    case BLOCK_CACHE_ENABLED:
      return isSetBlockCacheEnabled();
    case TIME_TO_LIVE:
      return isSetTimeToLive();
    }
    throw new IllegalStateException();
  }

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

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

    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_maxVersions = true;
    boolean that_present_maxVersions = true;
    if (this_present_maxVersions || that_present_maxVersions) {
      if (!(this_present_maxVersions && that_present_maxVersions))
        return false;
      if (this.maxVersions != that.maxVersions)
        return false;
    }

    boolean this_present_compression = true && this.isSetCompression();
    boolean that_present_compression = true && that.isSetCompression();
    if (this_present_compression || that_present_compression) {
      if (!(this_present_compression && that_present_compression))
        return false;
      if (!this.compression.equals(that.compression))
        return false;
    }

    boolean this_present_inMemory = true;
    boolean that_present_inMemory = true;
    if (this_present_inMemory || that_present_inMemory) {
      if (!(this_present_inMemory && that_present_inMemory))
        return false;
      if (this.inMemory != that.inMemory)
        return false;
    }

    boolean this_present_bloomFilterType = true && this.isSetBloomFilterType();
    boolean that_present_bloomFilterType = true && that.isSetBloomFilterType();
    if (this_present_bloomFilterType || that_present_bloomFilterType) {
      if (!(this_present_bloomFilterType && that_present_bloomFilterType))
        return false;
      if (!this.bloomFilterType.equals(that.bloomFilterType))
        return false;
    }

    boolean this_present_bloomFilterVectorSize = true;
    boolean that_present_bloomFilterVectorSize = true;
    if (this_present_bloomFilterVectorSize || that_present_bloomFilterVectorSize) {
      if (!(this_present_bloomFilterVectorSize && that_present_bloomFilterVectorSize))
        return false;
      if (this.bloomFilterVectorSize != that.bloomFilterVectorSize)
        return false;
    }

    boolean this_present_bloomFilterNbHashes = true;
    boolean that_present_bloomFilterNbHashes = true;
    if (this_present_bloomFilterNbHashes || that_present_bloomFilterNbHashes) {
      if (!(this_present_bloomFilterNbHashes && that_present_bloomFilterNbHashes))
        return false;
      if (this.bloomFilterNbHashes != that.bloomFilterNbHashes)
        return false;
    }

    boolean this_present_blockCacheEnabled = true;
    boolean that_present_blockCacheEnabled = true;
    if (this_present_blockCacheEnabled || that_present_blockCacheEnabled) {
      if (!(this_present_blockCacheEnabled && that_present_blockCacheEnabled))
        return false;
      if (this.blockCacheEnabled != that.blockCacheEnabled)
        return false;
    }

    boolean this_present_timeToLive = true;
    boolean that_present_timeToLive = true;
    if (this_present_timeToLive || that_present_timeToLive) {
      if (!(this_present_timeToLive && that_present_timeToLive))
        return false;
      if (this.timeToLive != that.timeToLive)
        return false;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetName()).compareTo(typedOther.isSetName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetName()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, typedOther.name);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetMaxVersions()).compareTo(typedOther.isSetMaxVersions());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMaxVersions()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.maxVersions, typedOther.maxVersions);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCompression()).compareTo(typedOther.isSetCompression());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCompression()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.compression, typedOther.compression);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetInMemory()).compareTo(typedOther.isSetInMemory());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetInMemory()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.inMemory, typedOther.inMemory);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetBloomFilterType()).compareTo(typedOther.isSetBloomFilterType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBloomFilterType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.bloomFilterType, typedOther.bloomFilterType);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetBloomFilterVectorSize()).compareTo(typedOther.isSetBloomFilterVectorSize());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBloomFilterVectorSize()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.bloomFilterVectorSize, typedOther.bloomFilterVectorSize);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetBloomFilterNbHashes()).compareTo(typedOther.isSetBloomFilterNbHashes());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBloomFilterNbHashes()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.bloomFilterNbHashes, typedOther.bloomFilterNbHashes);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetBlockCacheEnabled()).compareTo(typedOther.isSetBlockCacheEnabled());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBlockCacheEnabled()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.blockCacheEnabled, typedOther.blockCacheEnabled);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTimeToLive()).compareTo(typedOther.isSetTimeToLive());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTimeToLive()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timeToLive, typedOther.timeToLive);
      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("ColumnDescriptor(");
    boolean first = true;

    sb.append("name:");
    if (this.name == null) {
      sb.append("null");
    } else {
      sb.append(this.name);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("maxVersions:");
    sb.append(this.maxVersions);
    first = false;
    if (!first) sb.append(", ");
    sb.append("compression:");
    if (this.compression == null) {
      sb.append("null");
    } else {
      sb.append(this.compression);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("inMemory:");
    sb.append(this.inMemory);
    first = false;
    if (!first) sb.append(", ");
    sb.append("bloomFilterType:");
    if (this.bloomFilterType == null) {
      sb.append("null");
    } else {
      sb.append(this.bloomFilterType);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("bloomFilterVectorSize:");
    sb.append(this.bloomFilterVectorSize);
    first = false;
    if (!first) sb.append(", ");
    sb.append("bloomFilterNbHashes:");
    sb.append(this.bloomFilterNbHashes);
    first = false;
    if (!first) sb.append(", ");
    sb.append("blockCacheEnabled:");
    sb.append(this.blockCacheEnabled);
    first = false;
    if (!first) sb.append(", ");
    sb.append("timeToLive:");
    sb.append(this.timeToLive);
    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 ColumnDescriptorStandardSchemeFactory implements SchemeFactory {
    public ColumnDescriptorStandardScheme getScheme() {
      return new ColumnDescriptorStandardScheme();
    }
  }

  private static class ColumnDescriptorStandardScheme extends StandardScheme<ColumnDescriptor> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, ColumnDescriptor 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.readBinary();
              struct.setNameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // MAX_VERSIONS
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.maxVersions = iprot.readI32();
              struct.setMaxVersionsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // COMPRESSION
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.compression = iprot.readString();
              struct.setCompressionIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // IN_MEMORY
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.inMemory = iprot.readBool();
              struct.setInMemoryIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // BLOOM_FILTER_TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.bloomFilterType = iprot.readString();
              struct.setBloomFilterTypeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // BLOOM_FILTER_VECTOR_SIZE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.bloomFilterVectorSize = iprot.readI32();
              struct.setBloomFilterVectorSizeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // BLOOM_FILTER_NB_HASHES
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.bloomFilterNbHashes = iprot.readI32();
              struct.setBloomFilterNbHashesIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // BLOCK_CACHE_ENABLED
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.blockCacheEnabled = iprot.readBool();
              struct.setBlockCacheEnabledIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 9: // TIME_TO_LIVE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.timeToLive = iprot.readI32();
              struct.setTimeToLiveIsSet(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, ColumnDescriptor struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.name != null) {
        oprot.writeFieldBegin(NAME_FIELD_DESC);
        oprot.writeBinary(struct.name);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(MAX_VERSIONS_FIELD_DESC);
      oprot.writeI32(struct.maxVersions);
      oprot.writeFieldEnd();
      if (struct.compression != null) {
        oprot.writeFieldBegin(COMPRESSION_FIELD_DESC);
        oprot.writeString(struct.compression);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(IN_MEMORY_FIELD_DESC);
      oprot.writeBool(struct.inMemory);
      oprot.writeFieldEnd();
      if (struct.bloomFilterType != null) {
        oprot.writeFieldBegin(BLOOM_FILTER_TYPE_FIELD_DESC);
        oprot.writeString(struct.bloomFilterType);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(BLOOM_FILTER_VECTOR_SIZE_FIELD_DESC);
      oprot.writeI32(struct.bloomFilterVectorSize);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(BLOOM_FILTER_NB_HASHES_FIELD_DESC);
      oprot.writeI32(struct.bloomFilterNbHashes);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(BLOCK_CACHE_ENABLED_FIELD_DESC);
      oprot.writeBool(struct.blockCacheEnabled);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(TIME_TO_LIVE_FIELD_DESC);
      oprot.writeI32(struct.timeToLive);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class ColumnDescriptorTupleSchemeFactory implements SchemeFactory {
    public ColumnDescriptorTupleScheme getScheme() {
      return new ColumnDescriptorTupleScheme();
    }
  }

  private static class ColumnDescriptorTupleScheme extends TupleScheme<ColumnDescriptor> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, ColumnDescriptor struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetName()) {
        optionals.set(0);
      }
      if (struct.isSetMaxVersions()) {
        optionals.set(1);
      }
      if (struct.isSetCompression()) {
        optionals.set(2);
      }
      if (struct.isSetInMemory()) {
        optionals.set(3);
      }
      if (struct.isSetBloomFilterType()) {
        optionals.set(4);
      }
      if (struct.isSetBloomFilterVectorSize()) {
        optionals.set(5);
      }
      if (struct.isSetBloomFilterNbHashes()) {
        optionals.set(6);
      }
      if (struct.isSetBlockCacheEnabled()) {
        optionals.set(7);
      }
      if (struct.isSetTimeToLive()) {
        optionals.set(8);
      }
      oprot.writeBitSet(optionals, 9);
      if (struct.isSetName()) {
        oprot.writeBinary(struct.name);
      }
      if (struct.isSetMaxVersions()) {
        oprot.writeI32(struct.maxVersions);
      }
      if (struct.isSetCompression()) {
        oprot.writeString(struct.compression);
      }
      if (struct.isSetInMemory()) {
        oprot.writeBool(struct.inMemory);
      }
      if (struct.isSetBloomFilterType()) {
        oprot.writeString(struct.bloomFilterType);
      }
      if (struct.isSetBloomFilterVectorSize()) {
        oprot.writeI32(struct.bloomFilterVectorSize);
      }
      if (struct.isSetBloomFilterNbHashes()) {
        oprot.writeI32(struct.bloomFilterNbHashes);
      }
      if (struct.isSetBlockCacheEnabled()) {
        oprot.writeBool(struct.blockCacheEnabled);
      }
      if (struct.isSetTimeToLive()) {
        oprot.writeI32(struct.timeToLive);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, ColumnDescriptor struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(9);
      if (incoming.get(0)) {
        struct.name = iprot.readBinary();
        struct.setNameIsSet(true);
      }
      if (incoming.get(1)) {
        struct.maxVersions = iprot.readI32();
        struct.setMaxVersionsIsSet(true);
      }
      if (incoming.get(2)) {
        struct.compression = iprot.readString();
        struct.setCompressionIsSet(true);
      }
      if (incoming.get(3)) {
        struct.inMemory = iprot.readBool();
        struct.setInMemoryIsSet(true);
      }
      if (incoming.get(4)) {
        struct.bloomFilterType = iprot.readString();
        struct.setBloomFilterTypeIsSet(true);
      }
      if (incoming.get(5)) {
        struct.bloomFilterVectorSize = iprot.readI32();
        struct.setBloomFilterVectorSizeIsSet(true);
      }
      if (incoming.get(6)) {
        struct.bloomFilterNbHashes = iprot.readI32();
        struct.setBloomFilterNbHashesIsSet(true);
      }
      if (incoming.get(7)) {
        struct.blockCacheEnabled = iprot.readBool();
        struct.setBlockCacheEnabledIsSet(true);
      }
      if (incoming.get(8)) {
        struct.timeToLive = iprot.readI32();
        struct.setTimeToLiveIsSet(true);
      }
    }
  }

}

