/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 * Autogenerated by Thrift Compiler (0.9.2)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package backtype.storm.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 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.2)", date = "2017-2-22")
public class SupervisorSummary implements org.apache.thrift.TBase<SupervisorSummary, SupervisorSummary._Fields>, java.io.Serializable, Cloneable, Comparable<SupervisorSummary> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("SupervisorSummary");

  private static final org.apache.thrift.protocol.TField HOST_FIELD_DESC = new org.apache.thrift.protocol.TField("host", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField SUPERVISOR_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("supervisorId", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField UPTIME_SECS_FIELD_DESC = new org.apache.thrift.protocol.TField("uptimeSecs", org.apache.thrift.protocol.TType.I32, (short)3);
  private static final org.apache.thrift.protocol.TField NUM_WORKERS_FIELD_DESC = new org.apache.thrift.protocol.TField("numWorkers", org.apache.thrift.protocol.TType.I32, (short)4);
  private static final org.apache.thrift.protocol.TField NUM_USED_WORKERS_FIELD_DESC = new org.apache.thrift.protocol.TField("numUsedWorkers", org.apache.thrift.protocol.TType.I32, (short)5);
  private static final org.apache.thrift.protocol.TField VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("version", org.apache.thrift.protocol.TType.STRING, (short)6);
  private static final org.apache.thrift.protocol.TField BUILD_TS_FIELD_DESC = new org.apache.thrift.protocol.TField("buildTs", org.apache.thrift.protocol.TType.STRING, (short)7);
  private static final org.apache.thrift.protocol.TField PORT_FIELD_DESC = new org.apache.thrift.protocol.TField("port", org.apache.thrift.protocol.TType.I32, (short)8);
  private static final org.apache.thrift.protocol.TField ERROR_MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("errorMessage", org.apache.thrift.protocol.TType.STRING, (short)9);

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

  private String host; // required
  private String supervisorId; // required
  private int uptimeSecs; // required
  private int numWorkers; // required
  private int numUsedWorkers; // required
  private String version; // optional
  private String buildTs; // optional
  private int port; // optional
  private String errorMessage; // 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 {
    HOST((short)1, "host"),
    SUPERVISOR_ID((short)2, "supervisorId"),
    UPTIME_SECS((short)3, "uptimeSecs"),
    NUM_WORKERS((short)4, "numWorkers"),
    NUM_USED_WORKERS((short)5, "numUsedWorkers"),
    VERSION((short)6, "version"),
    BUILD_TS((short)7, "buildTs"),
    PORT((short)8, "port"),
    ERROR_MESSAGE((short)9, "errorMessage");

    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: // HOST
          return HOST;
        case 2: // SUPERVISOR_ID
          return SUPERVISOR_ID;
        case 3: // UPTIME_SECS
          return UPTIME_SECS;
        case 4: // NUM_WORKERS
          return NUM_WORKERS;
        case 5: // NUM_USED_WORKERS
          return NUM_USED_WORKERS;
        case 6: // VERSION
          return VERSION;
        case 7: // BUILD_TS
          return BUILD_TS;
        case 8: // PORT
          return PORT;
        case 9: // ERROR_MESSAGE
          return ERROR_MESSAGE;
        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 __UPTIMESECS_ISSET_ID = 0;
  private static final int __NUMWORKERS_ISSET_ID = 1;
  private static final int __NUMUSEDWORKERS_ISSET_ID = 2;
  private static final int __PORT_ISSET_ID = 3;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.VERSION,_Fields.BUILD_TS,_Fields.PORT,_Fields.ERROR_MESSAGE};
  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.HOST, new org.apache.thrift.meta_data.FieldMetaData("host", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.SUPERVISOR_ID, new org.apache.thrift.meta_data.FieldMetaData("supervisorId", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.UPTIME_SECS, new org.apache.thrift.meta_data.FieldMetaData("uptimeSecs", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.NUM_WORKERS, new org.apache.thrift.meta_data.FieldMetaData("numWorkers", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.NUM_USED_WORKERS, new org.apache.thrift.meta_data.FieldMetaData("numUsedWorkers", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.VERSION, new org.apache.thrift.meta_data.FieldMetaData("version", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.BUILD_TS, new org.apache.thrift.meta_data.FieldMetaData("buildTs", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.PORT, new org.apache.thrift.meta_data.FieldMetaData("port", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.ERROR_MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("errorMessage", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(SupervisorSummary.class, metaDataMap);
  }

  public SupervisorSummary() {
  }

  public SupervisorSummary(
    String host,
    String supervisorId,
    int uptimeSecs,
    int numWorkers,
    int numUsedWorkers)
  {
    this();
    this.host = host;
    this.supervisorId = supervisorId;
    this.uptimeSecs = uptimeSecs;
    set_uptimeSecs_isSet(true);
    this.numWorkers = numWorkers;
    set_numWorkers_isSet(true);
    this.numUsedWorkers = numUsedWorkers;
    set_numUsedWorkers_isSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public SupervisorSummary(SupervisorSummary other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.is_set_host()) {
      this.host = other.host;
    }
    if (other.is_set_supervisorId()) {
      this.supervisorId = other.supervisorId;
    }
    this.uptimeSecs = other.uptimeSecs;
    this.numWorkers = other.numWorkers;
    this.numUsedWorkers = other.numUsedWorkers;
    if (other.is_set_version()) {
      this.version = other.version;
    }
    if (other.is_set_buildTs()) {
      this.buildTs = other.buildTs;
    }
    this.port = other.port;
    if (other.is_set_errorMessage()) {
      this.errorMessage = other.errorMessage;
    }
  }

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

  @Override
  public void clear() {
    this.host = null;
    this.supervisorId = null;
    set_uptimeSecs_isSet(false);
    this.uptimeSecs = 0;
    set_numWorkers_isSet(false);
    this.numWorkers = 0;
    set_numUsedWorkers_isSet(false);
    this.numUsedWorkers = 0;
    this.version = null;
    this.buildTs = null;
    set_port_isSet(false);
    this.port = 0;
    this.errorMessage = null;
  }

  public String get_host() {
    return this.host;
  }

  public void set_host(String host) {
    this.host = host;
  }

  public void unset_host() {
    this.host = null;
  }

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

  public void set_host_isSet(boolean value) {
    if (!value) {
      this.host = null;
    }
  }

  public String get_supervisorId() {
    return this.supervisorId;
  }

  public void set_supervisorId(String supervisorId) {
    this.supervisorId = supervisorId;
  }

  public void unset_supervisorId() {
    this.supervisorId = null;
  }

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

  public void set_supervisorId_isSet(boolean value) {
    if (!value) {
      this.supervisorId = null;
    }
  }

  public int get_uptimeSecs() {
    return this.uptimeSecs;
  }

  public void set_uptimeSecs(int uptimeSecs) {
    this.uptimeSecs = uptimeSecs;
    set_uptimeSecs_isSet(true);
  }

  public void unset_uptimeSecs() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __UPTIMESECS_ISSET_ID);
  }

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

  public void set_uptimeSecs_isSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __UPTIMESECS_ISSET_ID, value);
  }

  public int get_numWorkers() {
    return this.numWorkers;
  }

  public void set_numWorkers(int numWorkers) {
    this.numWorkers = numWorkers;
    set_numWorkers_isSet(true);
  }

  public void unset_numWorkers() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __NUMWORKERS_ISSET_ID);
  }

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

  public void set_numWorkers_isSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __NUMWORKERS_ISSET_ID, value);
  }

  public int get_numUsedWorkers() {
    return this.numUsedWorkers;
  }

  public void set_numUsedWorkers(int numUsedWorkers) {
    this.numUsedWorkers = numUsedWorkers;
    set_numUsedWorkers_isSet(true);
  }

  public void unset_numUsedWorkers() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __NUMUSEDWORKERS_ISSET_ID);
  }

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

  public void set_numUsedWorkers_isSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __NUMUSEDWORKERS_ISSET_ID, value);
  }

  public String get_version() {
    return this.version;
  }

  public void set_version(String version) {
    this.version = version;
  }

  public void unset_version() {
    this.version = null;
  }

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

  public void set_version_isSet(boolean value) {
    if (!value) {
      this.version = null;
    }
  }

  public String get_buildTs() {
    return this.buildTs;
  }

  public void set_buildTs(String buildTs) {
    this.buildTs = buildTs;
  }

  public void unset_buildTs() {
    this.buildTs = null;
  }

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

  public void set_buildTs_isSet(boolean value) {
    if (!value) {
      this.buildTs = null;
    }
  }

  public int get_port() {
    return this.port;
  }

  public void set_port(int port) {
    this.port = port;
    set_port_isSet(true);
  }

  public void unset_port() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PORT_ISSET_ID);
  }

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

  public void set_port_isSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PORT_ISSET_ID, value);
  }

  public String get_errorMessage() {
    return this.errorMessage;
  }

  public void set_errorMessage(String errorMessage) {
    this.errorMessage = errorMessage;
  }

  public void unset_errorMessage() {
    this.errorMessage = null;
  }

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

  public void set_errorMessage_isSet(boolean value) {
    if (!value) {
      this.errorMessage = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case HOST:
      if (value == null) {
        unset_host();
      } else {
        set_host((String)value);
      }
      break;

    case SUPERVISOR_ID:
      if (value == null) {
        unset_supervisorId();
      } else {
        set_supervisorId((String)value);
      }
      break;

    case UPTIME_SECS:
      if (value == null) {
        unset_uptimeSecs();
      } else {
        set_uptimeSecs((Integer)value);
      }
      break;

    case NUM_WORKERS:
      if (value == null) {
        unset_numWorkers();
      } else {
        set_numWorkers((Integer)value);
      }
      break;

    case NUM_USED_WORKERS:
      if (value == null) {
        unset_numUsedWorkers();
      } else {
        set_numUsedWorkers((Integer)value);
      }
      break;

    case VERSION:
      if (value == null) {
        unset_version();
      } else {
        set_version((String)value);
      }
      break;

    case BUILD_TS:
      if (value == null) {
        unset_buildTs();
      } else {
        set_buildTs((String)value);
      }
      break;

    case PORT:
      if (value == null) {
        unset_port();
      } else {
        set_port((Integer)value);
      }
      break;

    case ERROR_MESSAGE:
      if (value == null) {
        unset_errorMessage();
      } else {
        set_errorMessage((String)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case HOST:
      return get_host();

    case SUPERVISOR_ID:
      return get_supervisorId();

    case UPTIME_SECS:
      return Integer.valueOf(get_uptimeSecs());

    case NUM_WORKERS:
      return Integer.valueOf(get_numWorkers());

    case NUM_USED_WORKERS:
      return Integer.valueOf(get_numUsedWorkers());

    case VERSION:
      return get_version();

    case BUILD_TS:
      return get_buildTs();

    case PORT:
      return Integer.valueOf(get_port());

    case ERROR_MESSAGE:
      return get_errorMessage();

    }
    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 HOST:
      return is_set_host();
    case SUPERVISOR_ID:
      return is_set_supervisorId();
    case UPTIME_SECS:
      return is_set_uptimeSecs();
    case NUM_WORKERS:
      return is_set_numWorkers();
    case NUM_USED_WORKERS:
      return is_set_numUsedWorkers();
    case VERSION:
      return is_set_version();
    case BUILD_TS:
      return is_set_buildTs();
    case PORT:
      return is_set_port();
    case ERROR_MESSAGE:
      return is_set_errorMessage();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_host = true && this.is_set_host();
    boolean that_present_host = true && that.is_set_host();
    if (this_present_host || that_present_host) {
      if (!(this_present_host && that_present_host))
        return false;
      if (!this.host.equals(that.host))
        return false;
    }

    boolean this_present_supervisorId = true && this.is_set_supervisorId();
    boolean that_present_supervisorId = true && that.is_set_supervisorId();
    if (this_present_supervisorId || that_present_supervisorId) {
      if (!(this_present_supervisorId && that_present_supervisorId))
        return false;
      if (!this.supervisorId.equals(that.supervisorId))
        return false;
    }

    boolean this_present_uptimeSecs = true;
    boolean that_present_uptimeSecs = true;
    if (this_present_uptimeSecs || that_present_uptimeSecs) {
      if (!(this_present_uptimeSecs && that_present_uptimeSecs))
        return false;
      if (this.uptimeSecs != that.uptimeSecs)
        return false;
    }

    boolean this_present_numWorkers = true;
    boolean that_present_numWorkers = true;
    if (this_present_numWorkers || that_present_numWorkers) {
      if (!(this_present_numWorkers && that_present_numWorkers))
        return false;
      if (this.numWorkers != that.numWorkers)
        return false;
    }

    boolean this_present_numUsedWorkers = true;
    boolean that_present_numUsedWorkers = true;
    if (this_present_numUsedWorkers || that_present_numUsedWorkers) {
      if (!(this_present_numUsedWorkers && that_present_numUsedWorkers))
        return false;
      if (this.numUsedWorkers != that.numUsedWorkers)
        return false;
    }

    boolean this_present_version = true && this.is_set_version();
    boolean that_present_version = true && that.is_set_version();
    if (this_present_version || that_present_version) {
      if (!(this_present_version && that_present_version))
        return false;
      if (!this.version.equals(that.version))
        return false;
    }

    boolean this_present_buildTs = true && this.is_set_buildTs();
    boolean that_present_buildTs = true && that.is_set_buildTs();
    if (this_present_buildTs || that_present_buildTs) {
      if (!(this_present_buildTs && that_present_buildTs))
        return false;
      if (!this.buildTs.equals(that.buildTs))
        return false;
    }

    boolean this_present_port = true && this.is_set_port();
    boolean that_present_port = true && that.is_set_port();
    if (this_present_port || that_present_port) {
      if (!(this_present_port && that_present_port))
        return false;
      if (this.port != that.port)
        return false;
    }

    boolean this_present_errorMessage = true && this.is_set_errorMessage();
    boolean that_present_errorMessage = true && that.is_set_errorMessage();
    if (this_present_errorMessage || that_present_errorMessage) {
      if (!(this_present_errorMessage && that_present_errorMessage))
        return false;
      if (!this.errorMessage.equals(that.errorMessage))
        return false;
    }

    return true;
  }

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

    boolean present_host = true && (is_set_host());
    list.add(present_host);
    if (present_host)
      list.add(host);

    boolean present_supervisorId = true && (is_set_supervisorId());
    list.add(present_supervisorId);
    if (present_supervisorId)
      list.add(supervisorId);

    boolean present_uptimeSecs = true;
    list.add(present_uptimeSecs);
    if (present_uptimeSecs)
      list.add(uptimeSecs);

    boolean present_numWorkers = true;
    list.add(present_numWorkers);
    if (present_numWorkers)
      list.add(numWorkers);

    boolean present_numUsedWorkers = true;
    list.add(present_numUsedWorkers);
    if (present_numUsedWorkers)
      list.add(numUsedWorkers);

    boolean present_version = true && (is_set_version());
    list.add(present_version);
    if (present_version)
      list.add(version);

    boolean present_buildTs = true && (is_set_buildTs());
    list.add(present_buildTs);
    if (present_buildTs)
      list.add(buildTs);

    boolean present_port = true && (is_set_port());
    list.add(present_port);
    if (present_port)
      list.add(port);

    boolean present_errorMessage = true && (is_set_errorMessage());
    list.add(present_errorMessage);
    if (present_errorMessage)
      list.add(errorMessage);

    return list.hashCode();
  }

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

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(is_set_host()).compareTo(other.is_set_host());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_host()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.host, other.host);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(is_set_supervisorId()).compareTo(other.is_set_supervisorId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_supervisorId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.supervisorId, other.supervisorId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(is_set_uptimeSecs()).compareTo(other.is_set_uptimeSecs());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_uptimeSecs()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.uptimeSecs, other.uptimeSecs);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(is_set_numWorkers()).compareTo(other.is_set_numWorkers());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_numWorkers()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.numWorkers, other.numWorkers);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(is_set_numUsedWorkers()).compareTo(other.is_set_numUsedWorkers());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_numUsedWorkers()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.numUsedWorkers, other.numUsedWorkers);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(is_set_version()).compareTo(other.is_set_version());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_version()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.version, other.version);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(is_set_buildTs()).compareTo(other.is_set_buildTs());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_buildTs()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.buildTs, other.buildTs);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(is_set_port()).compareTo(other.is_set_port());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_port()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.port, other.port);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(is_set_errorMessage()).compareTo(other.is_set_errorMessage());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_errorMessage()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.errorMessage, other.errorMessage);
      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("SupervisorSummary(");
    boolean first = true;

    sb.append("host:");
    if (this.host == null) {
      sb.append("null");
    } else {
      sb.append(this.host);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("supervisorId:");
    if (this.supervisorId == null) {
      sb.append("null");
    } else {
      sb.append(this.supervisorId);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("uptimeSecs:");
    sb.append(this.uptimeSecs);
    first = false;
    if (!first) sb.append(", ");
    sb.append("numWorkers:");
    sb.append(this.numWorkers);
    first = false;
    if (!first) sb.append(", ");
    sb.append("numUsedWorkers:");
    sb.append(this.numUsedWorkers);
    first = false;
    if (is_set_version()) {
      if (!first) sb.append(", ");
      sb.append("version:");
      if (this.version == null) {
        sb.append("null");
      } else {
        sb.append(this.version);
      }
      first = false;
    }
    if (is_set_buildTs()) {
      if (!first) sb.append(", ");
      sb.append("buildTs:");
      if (this.buildTs == null) {
        sb.append("null");
      } else {
        sb.append(this.buildTs);
      }
      first = false;
    }
    if (is_set_port()) {
      if (!first) sb.append(", ");
      sb.append("port:");
      sb.append(this.port);
      first = false;
    }
    if (is_set_errorMessage()) {
      if (!first) sb.append(", ");
      sb.append("errorMessage:");
      if (this.errorMessage == null) {
        sb.append("null");
      } else {
        sb.append(this.errorMessage);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

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

    if (!is_set_supervisorId()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'supervisorId' is unset! Struct:" + toString());
    }

    if (!is_set_uptimeSecs()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'uptimeSecs' is unset! Struct:" + toString());
    }

    if (!is_set_numWorkers()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'numWorkers' is unset! Struct:" + toString());
    }

    if (!is_set_numUsedWorkers()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'numUsedWorkers' is unset! Struct:" + toString());
    }

    // check for sub-struct validity
  }

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

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

  private static class SupervisorSummaryStandardScheme extends StandardScheme<SupervisorSummary> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, SupervisorSummary 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: // HOST
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.host = iprot.readString();
              struct.set_host_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // SUPERVISOR_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.supervisorId = iprot.readString();
              struct.set_supervisorId_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // UPTIME_SECS
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.uptimeSecs = iprot.readI32();
              struct.set_uptimeSecs_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // NUM_WORKERS
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.numWorkers = iprot.readI32();
              struct.set_numWorkers_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // NUM_USED_WORKERS
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.numUsedWorkers = iprot.readI32();
              struct.set_numUsedWorkers_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // VERSION
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.version = iprot.readString();
              struct.set_version_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // BUILD_TS
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.buildTs = iprot.readString();
              struct.set_buildTs_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // PORT
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.port = iprot.readI32();
              struct.set_port_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 9: // ERROR_MESSAGE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.errorMessage = iprot.readString();
              struct.set_errorMessage_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();
      struct.validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.host != null) {
        oprot.writeFieldBegin(HOST_FIELD_DESC);
        oprot.writeString(struct.host);
        oprot.writeFieldEnd();
      }
      if (struct.supervisorId != null) {
        oprot.writeFieldBegin(SUPERVISOR_ID_FIELD_DESC);
        oprot.writeString(struct.supervisorId);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(UPTIME_SECS_FIELD_DESC);
      oprot.writeI32(struct.uptimeSecs);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(NUM_WORKERS_FIELD_DESC);
      oprot.writeI32(struct.numWorkers);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(NUM_USED_WORKERS_FIELD_DESC);
      oprot.writeI32(struct.numUsedWorkers);
      oprot.writeFieldEnd();
      if (struct.version != null) {
        if (struct.is_set_version()) {
          oprot.writeFieldBegin(VERSION_FIELD_DESC);
          oprot.writeString(struct.version);
          oprot.writeFieldEnd();
        }
      }
      if (struct.buildTs != null) {
        if (struct.is_set_buildTs()) {
          oprot.writeFieldBegin(BUILD_TS_FIELD_DESC);
          oprot.writeString(struct.buildTs);
          oprot.writeFieldEnd();
        }
      }
      if (struct.is_set_port()) {
        oprot.writeFieldBegin(PORT_FIELD_DESC);
        oprot.writeI32(struct.port);
        oprot.writeFieldEnd();
      }
      if (struct.errorMessage != null) {
        if (struct.is_set_errorMessage()) {
          oprot.writeFieldBegin(ERROR_MESSAGE_FIELD_DESC);
          oprot.writeString(struct.errorMessage);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class SupervisorSummaryTupleSchemeFactory implements SchemeFactory {
    public SupervisorSummaryTupleScheme getScheme() {
      return new SupervisorSummaryTupleScheme();
    }
  }

  private static class SupervisorSummaryTupleScheme extends TupleScheme<SupervisorSummary> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, SupervisorSummary struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      oprot.writeString(struct.host);
      oprot.writeString(struct.supervisorId);
      oprot.writeI32(struct.uptimeSecs);
      oprot.writeI32(struct.numWorkers);
      oprot.writeI32(struct.numUsedWorkers);
      BitSet optionals = new BitSet();
      if (struct.is_set_version()) {
        optionals.set(0);
      }
      if (struct.is_set_buildTs()) {
        optionals.set(1);
      }
      if (struct.is_set_port()) {
        optionals.set(2);
      }
      if (struct.is_set_errorMessage()) {
        optionals.set(3);
      }
      oprot.writeBitSet(optionals, 4);
      if (struct.is_set_version()) {
        oprot.writeString(struct.version);
      }
      if (struct.is_set_buildTs()) {
        oprot.writeString(struct.buildTs);
      }
      if (struct.is_set_port()) {
        oprot.writeI32(struct.port);
      }
      if (struct.is_set_errorMessage()) {
        oprot.writeString(struct.errorMessage);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, SupervisorSummary struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      struct.host = iprot.readString();
      struct.set_host_isSet(true);
      struct.supervisorId = iprot.readString();
      struct.set_supervisorId_isSet(true);
      struct.uptimeSecs = iprot.readI32();
      struct.set_uptimeSecs_isSet(true);
      struct.numWorkers = iprot.readI32();
      struct.set_numWorkers_isSet(true);
      struct.numUsedWorkers = iprot.readI32();
      struct.set_numUsedWorkers_isSet(true);
      BitSet incoming = iprot.readBitSet(4);
      if (incoming.get(0)) {
        struct.version = iprot.readString();
        struct.set_version_isSet(true);
      }
      if (incoming.get(1)) {
        struct.buildTs = iprot.readString();
        struct.set_buildTs_isSet(true);
      }
      if (incoming.get(2)) {
        struct.port = iprot.readI32();
        struct.set_port_isSet(true);
      }
      if (incoming.get(3)) {
        struct.errorMessage = iprot.readString();
        struct.set_errorMessage_isSet(true);
      }
    }
  }

}

