/**
 * Autogenerated by Thrift Compiler (0.9.3)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package com.facebook.buck.distributed.thrift;

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 org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
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 javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

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

  private static final org.apache.thrift.protocol.TField TOTAL_FILES_MATERIALIZED_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("totalFilesMaterializedCount", org.apache.thrift.protocol.TType.I32, (short)1);
  private static final org.apache.thrift.protocol.TField FILES_MATERIALIZED_FROM_CASCOUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("filesMaterializedFromCASCount", org.apache.thrift.protocol.TType.I32, (short)2);
  private static final org.apache.thrift.protocol.TField TOTAL_TIME_SPENT_MATERIALIZING_FILES_FROM_CASMILLIS_FIELD_DESC = new org.apache.thrift.protocol.TField("totalTimeSpentMaterializingFilesFromCASMillis", org.apache.thrift.protocol.TType.I64, (short)3);
  private static final org.apache.thrift.protocol.TField FULL_BUFFER_CAS_MULTI_FETCH_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("fullBufferCasMultiFetchCount", org.apache.thrift.protocol.TType.I32, (short)4);
  private static final org.apache.thrift.protocol.TField PERIODIC_CAS_MULTI_FETCH_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("periodicCasMultiFetchCount", org.apache.thrift.protocol.TType.I32, (short)5);
  private static final org.apache.thrift.protocol.TField TIME_SPENT_IN_MULTI_FETCH_NETWORK_CALLS_MS_FIELD_DESC = new org.apache.thrift.protocol.TField("timeSpentInMultiFetchNetworkCallsMs", org.apache.thrift.protocol.TType.I64, (short)6);

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

  public int totalFilesMaterializedCount; // optional
  public int filesMaterializedFromCASCount; // optional
  public long totalTimeSpentMaterializingFilesFromCASMillis; // optional
  public int fullBufferCasMultiFetchCount; // optional
  public int periodicCasMultiFetchCount; // optional
  public long timeSpentInMultiFetchNetworkCallsMs; // 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 {
    TOTAL_FILES_MATERIALIZED_COUNT((short)1, "totalFilesMaterializedCount"),
    FILES_MATERIALIZED_FROM_CASCOUNT((short)2, "filesMaterializedFromCASCount"),
    TOTAL_TIME_SPENT_MATERIALIZING_FILES_FROM_CASMILLIS((short)3, "totalTimeSpentMaterializingFilesFromCASMillis"),
    FULL_BUFFER_CAS_MULTI_FETCH_COUNT((short)4, "fullBufferCasMultiFetchCount"),
    PERIODIC_CAS_MULTI_FETCH_COUNT((short)5, "periodicCasMultiFetchCount"),
    TIME_SPENT_IN_MULTI_FETCH_NETWORK_CALLS_MS((short)6, "timeSpentInMultiFetchNetworkCallsMs");

    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: // TOTAL_FILES_MATERIALIZED_COUNT
          return TOTAL_FILES_MATERIALIZED_COUNT;
        case 2: // FILES_MATERIALIZED_FROM_CASCOUNT
          return FILES_MATERIALIZED_FROM_CASCOUNT;
        case 3: // TOTAL_TIME_SPENT_MATERIALIZING_FILES_FROM_CASMILLIS
          return TOTAL_TIME_SPENT_MATERIALIZING_FILES_FROM_CASMILLIS;
        case 4: // FULL_BUFFER_CAS_MULTI_FETCH_COUNT
          return FULL_BUFFER_CAS_MULTI_FETCH_COUNT;
        case 5: // PERIODIC_CAS_MULTI_FETCH_COUNT
          return PERIODIC_CAS_MULTI_FETCH_COUNT;
        case 6: // TIME_SPENT_IN_MULTI_FETCH_NETWORK_CALLS_MS
          return TIME_SPENT_IN_MULTI_FETCH_NETWORK_CALLS_MS;
        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 __TOTALFILESMATERIALIZEDCOUNT_ISSET_ID = 0;
  private static final int __FILESMATERIALIZEDFROMCASCOUNT_ISSET_ID = 1;
  private static final int __TOTALTIMESPENTMATERIALIZINGFILESFROMCASMILLIS_ISSET_ID = 2;
  private static final int __FULLBUFFERCASMULTIFETCHCOUNT_ISSET_ID = 3;
  private static final int __PERIODICCASMULTIFETCHCOUNT_ISSET_ID = 4;
  private static final int __TIMESPENTINMULTIFETCHNETWORKCALLSMS_ISSET_ID = 5;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.TOTAL_FILES_MATERIALIZED_COUNT,_Fields.FILES_MATERIALIZED_FROM_CASCOUNT,_Fields.TOTAL_TIME_SPENT_MATERIALIZING_FILES_FROM_CASMILLIS,_Fields.FULL_BUFFER_CAS_MULTI_FETCH_COUNT,_Fields.PERIODIC_CAS_MULTI_FETCH_COUNT,_Fields.TIME_SPENT_IN_MULTI_FETCH_NETWORK_CALLS_MS};
  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.TOTAL_FILES_MATERIALIZED_COUNT, new org.apache.thrift.meta_data.FieldMetaData("totalFilesMaterializedCount", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.FILES_MATERIALIZED_FROM_CASCOUNT, new org.apache.thrift.meta_data.FieldMetaData("filesMaterializedFromCASCount", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.TOTAL_TIME_SPENT_MATERIALIZING_FILES_FROM_CASMILLIS, new org.apache.thrift.meta_data.FieldMetaData("totalTimeSpentMaterializingFilesFromCASMillis", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.FULL_BUFFER_CAS_MULTI_FETCH_COUNT, new org.apache.thrift.meta_data.FieldMetaData("fullBufferCasMultiFetchCount", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.PERIODIC_CAS_MULTI_FETCH_COUNT, new org.apache.thrift.meta_data.FieldMetaData("periodicCasMultiFetchCount", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.TIME_SPENT_IN_MULTI_FETCH_NETWORK_CALLS_MS, new org.apache.thrift.meta_data.FieldMetaData("timeSpentInMultiFetchNetworkCallsMs", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(FileMaterializationStats.class, metaDataMap);
  }

  public FileMaterializationStats() {
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public FileMaterializationStats(FileMaterializationStats other) {
    __isset_bitfield = other.__isset_bitfield;
    this.totalFilesMaterializedCount = other.totalFilesMaterializedCount;
    this.filesMaterializedFromCASCount = other.filesMaterializedFromCASCount;
    this.totalTimeSpentMaterializingFilesFromCASMillis = other.totalTimeSpentMaterializingFilesFromCASMillis;
    this.fullBufferCasMultiFetchCount = other.fullBufferCasMultiFetchCount;
    this.periodicCasMultiFetchCount = other.periodicCasMultiFetchCount;
    this.timeSpentInMultiFetchNetworkCallsMs = other.timeSpentInMultiFetchNetworkCallsMs;
  }

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

  @Override
  public void clear() {
    setTotalFilesMaterializedCountIsSet(false);
    this.totalFilesMaterializedCount = 0;
    setFilesMaterializedFromCASCountIsSet(false);
    this.filesMaterializedFromCASCount = 0;
    setTotalTimeSpentMaterializingFilesFromCASMillisIsSet(false);
    this.totalTimeSpentMaterializingFilesFromCASMillis = 0;
    setFullBufferCasMultiFetchCountIsSet(false);
    this.fullBufferCasMultiFetchCount = 0;
    setPeriodicCasMultiFetchCountIsSet(false);
    this.periodicCasMultiFetchCount = 0;
    setTimeSpentInMultiFetchNetworkCallsMsIsSet(false);
    this.timeSpentInMultiFetchNetworkCallsMs = 0;
  }

  public int getTotalFilesMaterializedCount() {
    return this.totalFilesMaterializedCount;
  }

  public FileMaterializationStats setTotalFilesMaterializedCount(int totalFilesMaterializedCount) {
    this.totalFilesMaterializedCount = totalFilesMaterializedCount;
    setTotalFilesMaterializedCountIsSet(true);
    return this;
  }

  public void unsetTotalFilesMaterializedCount() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TOTALFILESMATERIALIZEDCOUNT_ISSET_ID);
  }

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

  public void setTotalFilesMaterializedCountIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TOTALFILESMATERIALIZEDCOUNT_ISSET_ID, value);
  }

  public int getFilesMaterializedFromCASCount() {
    return this.filesMaterializedFromCASCount;
  }

  public FileMaterializationStats setFilesMaterializedFromCASCount(int filesMaterializedFromCASCount) {
    this.filesMaterializedFromCASCount = filesMaterializedFromCASCount;
    setFilesMaterializedFromCASCountIsSet(true);
    return this;
  }

  public void unsetFilesMaterializedFromCASCount() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __FILESMATERIALIZEDFROMCASCOUNT_ISSET_ID);
  }

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

  public void setFilesMaterializedFromCASCountIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __FILESMATERIALIZEDFROMCASCOUNT_ISSET_ID, value);
  }

  public long getTotalTimeSpentMaterializingFilesFromCASMillis() {
    return this.totalTimeSpentMaterializingFilesFromCASMillis;
  }

  public FileMaterializationStats setTotalTimeSpentMaterializingFilesFromCASMillis(long totalTimeSpentMaterializingFilesFromCASMillis) {
    this.totalTimeSpentMaterializingFilesFromCASMillis = totalTimeSpentMaterializingFilesFromCASMillis;
    setTotalTimeSpentMaterializingFilesFromCASMillisIsSet(true);
    return this;
  }

  public void unsetTotalTimeSpentMaterializingFilesFromCASMillis() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TOTALTIMESPENTMATERIALIZINGFILESFROMCASMILLIS_ISSET_ID);
  }

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

  public void setTotalTimeSpentMaterializingFilesFromCASMillisIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TOTALTIMESPENTMATERIALIZINGFILESFROMCASMILLIS_ISSET_ID, value);
  }

  public int getFullBufferCasMultiFetchCount() {
    return this.fullBufferCasMultiFetchCount;
  }

  public FileMaterializationStats setFullBufferCasMultiFetchCount(int fullBufferCasMultiFetchCount) {
    this.fullBufferCasMultiFetchCount = fullBufferCasMultiFetchCount;
    setFullBufferCasMultiFetchCountIsSet(true);
    return this;
  }

  public void unsetFullBufferCasMultiFetchCount() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __FULLBUFFERCASMULTIFETCHCOUNT_ISSET_ID);
  }

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

  public void setFullBufferCasMultiFetchCountIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __FULLBUFFERCASMULTIFETCHCOUNT_ISSET_ID, value);
  }

  public int getPeriodicCasMultiFetchCount() {
    return this.periodicCasMultiFetchCount;
  }

  public FileMaterializationStats setPeriodicCasMultiFetchCount(int periodicCasMultiFetchCount) {
    this.periodicCasMultiFetchCount = periodicCasMultiFetchCount;
    setPeriodicCasMultiFetchCountIsSet(true);
    return this;
  }

  public void unsetPeriodicCasMultiFetchCount() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PERIODICCASMULTIFETCHCOUNT_ISSET_ID);
  }

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

  public void setPeriodicCasMultiFetchCountIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PERIODICCASMULTIFETCHCOUNT_ISSET_ID, value);
  }

  public long getTimeSpentInMultiFetchNetworkCallsMs() {
    return this.timeSpentInMultiFetchNetworkCallsMs;
  }

  public FileMaterializationStats setTimeSpentInMultiFetchNetworkCallsMs(long timeSpentInMultiFetchNetworkCallsMs) {
    this.timeSpentInMultiFetchNetworkCallsMs = timeSpentInMultiFetchNetworkCallsMs;
    setTimeSpentInMultiFetchNetworkCallsMsIsSet(true);
    return this;
  }

  public void unsetTimeSpentInMultiFetchNetworkCallsMs() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TIMESPENTINMULTIFETCHNETWORKCALLSMS_ISSET_ID);
  }

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

  public void setTimeSpentInMultiFetchNetworkCallsMsIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TIMESPENTINMULTIFETCHNETWORKCALLSMS_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case TOTAL_FILES_MATERIALIZED_COUNT:
      if (value == null) {
        unsetTotalFilesMaterializedCount();
      } else {
        setTotalFilesMaterializedCount((Integer)value);
      }
      break;

    case FILES_MATERIALIZED_FROM_CASCOUNT:
      if (value == null) {
        unsetFilesMaterializedFromCASCount();
      } else {
        setFilesMaterializedFromCASCount((Integer)value);
      }
      break;

    case TOTAL_TIME_SPENT_MATERIALIZING_FILES_FROM_CASMILLIS:
      if (value == null) {
        unsetTotalTimeSpentMaterializingFilesFromCASMillis();
      } else {
        setTotalTimeSpentMaterializingFilesFromCASMillis((Long)value);
      }
      break;

    case FULL_BUFFER_CAS_MULTI_FETCH_COUNT:
      if (value == null) {
        unsetFullBufferCasMultiFetchCount();
      } else {
        setFullBufferCasMultiFetchCount((Integer)value);
      }
      break;

    case PERIODIC_CAS_MULTI_FETCH_COUNT:
      if (value == null) {
        unsetPeriodicCasMultiFetchCount();
      } else {
        setPeriodicCasMultiFetchCount((Integer)value);
      }
      break;

    case TIME_SPENT_IN_MULTI_FETCH_NETWORK_CALLS_MS:
      if (value == null) {
        unsetTimeSpentInMultiFetchNetworkCallsMs();
      } else {
        setTimeSpentInMultiFetchNetworkCallsMs((Long)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case TOTAL_FILES_MATERIALIZED_COUNT:
      return getTotalFilesMaterializedCount();

    case FILES_MATERIALIZED_FROM_CASCOUNT:
      return getFilesMaterializedFromCASCount();

    case TOTAL_TIME_SPENT_MATERIALIZING_FILES_FROM_CASMILLIS:
      return getTotalTimeSpentMaterializingFilesFromCASMillis();

    case FULL_BUFFER_CAS_MULTI_FETCH_COUNT:
      return getFullBufferCasMultiFetchCount();

    case PERIODIC_CAS_MULTI_FETCH_COUNT:
      return getPeriodicCasMultiFetchCount();

    case TIME_SPENT_IN_MULTI_FETCH_NETWORK_CALLS_MS:
      return getTimeSpentInMultiFetchNetworkCallsMs();

    }
    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 TOTAL_FILES_MATERIALIZED_COUNT:
      return isSetTotalFilesMaterializedCount();
    case FILES_MATERIALIZED_FROM_CASCOUNT:
      return isSetFilesMaterializedFromCASCount();
    case TOTAL_TIME_SPENT_MATERIALIZING_FILES_FROM_CASMILLIS:
      return isSetTotalTimeSpentMaterializingFilesFromCASMillis();
    case FULL_BUFFER_CAS_MULTI_FETCH_COUNT:
      return isSetFullBufferCasMultiFetchCount();
    case PERIODIC_CAS_MULTI_FETCH_COUNT:
      return isSetPeriodicCasMultiFetchCount();
    case TIME_SPENT_IN_MULTI_FETCH_NETWORK_CALLS_MS:
      return isSetTimeSpentInMultiFetchNetworkCallsMs();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_totalFilesMaterializedCount = true && this.isSetTotalFilesMaterializedCount();
    boolean that_present_totalFilesMaterializedCount = true && that.isSetTotalFilesMaterializedCount();
    if (this_present_totalFilesMaterializedCount || that_present_totalFilesMaterializedCount) {
      if (!(this_present_totalFilesMaterializedCount && that_present_totalFilesMaterializedCount))
        return false;
      if (this.totalFilesMaterializedCount != that.totalFilesMaterializedCount)
        return false;
    }

    boolean this_present_filesMaterializedFromCASCount = true && this.isSetFilesMaterializedFromCASCount();
    boolean that_present_filesMaterializedFromCASCount = true && that.isSetFilesMaterializedFromCASCount();
    if (this_present_filesMaterializedFromCASCount || that_present_filesMaterializedFromCASCount) {
      if (!(this_present_filesMaterializedFromCASCount && that_present_filesMaterializedFromCASCount))
        return false;
      if (this.filesMaterializedFromCASCount != that.filesMaterializedFromCASCount)
        return false;
    }

    boolean this_present_totalTimeSpentMaterializingFilesFromCASMillis = true && this.isSetTotalTimeSpentMaterializingFilesFromCASMillis();
    boolean that_present_totalTimeSpentMaterializingFilesFromCASMillis = true && that.isSetTotalTimeSpentMaterializingFilesFromCASMillis();
    if (this_present_totalTimeSpentMaterializingFilesFromCASMillis || that_present_totalTimeSpentMaterializingFilesFromCASMillis) {
      if (!(this_present_totalTimeSpentMaterializingFilesFromCASMillis && that_present_totalTimeSpentMaterializingFilesFromCASMillis))
        return false;
      if (this.totalTimeSpentMaterializingFilesFromCASMillis != that.totalTimeSpentMaterializingFilesFromCASMillis)
        return false;
    }

    boolean this_present_fullBufferCasMultiFetchCount = true && this.isSetFullBufferCasMultiFetchCount();
    boolean that_present_fullBufferCasMultiFetchCount = true && that.isSetFullBufferCasMultiFetchCount();
    if (this_present_fullBufferCasMultiFetchCount || that_present_fullBufferCasMultiFetchCount) {
      if (!(this_present_fullBufferCasMultiFetchCount && that_present_fullBufferCasMultiFetchCount))
        return false;
      if (this.fullBufferCasMultiFetchCount != that.fullBufferCasMultiFetchCount)
        return false;
    }

    boolean this_present_periodicCasMultiFetchCount = true && this.isSetPeriodicCasMultiFetchCount();
    boolean that_present_periodicCasMultiFetchCount = true && that.isSetPeriodicCasMultiFetchCount();
    if (this_present_periodicCasMultiFetchCount || that_present_periodicCasMultiFetchCount) {
      if (!(this_present_periodicCasMultiFetchCount && that_present_periodicCasMultiFetchCount))
        return false;
      if (this.periodicCasMultiFetchCount != that.periodicCasMultiFetchCount)
        return false;
    }

    boolean this_present_timeSpentInMultiFetchNetworkCallsMs = true && this.isSetTimeSpentInMultiFetchNetworkCallsMs();
    boolean that_present_timeSpentInMultiFetchNetworkCallsMs = true && that.isSetTimeSpentInMultiFetchNetworkCallsMs();
    if (this_present_timeSpentInMultiFetchNetworkCallsMs || that_present_timeSpentInMultiFetchNetworkCallsMs) {
      if (!(this_present_timeSpentInMultiFetchNetworkCallsMs && that_present_timeSpentInMultiFetchNetworkCallsMs))
        return false;
      if (this.timeSpentInMultiFetchNetworkCallsMs != that.timeSpentInMultiFetchNetworkCallsMs)
        return false;
    }

    return true;
  }

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

    boolean present_totalFilesMaterializedCount = true && (isSetTotalFilesMaterializedCount());
    list.add(present_totalFilesMaterializedCount);
    if (present_totalFilesMaterializedCount)
      list.add(totalFilesMaterializedCount);

    boolean present_filesMaterializedFromCASCount = true && (isSetFilesMaterializedFromCASCount());
    list.add(present_filesMaterializedFromCASCount);
    if (present_filesMaterializedFromCASCount)
      list.add(filesMaterializedFromCASCount);

    boolean present_totalTimeSpentMaterializingFilesFromCASMillis = true && (isSetTotalTimeSpentMaterializingFilesFromCASMillis());
    list.add(present_totalTimeSpentMaterializingFilesFromCASMillis);
    if (present_totalTimeSpentMaterializingFilesFromCASMillis)
      list.add(totalTimeSpentMaterializingFilesFromCASMillis);

    boolean present_fullBufferCasMultiFetchCount = true && (isSetFullBufferCasMultiFetchCount());
    list.add(present_fullBufferCasMultiFetchCount);
    if (present_fullBufferCasMultiFetchCount)
      list.add(fullBufferCasMultiFetchCount);

    boolean present_periodicCasMultiFetchCount = true && (isSetPeriodicCasMultiFetchCount());
    list.add(present_periodicCasMultiFetchCount);
    if (present_periodicCasMultiFetchCount)
      list.add(periodicCasMultiFetchCount);

    boolean present_timeSpentInMultiFetchNetworkCallsMs = true && (isSetTimeSpentInMultiFetchNetworkCallsMs());
    list.add(present_timeSpentInMultiFetchNetworkCallsMs);
    if (present_timeSpentInMultiFetchNetworkCallsMs)
      list.add(timeSpentInMultiFetchNetworkCallsMs);

    return list.hashCode();
  }

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

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetTotalFilesMaterializedCount()).compareTo(other.isSetTotalFilesMaterializedCount());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTotalFilesMaterializedCount()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.totalFilesMaterializedCount, other.totalFilesMaterializedCount);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetFilesMaterializedFromCASCount()).compareTo(other.isSetFilesMaterializedFromCASCount());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFilesMaterializedFromCASCount()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.filesMaterializedFromCASCount, other.filesMaterializedFromCASCount);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTotalTimeSpentMaterializingFilesFromCASMillis()).compareTo(other.isSetTotalTimeSpentMaterializingFilesFromCASMillis());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTotalTimeSpentMaterializingFilesFromCASMillis()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.totalTimeSpentMaterializingFilesFromCASMillis, other.totalTimeSpentMaterializingFilesFromCASMillis);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetFullBufferCasMultiFetchCount()).compareTo(other.isSetFullBufferCasMultiFetchCount());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFullBufferCasMultiFetchCount()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fullBufferCasMultiFetchCount, other.fullBufferCasMultiFetchCount);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetPeriodicCasMultiFetchCount()).compareTo(other.isSetPeriodicCasMultiFetchCount());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPeriodicCasMultiFetchCount()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.periodicCasMultiFetchCount, other.periodicCasMultiFetchCount);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTimeSpentInMultiFetchNetworkCallsMs()).compareTo(other.isSetTimeSpentInMultiFetchNetworkCallsMs());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTimeSpentInMultiFetchNetworkCallsMs()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timeSpentInMultiFetchNetworkCallsMs, other.timeSpentInMultiFetchNetworkCallsMs);
      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("FileMaterializationStats(");
    boolean first = true;

    if (isSetTotalFilesMaterializedCount()) {
      sb.append("totalFilesMaterializedCount:");
      sb.append(this.totalFilesMaterializedCount);
      first = false;
    }
    if (isSetFilesMaterializedFromCASCount()) {
      if (!first) sb.append(", ");
      sb.append("filesMaterializedFromCASCount:");
      sb.append(this.filesMaterializedFromCASCount);
      first = false;
    }
    if (isSetTotalTimeSpentMaterializingFilesFromCASMillis()) {
      if (!first) sb.append(", ");
      sb.append("totalTimeSpentMaterializingFilesFromCASMillis:");
      sb.append(this.totalTimeSpentMaterializingFilesFromCASMillis);
      first = false;
    }
    if (isSetFullBufferCasMultiFetchCount()) {
      if (!first) sb.append(", ");
      sb.append("fullBufferCasMultiFetchCount:");
      sb.append(this.fullBufferCasMultiFetchCount);
      first = false;
    }
    if (isSetPeriodicCasMultiFetchCount()) {
      if (!first) sb.append(", ");
      sb.append("periodicCasMultiFetchCount:");
      sb.append(this.periodicCasMultiFetchCount);
      first = false;
    }
    if (isSetTimeSpentInMultiFetchNetworkCallsMs()) {
      if (!first) sb.append(", ");
      sb.append("timeSpentInMultiFetchNetworkCallsMs:");
      sb.append(this.timeSpentInMultiFetchNetworkCallsMs);
      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 FileMaterializationStatsStandardSchemeFactory implements SchemeFactory {
    public FileMaterializationStatsStandardScheme getScheme() {
      return new FileMaterializationStatsStandardScheme();
    }
  }

  private static class FileMaterializationStatsStandardScheme extends StandardScheme<FileMaterializationStats> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, FileMaterializationStats 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: // TOTAL_FILES_MATERIALIZED_COUNT
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.totalFilesMaterializedCount = iprot.readI32();
              struct.setTotalFilesMaterializedCountIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // FILES_MATERIALIZED_FROM_CASCOUNT
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.filesMaterializedFromCASCount = iprot.readI32();
              struct.setFilesMaterializedFromCASCountIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // TOTAL_TIME_SPENT_MATERIALIZING_FILES_FROM_CASMILLIS
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.totalTimeSpentMaterializingFilesFromCASMillis = iprot.readI64();
              struct.setTotalTimeSpentMaterializingFilesFromCASMillisIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // FULL_BUFFER_CAS_MULTI_FETCH_COUNT
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.fullBufferCasMultiFetchCount = iprot.readI32();
              struct.setFullBufferCasMultiFetchCountIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // PERIODIC_CAS_MULTI_FETCH_COUNT
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.periodicCasMultiFetchCount = iprot.readI32();
              struct.setPeriodicCasMultiFetchCountIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // TIME_SPENT_IN_MULTI_FETCH_NETWORK_CALLS_MS
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.timeSpentInMultiFetchNetworkCallsMs = iprot.readI64();
              struct.setTimeSpentInMultiFetchNetworkCallsMsIsSet(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, FileMaterializationStats struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.isSetTotalFilesMaterializedCount()) {
        oprot.writeFieldBegin(TOTAL_FILES_MATERIALIZED_COUNT_FIELD_DESC);
        oprot.writeI32(struct.totalFilesMaterializedCount);
        oprot.writeFieldEnd();
      }
      if (struct.isSetFilesMaterializedFromCASCount()) {
        oprot.writeFieldBegin(FILES_MATERIALIZED_FROM_CASCOUNT_FIELD_DESC);
        oprot.writeI32(struct.filesMaterializedFromCASCount);
        oprot.writeFieldEnd();
      }
      if (struct.isSetTotalTimeSpentMaterializingFilesFromCASMillis()) {
        oprot.writeFieldBegin(TOTAL_TIME_SPENT_MATERIALIZING_FILES_FROM_CASMILLIS_FIELD_DESC);
        oprot.writeI64(struct.totalTimeSpentMaterializingFilesFromCASMillis);
        oprot.writeFieldEnd();
      }
      if (struct.isSetFullBufferCasMultiFetchCount()) {
        oprot.writeFieldBegin(FULL_BUFFER_CAS_MULTI_FETCH_COUNT_FIELD_DESC);
        oprot.writeI32(struct.fullBufferCasMultiFetchCount);
        oprot.writeFieldEnd();
      }
      if (struct.isSetPeriodicCasMultiFetchCount()) {
        oprot.writeFieldBegin(PERIODIC_CAS_MULTI_FETCH_COUNT_FIELD_DESC);
        oprot.writeI32(struct.periodicCasMultiFetchCount);
        oprot.writeFieldEnd();
      }
      if (struct.isSetTimeSpentInMultiFetchNetworkCallsMs()) {
        oprot.writeFieldBegin(TIME_SPENT_IN_MULTI_FETCH_NETWORK_CALLS_MS_FIELD_DESC);
        oprot.writeI64(struct.timeSpentInMultiFetchNetworkCallsMs);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class FileMaterializationStatsTupleSchemeFactory implements SchemeFactory {
    public FileMaterializationStatsTupleScheme getScheme() {
      return new FileMaterializationStatsTupleScheme();
    }
  }

  private static class FileMaterializationStatsTupleScheme extends TupleScheme<FileMaterializationStats> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, FileMaterializationStats struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetTotalFilesMaterializedCount()) {
        optionals.set(0);
      }
      if (struct.isSetFilesMaterializedFromCASCount()) {
        optionals.set(1);
      }
      if (struct.isSetTotalTimeSpentMaterializingFilesFromCASMillis()) {
        optionals.set(2);
      }
      if (struct.isSetFullBufferCasMultiFetchCount()) {
        optionals.set(3);
      }
      if (struct.isSetPeriodicCasMultiFetchCount()) {
        optionals.set(4);
      }
      if (struct.isSetTimeSpentInMultiFetchNetworkCallsMs()) {
        optionals.set(5);
      }
      oprot.writeBitSet(optionals, 6);
      if (struct.isSetTotalFilesMaterializedCount()) {
        oprot.writeI32(struct.totalFilesMaterializedCount);
      }
      if (struct.isSetFilesMaterializedFromCASCount()) {
        oprot.writeI32(struct.filesMaterializedFromCASCount);
      }
      if (struct.isSetTotalTimeSpentMaterializingFilesFromCASMillis()) {
        oprot.writeI64(struct.totalTimeSpentMaterializingFilesFromCASMillis);
      }
      if (struct.isSetFullBufferCasMultiFetchCount()) {
        oprot.writeI32(struct.fullBufferCasMultiFetchCount);
      }
      if (struct.isSetPeriodicCasMultiFetchCount()) {
        oprot.writeI32(struct.periodicCasMultiFetchCount);
      }
      if (struct.isSetTimeSpentInMultiFetchNetworkCallsMs()) {
        oprot.writeI64(struct.timeSpentInMultiFetchNetworkCallsMs);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, FileMaterializationStats struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(6);
      if (incoming.get(0)) {
        struct.totalFilesMaterializedCount = iprot.readI32();
        struct.setTotalFilesMaterializedCountIsSet(true);
      }
      if (incoming.get(1)) {
        struct.filesMaterializedFromCASCount = iprot.readI32();
        struct.setFilesMaterializedFromCASCountIsSet(true);
      }
      if (incoming.get(2)) {
        struct.totalTimeSpentMaterializingFilesFromCASMillis = iprot.readI64();
        struct.setTotalTimeSpentMaterializingFilesFromCASMillisIsSet(true);
      }
      if (incoming.get(3)) {
        struct.fullBufferCasMultiFetchCount = iprot.readI32();
        struct.setFullBufferCasMultiFetchCountIsSet(true);
      }
      if (incoming.get(4)) {
        struct.periodicCasMultiFetchCount = iprot.readI32();
        struct.setPeriodicCasMultiFetchCountIsSet(true);
      }
      if (incoming.get(5)) {
        struct.timeSpentInMultiFetchNetworkCallsMs = iprot.readI64();
        struct.setTimeSpentInMultiFetchNetworkCallsMsIsSet(true);
      }
    }
  }

}

