/**
 * 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.thriftfs.api;

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;

/**
 * Information that mirrors the "health report" information available on the
 * NameNode web UI
 */
public class DFSHealthReport implements org.apache.thrift.TBase<DFSHealthReport, DFSHealthReport._Fields>, java.io.Serializable, Cloneable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("DFSHealthReport");

  private static final org.apache.thrift.protocol.TField BYTES_TOTAL_FIELD_DESC = new org.apache.thrift.protocol.TField("bytesTotal", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField BYTES_USED_FIELD_DESC = new org.apache.thrift.protocol.TField("bytesUsed", org.apache.thrift.protocol.TType.I64, (short)2);
  private static final org.apache.thrift.protocol.TField BYTES_REMAINING_FIELD_DESC = new org.apache.thrift.protocol.TField("bytesRemaining", org.apache.thrift.protocol.TType.I64, (short)3);
  private static final org.apache.thrift.protocol.TField BYTES_NON_DFS_FIELD_DESC = new org.apache.thrift.protocol.TField("bytesNonDfs", org.apache.thrift.protocol.TType.I64, (short)4);
  private static final org.apache.thrift.protocol.TField NUM_LIVE_DATA_NODES_FIELD_DESC = new org.apache.thrift.protocol.TField("numLiveDataNodes", org.apache.thrift.protocol.TType.I32, (short)5);
  private static final org.apache.thrift.protocol.TField NUM_DEAD_DATA_NODES_FIELD_DESC = new org.apache.thrift.protocol.TField("numDeadDataNodes", org.apache.thrift.protocol.TType.I32, (short)6);
  private static final org.apache.thrift.protocol.TField UPGRADE_STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("upgradeStatus", org.apache.thrift.protocol.TType.STRUCT, (short)7);
  private static final org.apache.thrift.protocol.TField HTTP_PORT_FIELD_DESC = new org.apache.thrift.protocol.TField("httpPort", org.apache.thrift.protocol.TType.I32, (short)8);

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

  public long bytesTotal; // required
  public long bytesUsed; // required
  public long bytesRemaining; // required
  public long bytesNonDfs; // required
  /**
   * How many datanodes are considered live
   */
  public int numLiveDataNodes; // required
  /**
   * How many datanodes are considered dead
   */
  public int numDeadDataNodes; // required
  /**
   * Status of the current running upgrade. If no upgrade
   * is running, this will be null.
   */
  public UpgradeStatusReport upgradeStatus; // required
  /**
   * The http port that the NameNode is listening on for its web UI
   * - this isn't really health, but it's related and handy
   */
  public int httpPort; // 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 {
    BYTES_TOTAL((short)1, "bytesTotal"),
    BYTES_USED((short)2, "bytesUsed"),
    BYTES_REMAINING((short)3, "bytesRemaining"),
    BYTES_NON_DFS((short)4, "bytesNonDfs"),
    /**
     * How many datanodes are considered live
     */
    NUM_LIVE_DATA_NODES((short)5, "numLiveDataNodes"),
    /**
     * How many datanodes are considered dead
     */
    NUM_DEAD_DATA_NODES((short)6, "numDeadDataNodes"),
    /**
     * Status of the current running upgrade. If no upgrade
     * is running, this will be null.
     */
    UPGRADE_STATUS((short)7, "upgradeStatus"),
    /**
     * The http port that the NameNode is listening on for its web UI
     * - this isn't really health, but it's related and handy
     */
    HTTP_PORT((short)8, "httpPort");

    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: // BYTES_TOTAL
          return BYTES_TOTAL;
        case 2: // BYTES_USED
          return BYTES_USED;
        case 3: // BYTES_REMAINING
          return BYTES_REMAINING;
        case 4: // BYTES_NON_DFS
          return BYTES_NON_DFS;
        case 5: // NUM_LIVE_DATA_NODES
          return NUM_LIVE_DATA_NODES;
        case 6: // NUM_DEAD_DATA_NODES
          return NUM_DEAD_DATA_NODES;
        case 7: // UPGRADE_STATUS
          return UPGRADE_STATUS;
        case 8: // HTTP_PORT
          return HTTP_PORT;
        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 __BYTESTOTAL_ISSET_ID = 0;
  private static final int __BYTESUSED_ISSET_ID = 1;
  private static final int __BYTESREMAINING_ISSET_ID = 2;
  private static final int __BYTESNONDFS_ISSET_ID = 3;
  private static final int __NUMLIVEDATANODES_ISSET_ID = 4;
  private static final int __NUMDEADDATANODES_ISSET_ID = 5;
  private static final int __HTTPPORT_ISSET_ID = 6;
  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.BYTES_TOTAL, new org.apache.thrift.meta_data.FieldMetaData("bytesTotal", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.BYTES_USED, new org.apache.thrift.meta_data.FieldMetaData("bytesUsed", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.BYTES_REMAINING, new org.apache.thrift.meta_data.FieldMetaData("bytesRemaining", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.BYTES_NON_DFS, new org.apache.thrift.meta_data.FieldMetaData("bytesNonDfs", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.NUM_LIVE_DATA_NODES, new org.apache.thrift.meta_data.FieldMetaData("numLiveDataNodes", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.NUM_DEAD_DATA_NODES, new org.apache.thrift.meta_data.FieldMetaData("numDeadDataNodes", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.UPGRADE_STATUS, new org.apache.thrift.meta_data.FieldMetaData("upgradeStatus", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, UpgradeStatusReport.class)));
    tmpMap.put(_Fields.HTTP_PORT, new org.apache.thrift.meta_data.FieldMetaData("httpPort", 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(DFSHealthReport.class, metaDataMap);
  }

  public DFSHealthReport() {
  }

  public DFSHealthReport(
    long bytesTotal,
    long bytesUsed,
    long bytesRemaining,
    long bytesNonDfs,
    int numLiveDataNodes,
    int numDeadDataNodes,
    UpgradeStatusReport upgradeStatus,
    int httpPort)
  {
    this();
    this.bytesTotal = bytesTotal;
    setBytesTotalIsSet(true);
    this.bytesUsed = bytesUsed;
    setBytesUsedIsSet(true);
    this.bytesRemaining = bytesRemaining;
    setBytesRemainingIsSet(true);
    this.bytesNonDfs = bytesNonDfs;
    setBytesNonDfsIsSet(true);
    this.numLiveDataNodes = numLiveDataNodes;
    setNumLiveDataNodesIsSet(true);
    this.numDeadDataNodes = numDeadDataNodes;
    setNumDeadDataNodesIsSet(true);
    this.upgradeStatus = upgradeStatus;
    this.httpPort = httpPort;
    setHttpPortIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public DFSHealthReport(DFSHealthReport other) {
    __isset_bitfield = other.__isset_bitfield;
    this.bytesTotal = other.bytesTotal;
    this.bytesUsed = other.bytesUsed;
    this.bytesRemaining = other.bytesRemaining;
    this.bytesNonDfs = other.bytesNonDfs;
    this.numLiveDataNodes = other.numLiveDataNodes;
    this.numDeadDataNodes = other.numDeadDataNodes;
    if (other.isSetUpgradeStatus()) {
      this.upgradeStatus = new UpgradeStatusReport(other.upgradeStatus);
    }
    this.httpPort = other.httpPort;
  }

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

  @Override
  public void clear() {
    setBytesTotalIsSet(false);
    this.bytesTotal = 0;
    setBytesUsedIsSet(false);
    this.bytesUsed = 0;
    setBytesRemainingIsSet(false);
    this.bytesRemaining = 0;
    setBytesNonDfsIsSet(false);
    this.bytesNonDfs = 0;
    setNumLiveDataNodesIsSet(false);
    this.numLiveDataNodes = 0;
    setNumDeadDataNodesIsSet(false);
    this.numDeadDataNodes = 0;
    this.upgradeStatus = null;
    setHttpPortIsSet(false);
    this.httpPort = 0;
  }

  public long getBytesTotal() {
    return this.bytesTotal;
  }

  public DFSHealthReport setBytesTotal(long bytesTotal) {
    this.bytesTotal = bytesTotal;
    setBytesTotalIsSet(true);
    return this;
  }

  public void unsetBytesTotal() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __BYTESTOTAL_ISSET_ID);
  }

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

  public void setBytesTotalIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __BYTESTOTAL_ISSET_ID, value);
  }

  public long getBytesUsed() {
    return this.bytesUsed;
  }

  public DFSHealthReport setBytesUsed(long bytesUsed) {
    this.bytesUsed = bytesUsed;
    setBytesUsedIsSet(true);
    return this;
  }

  public void unsetBytesUsed() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __BYTESUSED_ISSET_ID);
  }

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

  public void setBytesUsedIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __BYTESUSED_ISSET_ID, value);
  }

  public long getBytesRemaining() {
    return this.bytesRemaining;
  }

  public DFSHealthReport setBytesRemaining(long bytesRemaining) {
    this.bytesRemaining = bytesRemaining;
    setBytesRemainingIsSet(true);
    return this;
  }

  public void unsetBytesRemaining() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __BYTESREMAINING_ISSET_ID);
  }

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

  public void setBytesRemainingIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __BYTESREMAINING_ISSET_ID, value);
  }

  public long getBytesNonDfs() {
    return this.bytesNonDfs;
  }

  public DFSHealthReport setBytesNonDfs(long bytesNonDfs) {
    this.bytesNonDfs = bytesNonDfs;
    setBytesNonDfsIsSet(true);
    return this;
  }

  public void unsetBytesNonDfs() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __BYTESNONDFS_ISSET_ID);
  }

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

  public void setBytesNonDfsIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __BYTESNONDFS_ISSET_ID, value);
  }

  /**
   * How many datanodes are considered live
   */
  public int getNumLiveDataNodes() {
    return this.numLiveDataNodes;
  }

  /**
   * How many datanodes are considered live
   */
  public DFSHealthReport setNumLiveDataNodes(int numLiveDataNodes) {
    this.numLiveDataNodes = numLiveDataNodes;
    setNumLiveDataNodesIsSet(true);
    return this;
  }

  public void unsetNumLiveDataNodes() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __NUMLIVEDATANODES_ISSET_ID);
  }

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

  public void setNumLiveDataNodesIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __NUMLIVEDATANODES_ISSET_ID, value);
  }

  /**
   * How many datanodes are considered dead
   */
  public int getNumDeadDataNodes() {
    return this.numDeadDataNodes;
  }

  /**
   * How many datanodes are considered dead
   */
  public DFSHealthReport setNumDeadDataNodes(int numDeadDataNodes) {
    this.numDeadDataNodes = numDeadDataNodes;
    setNumDeadDataNodesIsSet(true);
    return this;
  }

  public void unsetNumDeadDataNodes() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __NUMDEADDATANODES_ISSET_ID);
  }

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

  public void setNumDeadDataNodesIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __NUMDEADDATANODES_ISSET_ID, value);
  }

  /**
   * Status of the current running upgrade. If no upgrade
   * is running, this will be null.
   */
  public UpgradeStatusReport getUpgradeStatus() {
    return this.upgradeStatus;
  }

  /**
   * Status of the current running upgrade. If no upgrade
   * is running, this will be null.
   */
  public DFSHealthReport setUpgradeStatus(UpgradeStatusReport upgradeStatus) {
    this.upgradeStatus = upgradeStatus;
    return this;
  }

  public void unsetUpgradeStatus() {
    this.upgradeStatus = null;
  }

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

  public void setUpgradeStatusIsSet(boolean value) {
    if (!value) {
      this.upgradeStatus = null;
    }
  }

  /**
   * The http port that the NameNode is listening on for its web UI
   * - this isn't really health, but it's related and handy
   */
  public int getHttpPort() {
    return this.httpPort;
  }

  /**
   * The http port that the NameNode is listening on for its web UI
   * - this isn't really health, but it's related and handy
   */
  public DFSHealthReport setHttpPort(int httpPort) {
    this.httpPort = httpPort;
    setHttpPortIsSet(true);
    return this;
  }

  public void unsetHttpPort() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __HTTPPORT_ISSET_ID);
  }

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

  public void setHttpPortIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __HTTPPORT_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case BYTES_TOTAL:
      if (value == null) {
        unsetBytesTotal();
      } else {
        setBytesTotal((Long)value);
      }
      break;

    case BYTES_USED:
      if (value == null) {
        unsetBytesUsed();
      } else {
        setBytesUsed((Long)value);
      }
      break;

    case BYTES_REMAINING:
      if (value == null) {
        unsetBytesRemaining();
      } else {
        setBytesRemaining((Long)value);
      }
      break;

    case BYTES_NON_DFS:
      if (value == null) {
        unsetBytesNonDfs();
      } else {
        setBytesNonDfs((Long)value);
      }
      break;

    case NUM_LIVE_DATA_NODES:
      if (value == null) {
        unsetNumLiveDataNodes();
      } else {
        setNumLiveDataNodes((Integer)value);
      }
      break;

    case NUM_DEAD_DATA_NODES:
      if (value == null) {
        unsetNumDeadDataNodes();
      } else {
        setNumDeadDataNodes((Integer)value);
      }
      break;

    case UPGRADE_STATUS:
      if (value == null) {
        unsetUpgradeStatus();
      } else {
        setUpgradeStatus((UpgradeStatusReport)value);
      }
      break;

    case HTTP_PORT:
      if (value == null) {
        unsetHttpPort();
      } else {
        setHttpPort((Integer)value);
      }
      break;

    }
  }

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

    case BYTES_USED:
      return Long.valueOf(getBytesUsed());

    case BYTES_REMAINING:
      return Long.valueOf(getBytesRemaining());

    case BYTES_NON_DFS:
      return Long.valueOf(getBytesNonDfs());

    case NUM_LIVE_DATA_NODES:
      return Integer.valueOf(getNumLiveDataNodes());

    case NUM_DEAD_DATA_NODES:
      return Integer.valueOf(getNumDeadDataNodes());

    case UPGRADE_STATUS:
      return getUpgradeStatus();

    case HTTP_PORT:
      return Integer.valueOf(getHttpPort());

    }
    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 BYTES_TOTAL:
      return isSetBytesTotal();
    case BYTES_USED:
      return isSetBytesUsed();
    case BYTES_REMAINING:
      return isSetBytesRemaining();
    case BYTES_NON_DFS:
      return isSetBytesNonDfs();
    case NUM_LIVE_DATA_NODES:
      return isSetNumLiveDataNodes();
    case NUM_DEAD_DATA_NODES:
      return isSetNumDeadDataNodes();
    case UPGRADE_STATUS:
      return isSetUpgradeStatus();
    case HTTP_PORT:
      return isSetHttpPort();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_bytesTotal = true;
    boolean that_present_bytesTotal = true;
    if (this_present_bytesTotal || that_present_bytesTotal) {
      if (!(this_present_bytesTotal && that_present_bytesTotal))
        return false;
      if (this.bytesTotal != that.bytesTotal)
        return false;
    }

    boolean this_present_bytesUsed = true;
    boolean that_present_bytesUsed = true;
    if (this_present_bytesUsed || that_present_bytesUsed) {
      if (!(this_present_bytesUsed && that_present_bytesUsed))
        return false;
      if (this.bytesUsed != that.bytesUsed)
        return false;
    }

    boolean this_present_bytesRemaining = true;
    boolean that_present_bytesRemaining = true;
    if (this_present_bytesRemaining || that_present_bytesRemaining) {
      if (!(this_present_bytesRemaining && that_present_bytesRemaining))
        return false;
      if (this.bytesRemaining != that.bytesRemaining)
        return false;
    }

    boolean this_present_bytesNonDfs = true;
    boolean that_present_bytesNonDfs = true;
    if (this_present_bytesNonDfs || that_present_bytesNonDfs) {
      if (!(this_present_bytesNonDfs && that_present_bytesNonDfs))
        return false;
      if (this.bytesNonDfs != that.bytesNonDfs)
        return false;
    }

    boolean this_present_numLiveDataNodes = true;
    boolean that_present_numLiveDataNodes = true;
    if (this_present_numLiveDataNodes || that_present_numLiveDataNodes) {
      if (!(this_present_numLiveDataNodes && that_present_numLiveDataNodes))
        return false;
      if (this.numLiveDataNodes != that.numLiveDataNodes)
        return false;
    }

    boolean this_present_numDeadDataNodes = true;
    boolean that_present_numDeadDataNodes = true;
    if (this_present_numDeadDataNodes || that_present_numDeadDataNodes) {
      if (!(this_present_numDeadDataNodes && that_present_numDeadDataNodes))
        return false;
      if (this.numDeadDataNodes != that.numDeadDataNodes)
        return false;
    }

    boolean this_present_upgradeStatus = true && this.isSetUpgradeStatus();
    boolean that_present_upgradeStatus = true && that.isSetUpgradeStatus();
    if (this_present_upgradeStatus || that_present_upgradeStatus) {
      if (!(this_present_upgradeStatus && that_present_upgradeStatus))
        return false;
      if (!this.upgradeStatus.equals(that.upgradeStatus))
        return false;
    }

    boolean this_present_httpPort = true;
    boolean that_present_httpPort = true;
    if (this_present_httpPort || that_present_httpPort) {
      if (!(this_present_httpPort && that_present_httpPort))
        return false;
      if (this.httpPort != that.httpPort)
        return false;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetBytesTotal()).compareTo(typedOther.isSetBytesTotal());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBytesTotal()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.bytesTotal, typedOther.bytesTotal);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetBytesUsed()).compareTo(typedOther.isSetBytesUsed());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBytesUsed()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.bytesUsed, typedOther.bytesUsed);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetBytesRemaining()).compareTo(typedOther.isSetBytesRemaining());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBytesRemaining()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.bytesRemaining, typedOther.bytesRemaining);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetBytesNonDfs()).compareTo(typedOther.isSetBytesNonDfs());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBytesNonDfs()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.bytesNonDfs, typedOther.bytesNonDfs);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetNumLiveDataNodes()).compareTo(typedOther.isSetNumLiveDataNodes());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNumLiveDataNodes()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.numLiveDataNodes, typedOther.numLiveDataNodes);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetNumDeadDataNodes()).compareTo(typedOther.isSetNumDeadDataNodes());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNumDeadDataNodes()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.numDeadDataNodes, typedOther.numDeadDataNodes);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetUpgradeStatus()).compareTo(typedOther.isSetUpgradeStatus());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUpgradeStatus()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.upgradeStatus, typedOther.upgradeStatus);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetHttpPort()).compareTo(typedOther.isSetHttpPort());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetHttpPort()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.httpPort, typedOther.httpPort);
      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("DFSHealthReport(");
    boolean first = true;

    sb.append("bytesTotal:");
    sb.append(this.bytesTotal);
    first = false;
    if (!first) sb.append(", ");
    sb.append("bytesUsed:");
    sb.append(this.bytesUsed);
    first = false;
    if (!first) sb.append(", ");
    sb.append("bytesRemaining:");
    sb.append(this.bytesRemaining);
    first = false;
    if (!first) sb.append(", ");
    sb.append("bytesNonDfs:");
    sb.append(this.bytesNonDfs);
    first = false;
    if (!first) sb.append(", ");
    sb.append("numLiveDataNodes:");
    sb.append(this.numLiveDataNodes);
    first = false;
    if (!first) sb.append(", ");
    sb.append("numDeadDataNodes:");
    sb.append(this.numDeadDataNodes);
    first = false;
    if (!first) sb.append(", ");
    sb.append("upgradeStatus:");
    if (this.upgradeStatus == null) {
      sb.append("null");
    } else {
      sb.append(this.upgradeStatus);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("httpPort:");
    sb.append(this.httpPort);
    first = false;
    sb.append(")");
    return sb.toString();
  }

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

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
    try {
      // 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 DFSHealthReportStandardSchemeFactory implements SchemeFactory {
    public DFSHealthReportStandardScheme getScheme() {
      return new DFSHealthReportStandardScheme();
    }
  }

  private static class DFSHealthReportStandardScheme extends StandardScheme<DFSHealthReport> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, DFSHealthReport 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: // BYTES_TOTAL
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.bytesTotal = iprot.readI64();
              struct.setBytesTotalIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // BYTES_USED
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.bytesUsed = iprot.readI64();
              struct.setBytesUsedIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // BYTES_REMAINING
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.bytesRemaining = iprot.readI64();
              struct.setBytesRemainingIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // BYTES_NON_DFS
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.bytesNonDfs = iprot.readI64();
              struct.setBytesNonDfsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // NUM_LIVE_DATA_NODES
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.numLiveDataNodes = iprot.readI32();
              struct.setNumLiveDataNodesIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // NUM_DEAD_DATA_NODES
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.numDeadDataNodes = iprot.readI32();
              struct.setNumDeadDataNodesIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // UPGRADE_STATUS
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.upgradeStatus = new UpgradeStatusReport();
              struct.upgradeStatus.read(iprot);
              struct.setUpgradeStatusIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // HTTP_PORT
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.httpPort = iprot.readI32();
              struct.setHttpPortIsSet(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, DFSHealthReport struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(BYTES_TOTAL_FIELD_DESC);
      oprot.writeI64(struct.bytesTotal);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(BYTES_USED_FIELD_DESC);
      oprot.writeI64(struct.bytesUsed);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(BYTES_REMAINING_FIELD_DESC);
      oprot.writeI64(struct.bytesRemaining);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(BYTES_NON_DFS_FIELD_DESC);
      oprot.writeI64(struct.bytesNonDfs);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(NUM_LIVE_DATA_NODES_FIELD_DESC);
      oprot.writeI32(struct.numLiveDataNodes);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(NUM_DEAD_DATA_NODES_FIELD_DESC);
      oprot.writeI32(struct.numDeadDataNodes);
      oprot.writeFieldEnd();
      if (struct.upgradeStatus != null) {
        oprot.writeFieldBegin(UPGRADE_STATUS_FIELD_DESC);
        struct.upgradeStatus.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(HTTP_PORT_FIELD_DESC);
      oprot.writeI32(struct.httpPort);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class DFSHealthReportTupleSchemeFactory implements SchemeFactory {
    public DFSHealthReportTupleScheme getScheme() {
      return new DFSHealthReportTupleScheme();
    }
  }

  private static class DFSHealthReportTupleScheme extends TupleScheme<DFSHealthReport> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, DFSHealthReport struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetBytesTotal()) {
        optionals.set(0);
      }
      if (struct.isSetBytesUsed()) {
        optionals.set(1);
      }
      if (struct.isSetBytesRemaining()) {
        optionals.set(2);
      }
      if (struct.isSetBytesNonDfs()) {
        optionals.set(3);
      }
      if (struct.isSetNumLiveDataNodes()) {
        optionals.set(4);
      }
      if (struct.isSetNumDeadDataNodes()) {
        optionals.set(5);
      }
      if (struct.isSetUpgradeStatus()) {
        optionals.set(6);
      }
      if (struct.isSetHttpPort()) {
        optionals.set(7);
      }
      oprot.writeBitSet(optionals, 8);
      if (struct.isSetBytesTotal()) {
        oprot.writeI64(struct.bytesTotal);
      }
      if (struct.isSetBytesUsed()) {
        oprot.writeI64(struct.bytesUsed);
      }
      if (struct.isSetBytesRemaining()) {
        oprot.writeI64(struct.bytesRemaining);
      }
      if (struct.isSetBytesNonDfs()) {
        oprot.writeI64(struct.bytesNonDfs);
      }
      if (struct.isSetNumLiveDataNodes()) {
        oprot.writeI32(struct.numLiveDataNodes);
      }
      if (struct.isSetNumDeadDataNodes()) {
        oprot.writeI32(struct.numDeadDataNodes);
      }
      if (struct.isSetUpgradeStatus()) {
        struct.upgradeStatus.write(oprot);
      }
      if (struct.isSetHttpPort()) {
        oprot.writeI32(struct.httpPort);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, DFSHealthReport struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(8);
      if (incoming.get(0)) {
        struct.bytesTotal = iprot.readI64();
        struct.setBytesTotalIsSet(true);
      }
      if (incoming.get(1)) {
        struct.bytesUsed = iprot.readI64();
        struct.setBytesUsedIsSet(true);
      }
      if (incoming.get(2)) {
        struct.bytesRemaining = iprot.readI64();
        struct.setBytesRemainingIsSet(true);
      }
      if (incoming.get(3)) {
        struct.bytesNonDfs = iprot.readI64();
        struct.setBytesNonDfsIsSet(true);
      }
      if (incoming.get(4)) {
        struct.numLiveDataNodes = iprot.readI32();
        struct.setNumLiveDataNodesIsSet(true);
      }
      if (incoming.get(5)) {
        struct.numDeadDataNodes = iprot.readI32();
        struct.setNumDeadDataNodesIsSet(true);
      }
      if (incoming.get(6)) {
        struct.upgradeStatus = new UpgradeStatusReport();
        struct.upgradeStatus.read(iprot);
        struct.setUpgradeStatusIsSet(true);
      }
      if (incoming.get(7)) {
        struct.httpPort = iprot.readI32();
        struct.setHttpPortIsSet(true);
      }
    }
  }

}

