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

/**
 * A ThriftTaskInProgress contains a list of
 * task attempts (speculatively executed instances of the same task).
 * These are indexed by TaskAttemptID.
 * For simplicity, we convert maps keyed on TaskAttemptIDs to maps keyed
 * on their string representation.
 * 
 * Assumption: there won't be so many task attempts that retrieving a single task
 * will be too expensive.
 */
public class ThriftTaskInProgress implements org.apache.thrift.TBase<ThriftTaskInProgress, ThriftTaskInProgress._Fields>, java.io.Serializable, Cloneable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ThriftTaskInProgress");

  private static final org.apache.thrift.protocol.TField EXEC_START_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("execStartTime", org.apache.thrift.protocol.TType.I64, (short)2);
  private static final org.apache.thrift.protocol.TField EXEC_FINISH_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("execFinishTime", org.apache.thrift.protocol.TType.I64, (short)3);
  private static final org.apache.thrift.protocol.TField PROGRESS_FIELD_DESC = new org.apache.thrift.protocol.TField("progress", org.apache.thrift.protocol.TType.DOUBLE, (short)4);
  private static final org.apache.thrift.protocol.TField START_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("startTime", org.apache.thrift.protocol.TType.I64, (short)5);
  private static final org.apache.thrift.protocol.TField FAILED_FIELD_DESC = new org.apache.thrift.protocol.TField("failed", org.apache.thrift.protocol.TType.BOOL, (short)6);
  private static final org.apache.thrift.protocol.TField COMPLETE_FIELD_DESC = new org.apache.thrift.protocol.TField("complete", org.apache.thrift.protocol.TType.BOOL, (short)7);
  private static final org.apache.thrift.protocol.TField TASK_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("taskID", org.apache.thrift.protocol.TType.STRUCT, (short)8);
  private static final org.apache.thrift.protocol.TField TASKS_FIELD_DESC = new org.apache.thrift.protocol.TField("tasks", org.apache.thrift.protocol.TType.LIST, (short)9);
  private static final org.apache.thrift.protocol.TField TASK_STATUSES_FIELD_DESC = new org.apache.thrift.protocol.TField("taskStatuses", org.apache.thrift.protocol.TType.MAP, (short)10);
  private static final org.apache.thrift.protocol.TField TASK_DIAGNOSTIC_DATA_FIELD_DESC = new org.apache.thrift.protocol.TField("taskDiagnosticData", org.apache.thrift.protocol.TType.MAP, (short)11);
  private static final org.apache.thrift.protocol.TField COUNTERS_FIELD_DESC = new org.apache.thrift.protocol.TField("counters", org.apache.thrift.protocol.TType.STRUCT, (short)12);
  private static final org.apache.thrift.protocol.TField MOST_RECENT_STATE_FIELD_DESC = new org.apache.thrift.protocol.TField("mostRecentState", org.apache.thrift.protocol.TType.STRING, (short)13);
  private static final org.apache.thrift.protocol.TField RUNNING_ATTEMPTS_FIELD_DESC = new org.apache.thrift.protocol.TField("runningAttempts", org.apache.thrift.protocol.TType.LIST, (short)14);
  private static final org.apache.thrift.protocol.TField SUCCESSFUL_ATTEMPT_FIELD_DESC = new org.apache.thrift.protocol.TField("successfulAttempt", org.apache.thrift.protocol.TType.STRING, (short)15);

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

  public long execStartTime; // required
  public long execFinishTime; // required
  public double progress; // required
  public long startTime; // required
  public boolean failed; // required
  public boolean complete; // required
  public ThriftTaskID taskID; // required
  public List<ThriftTaskAttemptID> tasks; // required
  /**
   * TaskAttemptID (string) to ThriftTaskStatus map
   */
  public Map<String,ThriftTaskStatus> taskStatuses; // required
  public Map<String,List<String>> taskDiagnosticData; // required
  public ThriftGroupList counters; // required
  public String mostRecentState; // required
  public List<String> runningAttempts; // required
  public String successfulAttempt; // 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 {
    EXEC_START_TIME((short)2, "execStartTime"),
    EXEC_FINISH_TIME((short)3, "execFinishTime"),
    PROGRESS((short)4, "progress"),
    START_TIME((short)5, "startTime"),
    FAILED((short)6, "failed"),
    COMPLETE((short)7, "complete"),
    TASK_ID((short)8, "taskID"),
    TASKS((short)9, "tasks"),
    /**
     * TaskAttemptID (string) to ThriftTaskStatus map
     */
    TASK_STATUSES((short)10, "taskStatuses"),
    TASK_DIAGNOSTIC_DATA((short)11, "taskDiagnosticData"),
    COUNTERS((short)12, "counters"),
    MOST_RECENT_STATE((short)13, "mostRecentState"),
    RUNNING_ATTEMPTS((short)14, "runningAttempts"),
    SUCCESSFUL_ATTEMPT((short)15, "successfulAttempt");

    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 2: // EXEC_START_TIME
          return EXEC_START_TIME;
        case 3: // EXEC_FINISH_TIME
          return EXEC_FINISH_TIME;
        case 4: // PROGRESS
          return PROGRESS;
        case 5: // START_TIME
          return START_TIME;
        case 6: // FAILED
          return FAILED;
        case 7: // COMPLETE
          return COMPLETE;
        case 8: // TASK_ID
          return TASK_ID;
        case 9: // TASKS
          return TASKS;
        case 10: // TASK_STATUSES
          return TASK_STATUSES;
        case 11: // TASK_DIAGNOSTIC_DATA
          return TASK_DIAGNOSTIC_DATA;
        case 12: // COUNTERS
          return COUNTERS;
        case 13: // MOST_RECENT_STATE
          return MOST_RECENT_STATE;
        case 14: // RUNNING_ATTEMPTS
          return RUNNING_ATTEMPTS;
        case 15: // SUCCESSFUL_ATTEMPT
          return SUCCESSFUL_ATTEMPT;
        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 __EXECSTARTTIME_ISSET_ID = 0;
  private static final int __EXECFINISHTIME_ISSET_ID = 1;
  private static final int __PROGRESS_ISSET_ID = 2;
  private static final int __STARTTIME_ISSET_ID = 3;
  private static final int __FAILED_ISSET_ID = 4;
  private static final int __COMPLETE_ISSET_ID = 5;
  private byte __isset_bitfield = 0;
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.EXEC_START_TIME, new org.apache.thrift.meta_data.FieldMetaData("execStartTime", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.EXEC_FINISH_TIME, new org.apache.thrift.meta_data.FieldMetaData("execFinishTime", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.PROGRESS, new org.apache.thrift.meta_data.FieldMetaData("progress", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.START_TIME, new org.apache.thrift.meta_data.FieldMetaData("startTime", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.FAILED, new org.apache.thrift.meta_data.FieldMetaData("failed", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.COMPLETE, new org.apache.thrift.meta_data.FieldMetaData("complete", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.TASK_ID, new org.apache.thrift.meta_data.FieldMetaData("taskID", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ThriftTaskID.class)));
    tmpMap.put(_Fields.TASKS, new org.apache.thrift.meta_data.FieldMetaData("tasks", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ThriftTaskAttemptID.class))));
    tmpMap.put(_Fields.TASK_STATUSES, new org.apache.thrift.meta_data.FieldMetaData("taskStatuses", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING), 
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ThriftTaskStatus.class))));
    tmpMap.put(_Fields.TASK_DIAGNOSTIC_DATA, new org.apache.thrift.meta_data.FieldMetaData("taskDiagnosticData", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING), 
            new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
                new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))));
    tmpMap.put(_Fields.COUNTERS, new org.apache.thrift.meta_data.FieldMetaData("counters", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ThriftGroupList.class)));
    tmpMap.put(_Fields.MOST_RECENT_STATE, new org.apache.thrift.meta_data.FieldMetaData("mostRecentState", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.RUNNING_ATTEMPTS, new org.apache.thrift.meta_data.FieldMetaData("runningAttempts", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
    tmpMap.put(_Fields.SUCCESSFUL_ATTEMPT, new org.apache.thrift.meta_data.FieldMetaData("successfulAttempt", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ThriftTaskInProgress.class, metaDataMap);
  }

  public ThriftTaskInProgress() {
  }

  public ThriftTaskInProgress(
    long execStartTime,
    long execFinishTime,
    double progress,
    long startTime,
    boolean failed,
    boolean complete,
    ThriftTaskID taskID,
    List<ThriftTaskAttemptID> tasks,
    Map<String,ThriftTaskStatus> taskStatuses,
    Map<String,List<String>> taskDiagnosticData,
    ThriftGroupList counters,
    String mostRecentState,
    List<String> runningAttempts,
    String successfulAttempt)
  {
    this();
    this.execStartTime = execStartTime;
    setExecStartTimeIsSet(true);
    this.execFinishTime = execFinishTime;
    setExecFinishTimeIsSet(true);
    this.progress = progress;
    setProgressIsSet(true);
    this.startTime = startTime;
    setStartTimeIsSet(true);
    this.failed = failed;
    setFailedIsSet(true);
    this.complete = complete;
    setCompleteIsSet(true);
    this.taskID = taskID;
    this.tasks = tasks;
    this.taskStatuses = taskStatuses;
    this.taskDiagnosticData = taskDiagnosticData;
    this.counters = counters;
    this.mostRecentState = mostRecentState;
    this.runningAttempts = runningAttempts;
    this.successfulAttempt = successfulAttempt;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public ThriftTaskInProgress(ThriftTaskInProgress other) {
    __isset_bitfield = other.__isset_bitfield;
    this.execStartTime = other.execStartTime;
    this.execFinishTime = other.execFinishTime;
    this.progress = other.progress;
    this.startTime = other.startTime;
    this.failed = other.failed;
    this.complete = other.complete;
    if (other.isSetTaskID()) {
      this.taskID = new ThriftTaskID(other.taskID);
    }
    if (other.isSetTasks()) {
      List<ThriftTaskAttemptID> __this__tasks = new ArrayList<ThriftTaskAttemptID>();
      for (ThriftTaskAttemptID other_element : other.tasks) {
        __this__tasks.add(new ThriftTaskAttemptID(other_element));
      }
      this.tasks = __this__tasks;
    }
    if (other.isSetTaskStatuses()) {
      Map<String,ThriftTaskStatus> __this__taskStatuses = new HashMap<String,ThriftTaskStatus>();
      for (Map.Entry<String, ThriftTaskStatus> other_element : other.taskStatuses.entrySet()) {

        String other_element_key = other_element.getKey();
        ThriftTaskStatus other_element_value = other_element.getValue();

        String __this__taskStatuses_copy_key = other_element_key;

        ThriftTaskStatus __this__taskStatuses_copy_value = new ThriftTaskStatus(other_element_value);

        __this__taskStatuses.put(__this__taskStatuses_copy_key, __this__taskStatuses_copy_value);
      }
      this.taskStatuses = __this__taskStatuses;
    }
    if (other.isSetTaskDiagnosticData()) {
      Map<String,List<String>> __this__taskDiagnosticData = new HashMap<String,List<String>>();
      for (Map.Entry<String, List<String>> other_element : other.taskDiagnosticData.entrySet()) {

        String other_element_key = other_element.getKey();
        List<String> other_element_value = other_element.getValue();

        String __this__taskDiagnosticData_copy_key = other_element_key;

        List<String> __this__taskDiagnosticData_copy_value = new ArrayList<String>();
        for (String other_element_value_element : other_element_value) {
          __this__taskDiagnosticData_copy_value.add(other_element_value_element);
        }

        __this__taskDiagnosticData.put(__this__taskDiagnosticData_copy_key, __this__taskDiagnosticData_copy_value);
      }
      this.taskDiagnosticData = __this__taskDiagnosticData;
    }
    if (other.isSetCounters()) {
      this.counters = new ThriftGroupList(other.counters);
    }
    if (other.isSetMostRecentState()) {
      this.mostRecentState = other.mostRecentState;
    }
    if (other.isSetRunningAttempts()) {
      List<String> __this__runningAttempts = new ArrayList<String>();
      for (String other_element : other.runningAttempts) {
        __this__runningAttempts.add(other_element);
      }
      this.runningAttempts = __this__runningAttempts;
    }
    if (other.isSetSuccessfulAttempt()) {
      this.successfulAttempt = other.successfulAttempt;
    }
  }

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

  @Override
  public void clear() {
    setExecStartTimeIsSet(false);
    this.execStartTime = 0;
    setExecFinishTimeIsSet(false);
    this.execFinishTime = 0;
    setProgressIsSet(false);
    this.progress = 0.0;
    setStartTimeIsSet(false);
    this.startTime = 0;
    setFailedIsSet(false);
    this.failed = false;
    setCompleteIsSet(false);
    this.complete = false;
    this.taskID = null;
    this.tasks = null;
    this.taskStatuses = null;
    this.taskDiagnosticData = null;
    this.counters = null;
    this.mostRecentState = null;
    this.runningAttempts = null;
    this.successfulAttempt = null;
  }

  public long getExecStartTime() {
    return this.execStartTime;
  }

  public ThriftTaskInProgress setExecStartTime(long execStartTime) {
    this.execStartTime = execStartTime;
    setExecStartTimeIsSet(true);
    return this;
  }

  public void unsetExecStartTime() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __EXECSTARTTIME_ISSET_ID);
  }

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

  public void setExecStartTimeIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __EXECSTARTTIME_ISSET_ID, value);
  }

  public long getExecFinishTime() {
    return this.execFinishTime;
  }

  public ThriftTaskInProgress setExecFinishTime(long execFinishTime) {
    this.execFinishTime = execFinishTime;
    setExecFinishTimeIsSet(true);
    return this;
  }

  public void unsetExecFinishTime() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __EXECFINISHTIME_ISSET_ID);
  }

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

  public void setExecFinishTimeIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __EXECFINISHTIME_ISSET_ID, value);
  }

  public double getProgress() {
    return this.progress;
  }

  public ThriftTaskInProgress setProgress(double progress) {
    this.progress = progress;
    setProgressIsSet(true);
    return this;
  }

  public void unsetProgress() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PROGRESS_ISSET_ID);
  }

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

  public void setProgressIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PROGRESS_ISSET_ID, value);
  }

  public long getStartTime() {
    return this.startTime;
  }

  public ThriftTaskInProgress setStartTime(long startTime) {
    this.startTime = startTime;
    setStartTimeIsSet(true);
    return this;
  }

  public void unsetStartTime() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __STARTTIME_ISSET_ID);
  }

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

  public void setStartTimeIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __STARTTIME_ISSET_ID, value);
  }

  public boolean isFailed() {
    return this.failed;
  }

  public ThriftTaskInProgress setFailed(boolean failed) {
    this.failed = failed;
    setFailedIsSet(true);
    return this;
  }

  public void unsetFailed() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __FAILED_ISSET_ID);
  }

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

  public void setFailedIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __FAILED_ISSET_ID, value);
  }

  public boolean isComplete() {
    return this.complete;
  }

  public ThriftTaskInProgress setComplete(boolean complete) {
    this.complete = complete;
    setCompleteIsSet(true);
    return this;
  }

  public void unsetComplete() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __COMPLETE_ISSET_ID);
  }

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

  public void setCompleteIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __COMPLETE_ISSET_ID, value);
  }

  public ThriftTaskID getTaskID() {
    return this.taskID;
  }

  public ThriftTaskInProgress setTaskID(ThriftTaskID taskID) {
    this.taskID = taskID;
    return this;
  }

  public void unsetTaskID() {
    this.taskID = null;
  }

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

  public void setTaskIDIsSet(boolean value) {
    if (!value) {
      this.taskID = null;
    }
  }

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

  public java.util.Iterator<ThriftTaskAttemptID> getTasksIterator() {
    return (this.tasks == null) ? null : this.tasks.iterator();
  }

  public void addToTasks(ThriftTaskAttemptID elem) {
    if (this.tasks == null) {
      this.tasks = new ArrayList<ThriftTaskAttemptID>();
    }
    this.tasks.add(elem);
  }

  public List<ThriftTaskAttemptID> getTasks() {
    return this.tasks;
  }

  public ThriftTaskInProgress setTasks(List<ThriftTaskAttemptID> tasks) {
    this.tasks = tasks;
    return this;
  }

  public void unsetTasks() {
    this.tasks = null;
  }

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

  public void setTasksIsSet(boolean value) {
    if (!value) {
      this.tasks = null;
    }
  }

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

  public void putToTaskStatuses(String key, ThriftTaskStatus val) {
    if (this.taskStatuses == null) {
      this.taskStatuses = new HashMap<String,ThriftTaskStatus>();
    }
    this.taskStatuses.put(key, val);
  }

  /**
   * TaskAttemptID (string) to ThriftTaskStatus map
   */
  public Map<String,ThriftTaskStatus> getTaskStatuses() {
    return this.taskStatuses;
  }

  /**
   * TaskAttemptID (string) to ThriftTaskStatus map
   */
  public ThriftTaskInProgress setTaskStatuses(Map<String,ThriftTaskStatus> taskStatuses) {
    this.taskStatuses = taskStatuses;
    return this;
  }

  public void unsetTaskStatuses() {
    this.taskStatuses = null;
  }

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

  public void setTaskStatusesIsSet(boolean value) {
    if (!value) {
      this.taskStatuses = null;
    }
  }

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

  public void putToTaskDiagnosticData(String key, List<String> val) {
    if (this.taskDiagnosticData == null) {
      this.taskDiagnosticData = new HashMap<String,List<String>>();
    }
    this.taskDiagnosticData.put(key, val);
  }

  public Map<String,List<String>> getTaskDiagnosticData() {
    return this.taskDiagnosticData;
  }

  public ThriftTaskInProgress setTaskDiagnosticData(Map<String,List<String>> taskDiagnosticData) {
    this.taskDiagnosticData = taskDiagnosticData;
    return this;
  }

  public void unsetTaskDiagnosticData() {
    this.taskDiagnosticData = null;
  }

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

  public void setTaskDiagnosticDataIsSet(boolean value) {
    if (!value) {
      this.taskDiagnosticData = null;
    }
  }

  public ThriftGroupList getCounters() {
    return this.counters;
  }

  public ThriftTaskInProgress setCounters(ThriftGroupList counters) {
    this.counters = counters;
    return this;
  }

  public void unsetCounters() {
    this.counters = null;
  }

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

  public void setCountersIsSet(boolean value) {
    if (!value) {
      this.counters = null;
    }
  }

  public String getMostRecentState() {
    return this.mostRecentState;
  }

  public ThriftTaskInProgress setMostRecentState(String mostRecentState) {
    this.mostRecentState = mostRecentState;
    return this;
  }

  public void unsetMostRecentState() {
    this.mostRecentState = null;
  }

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

  public void setMostRecentStateIsSet(boolean value) {
    if (!value) {
      this.mostRecentState = null;
    }
  }

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

  public java.util.Iterator<String> getRunningAttemptsIterator() {
    return (this.runningAttempts == null) ? null : this.runningAttempts.iterator();
  }

  public void addToRunningAttempts(String elem) {
    if (this.runningAttempts == null) {
      this.runningAttempts = new ArrayList<String>();
    }
    this.runningAttempts.add(elem);
  }

  public List<String> getRunningAttempts() {
    return this.runningAttempts;
  }

  public ThriftTaskInProgress setRunningAttempts(List<String> runningAttempts) {
    this.runningAttempts = runningAttempts;
    return this;
  }

  public void unsetRunningAttempts() {
    this.runningAttempts = null;
  }

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

  public void setRunningAttemptsIsSet(boolean value) {
    if (!value) {
      this.runningAttempts = null;
    }
  }

  public String getSuccessfulAttempt() {
    return this.successfulAttempt;
  }

  public ThriftTaskInProgress setSuccessfulAttempt(String successfulAttempt) {
    this.successfulAttempt = successfulAttempt;
    return this;
  }

  public void unsetSuccessfulAttempt() {
    this.successfulAttempt = null;
  }

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

  public void setSuccessfulAttemptIsSet(boolean value) {
    if (!value) {
      this.successfulAttempt = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case EXEC_START_TIME:
      if (value == null) {
        unsetExecStartTime();
      } else {
        setExecStartTime((Long)value);
      }
      break;

    case EXEC_FINISH_TIME:
      if (value == null) {
        unsetExecFinishTime();
      } else {
        setExecFinishTime((Long)value);
      }
      break;

    case PROGRESS:
      if (value == null) {
        unsetProgress();
      } else {
        setProgress((Double)value);
      }
      break;

    case START_TIME:
      if (value == null) {
        unsetStartTime();
      } else {
        setStartTime((Long)value);
      }
      break;

    case FAILED:
      if (value == null) {
        unsetFailed();
      } else {
        setFailed((Boolean)value);
      }
      break;

    case COMPLETE:
      if (value == null) {
        unsetComplete();
      } else {
        setComplete((Boolean)value);
      }
      break;

    case TASK_ID:
      if (value == null) {
        unsetTaskID();
      } else {
        setTaskID((ThriftTaskID)value);
      }
      break;

    case TASKS:
      if (value == null) {
        unsetTasks();
      } else {
        setTasks((List<ThriftTaskAttemptID>)value);
      }
      break;

    case TASK_STATUSES:
      if (value == null) {
        unsetTaskStatuses();
      } else {
        setTaskStatuses((Map<String,ThriftTaskStatus>)value);
      }
      break;

    case TASK_DIAGNOSTIC_DATA:
      if (value == null) {
        unsetTaskDiagnosticData();
      } else {
        setTaskDiagnosticData((Map<String,List<String>>)value);
      }
      break;

    case COUNTERS:
      if (value == null) {
        unsetCounters();
      } else {
        setCounters((ThriftGroupList)value);
      }
      break;

    case MOST_RECENT_STATE:
      if (value == null) {
        unsetMostRecentState();
      } else {
        setMostRecentState((String)value);
      }
      break;

    case RUNNING_ATTEMPTS:
      if (value == null) {
        unsetRunningAttempts();
      } else {
        setRunningAttempts((List<String>)value);
      }
      break;

    case SUCCESSFUL_ATTEMPT:
      if (value == null) {
        unsetSuccessfulAttempt();
      } else {
        setSuccessfulAttempt((String)value);
      }
      break;

    }
  }

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

    case EXEC_FINISH_TIME:
      return Long.valueOf(getExecFinishTime());

    case PROGRESS:
      return Double.valueOf(getProgress());

    case START_TIME:
      return Long.valueOf(getStartTime());

    case FAILED:
      return Boolean.valueOf(isFailed());

    case COMPLETE:
      return Boolean.valueOf(isComplete());

    case TASK_ID:
      return getTaskID();

    case TASKS:
      return getTasks();

    case TASK_STATUSES:
      return getTaskStatuses();

    case TASK_DIAGNOSTIC_DATA:
      return getTaskDiagnosticData();

    case COUNTERS:
      return getCounters();

    case MOST_RECENT_STATE:
      return getMostRecentState();

    case RUNNING_ATTEMPTS:
      return getRunningAttempts();

    case SUCCESSFUL_ATTEMPT:
      return getSuccessfulAttempt();

    }
    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 EXEC_START_TIME:
      return isSetExecStartTime();
    case EXEC_FINISH_TIME:
      return isSetExecFinishTime();
    case PROGRESS:
      return isSetProgress();
    case START_TIME:
      return isSetStartTime();
    case FAILED:
      return isSetFailed();
    case COMPLETE:
      return isSetComplete();
    case TASK_ID:
      return isSetTaskID();
    case TASKS:
      return isSetTasks();
    case TASK_STATUSES:
      return isSetTaskStatuses();
    case TASK_DIAGNOSTIC_DATA:
      return isSetTaskDiagnosticData();
    case COUNTERS:
      return isSetCounters();
    case MOST_RECENT_STATE:
      return isSetMostRecentState();
    case RUNNING_ATTEMPTS:
      return isSetRunningAttempts();
    case SUCCESSFUL_ATTEMPT:
      return isSetSuccessfulAttempt();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_execStartTime = true;
    boolean that_present_execStartTime = true;
    if (this_present_execStartTime || that_present_execStartTime) {
      if (!(this_present_execStartTime && that_present_execStartTime))
        return false;
      if (this.execStartTime != that.execStartTime)
        return false;
    }

    boolean this_present_execFinishTime = true;
    boolean that_present_execFinishTime = true;
    if (this_present_execFinishTime || that_present_execFinishTime) {
      if (!(this_present_execFinishTime && that_present_execFinishTime))
        return false;
      if (this.execFinishTime != that.execFinishTime)
        return false;
    }

    boolean this_present_progress = true;
    boolean that_present_progress = true;
    if (this_present_progress || that_present_progress) {
      if (!(this_present_progress && that_present_progress))
        return false;
      if (this.progress != that.progress)
        return false;
    }

    boolean this_present_startTime = true;
    boolean that_present_startTime = true;
    if (this_present_startTime || that_present_startTime) {
      if (!(this_present_startTime && that_present_startTime))
        return false;
      if (this.startTime != that.startTime)
        return false;
    }

    boolean this_present_failed = true;
    boolean that_present_failed = true;
    if (this_present_failed || that_present_failed) {
      if (!(this_present_failed && that_present_failed))
        return false;
      if (this.failed != that.failed)
        return false;
    }

    boolean this_present_complete = true;
    boolean that_present_complete = true;
    if (this_present_complete || that_present_complete) {
      if (!(this_present_complete && that_present_complete))
        return false;
      if (this.complete != that.complete)
        return false;
    }

    boolean this_present_taskID = true && this.isSetTaskID();
    boolean that_present_taskID = true && that.isSetTaskID();
    if (this_present_taskID || that_present_taskID) {
      if (!(this_present_taskID && that_present_taskID))
        return false;
      if (!this.taskID.equals(that.taskID))
        return false;
    }

    boolean this_present_tasks = true && this.isSetTasks();
    boolean that_present_tasks = true && that.isSetTasks();
    if (this_present_tasks || that_present_tasks) {
      if (!(this_present_tasks && that_present_tasks))
        return false;
      if (!this.tasks.equals(that.tasks))
        return false;
    }

    boolean this_present_taskStatuses = true && this.isSetTaskStatuses();
    boolean that_present_taskStatuses = true && that.isSetTaskStatuses();
    if (this_present_taskStatuses || that_present_taskStatuses) {
      if (!(this_present_taskStatuses && that_present_taskStatuses))
        return false;
      if (!this.taskStatuses.equals(that.taskStatuses))
        return false;
    }

    boolean this_present_taskDiagnosticData = true && this.isSetTaskDiagnosticData();
    boolean that_present_taskDiagnosticData = true && that.isSetTaskDiagnosticData();
    if (this_present_taskDiagnosticData || that_present_taskDiagnosticData) {
      if (!(this_present_taskDiagnosticData && that_present_taskDiagnosticData))
        return false;
      if (!this.taskDiagnosticData.equals(that.taskDiagnosticData))
        return false;
    }

    boolean this_present_counters = true && this.isSetCounters();
    boolean that_present_counters = true && that.isSetCounters();
    if (this_present_counters || that_present_counters) {
      if (!(this_present_counters && that_present_counters))
        return false;
      if (!this.counters.equals(that.counters))
        return false;
    }

    boolean this_present_mostRecentState = true && this.isSetMostRecentState();
    boolean that_present_mostRecentState = true && that.isSetMostRecentState();
    if (this_present_mostRecentState || that_present_mostRecentState) {
      if (!(this_present_mostRecentState && that_present_mostRecentState))
        return false;
      if (!this.mostRecentState.equals(that.mostRecentState))
        return false;
    }

    boolean this_present_runningAttempts = true && this.isSetRunningAttempts();
    boolean that_present_runningAttempts = true && that.isSetRunningAttempts();
    if (this_present_runningAttempts || that_present_runningAttempts) {
      if (!(this_present_runningAttempts && that_present_runningAttempts))
        return false;
      if (!this.runningAttempts.equals(that.runningAttempts))
        return false;
    }

    boolean this_present_successfulAttempt = true && this.isSetSuccessfulAttempt();
    boolean that_present_successfulAttempt = true && that.isSetSuccessfulAttempt();
    if (this_present_successfulAttempt || that_present_successfulAttempt) {
      if (!(this_present_successfulAttempt && that_present_successfulAttempt))
        return false;
      if (!this.successfulAttempt.equals(that.successfulAttempt))
        return false;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetExecStartTime()).compareTo(typedOther.isSetExecStartTime());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetExecStartTime()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.execStartTime, typedOther.execStartTime);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetExecFinishTime()).compareTo(typedOther.isSetExecFinishTime());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetExecFinishTime()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.execFinishTime, typedOther.execFinishTime);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetProgress()).compareTo(typedOther.isSetProgress());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetProgress()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.progress, typedOther.progress);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetStartTime()).compareTo(typedOther.isSetStartTime());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStartTime()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.startTime, typedOther.startTime);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetFailed()).compareTo(typedOther.isSetFailed());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFailed()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.failed, typedOther.failed);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetComplete()).compareTo(typedOther.isSetComplete());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetComplete()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.complete, typedOther.complete);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTaskID()).compareTo(typedOther.isSetTaskID());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTaskID()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.taskID, typedOther.taskID);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTasks()).compareTo(typedOther.isSetTasks());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTasks()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tasks, typedOther.tasks);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTaskStatuses()).compareTo(typedOther.isSetTaskStatuses());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTaskStatuses()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.taskStatuses, typedOther.taskStatuses);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTaskDiagnosticData()).compareTo(typedOther.isSetTaskDiagnosticData());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTaskDiagnosticData()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.taskDiagnosticData, typedOther.taskDiagnosticData);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCounters()).compareTo(typedOther.isSetCounters());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCounters()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.counters, typedOther.counters);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetMostRecentState()).compareTo(typedOther.isSetMostRecentState());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMostRecentState()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.mostRecentState, typedOther.mostRecentState);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetRunningAttempts()).compareTo(typedOther.isSetRunningAttempts());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRunningAttempts()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.runningAttempts, typedOther.runningAttempts);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetSuccessfulAttempt()).compareTo(typedOther.isSetSuccessfulAttempt());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSuccessfulAttempt()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.successfulAttempt, typedOther.successfulAttempt);
      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("ThriftTaskInProgress(");
    boolean first = true;

    sb.append("execStartTime:");
    sb.append(this.execStartTime);
    first = false;
    if (!first) sb.append(", ");
    sb.append("execFinishTime:");
    sb.append(this.execFinishTime);
    first = false;
    if (!first) sb.append(", ");
    sb.append("progress:");
    sb.append(this.progress);
    first = false;
    if (!first) sb.append(", ");
    sb.append("startTime:");
    sb.append(this.startTime);
    first = false;
    if (!first) sb.append(", ");
    sb.append("failed:");
    sb.append(this.failed);
    first = false;
    if (!first) sb.append(", ");
    sb.append("complete:");
    sb.append(this.complete);
    first = false;
    if (!first) sb.append(", ");
    sb.append("taskID:");
    if (this.taskID == null) {
      sb.append("null");
    } else {
      sb.append(this.taskID);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("tasks:");
    if (this.tasks == null) {
      sb.append("null");
    } else {
      sb.append(this.tasks);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("taskStatuses:");
    if (this.taskStatuses == null) {
      sb.append("null");
    } else {
      sb.append(this.taskStatuses);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("taskDiagnosticData:");
    if (this.taskDiagnosticData == null) {
      sb.append("null");
    } else {
      sb.append(this.taskDiagnosticData);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("counters:");
    if (this.counters == null) {
      sb.append("null");
    } else {
      sb.append(this.counters);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("mostRecentState:");
    if (this.mostRecentState == null) {
      sb.append("null");
    } else {
      sb.append(this.mostRecentState);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("runningAttempts:");
    if (this.runningAttempts == null) {
      sb.append("null");
    } else {
      sb.append(this.runningAttempts);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("successfulAttempt:");
    if (this.successfulAttempt == null) {
      sb.append("null");
    } else {
      sb.append(this.successfulAttempt);
    }
    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 (taskID != null) {
      taskID.validate();
    }
    if (counters != null) {
      counters.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 ThriftTaskInProgressStandardSchemeFactory implements SchemeFactory {
    public ThriftTaskInProgressStandardScheme getScheme() {
      return new ThriftTaskInProgressStandardScheme();
    }
  }

  private static class ThriftTaskInProgressStandardScheme extends StandardScheme<ThriftTaskInProgress> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, ThriftTaskInProgress 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 2: // EXEC_START_TIME
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.execStartTime = iprot.readI64();
              struct.setExecStartTimeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // EXEC_FINISH_TIME
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.execFinishTime = iprot.readI64();
              struct.setExecFinishTimeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // PROGRESS
            if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) {
              struct.progress = iprot.readDouble();
              struct.setProgressIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // START_TIME
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.startTime = iprot.readI64();
              struct.setStartTimeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // FAILED
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.failed = iprot.readBool();
              struct.setFailedIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // COMPLETE
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.complete = iprot.readBool();
              struct.setCompleteIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // TASK_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.taskID = new ThriftTaskID();
              struct.taskID.read(iprot);
              struct.setTaskIDIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 9: // TASKS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list26 = iprot.readListBegin();
                struct.tasks = new ArrayList<ThriftTaskAttemptID>(_list26.size);
                for (int _i27 = 0; _i27 < _list26.size; ++_i27)
                {
                  ThriftTaskAttemptID _elem28; // required
                  _elem28 = new ThriftTaskAttemptID();
                  _elem28.read(iprot);
                  struct.tasks.add(_elem28);
                }
                iprot.readListEnd();
              }
              struct.setTasksIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 10: // TASK_STATUSES
            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map29 = iprot.readMapBegin();
                struct.taskStatuses = new HashMap<String,ThriftTaskStatus>(2*_map29.size);
                for (int _i30 = 0; _i30 < _map29.size; ++_i30)
                {
                  String _key31; // required
                  ThriftTaskStatus _val32; // required
                  _key31 = iprot.readString();
                  _val32 = new ThriftTaskStatus();
                  _val32.read(iprot);
                  struct.taskStatuses.put(_key31, _val32);
                }
                iprot.readMapEnd();
              }
              struct.setTaskStatusesIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 11: // TASK_DIAGNOSTIC_DATA
            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map33 = iprot.readMapBegin();
                struct.taskDiagnosticData = new HashMap<String,List<String>>(2*_map33.size);
                for (int _i34 = 0; _i34 < _map33.size; ++_i34)
                {
                  String _key35; // required
                  List<String> _val36; // required
                  _key35 = iprot.readString();
                  {
                    org.apache.thrift.protocol.TList _list37 = iprot.readListBegin();
                    _val36 = new ArrayList<String>(_list37.size);
                    for (int _i38 = 0; _i38 < _list37.size; ++_i38)
                    {
                      String _elem39; // required
                      _elem39 = iprot.readString();
                      _val36.add(_elem39);
                    }
                    iprot.readListEnd();
                  }
                  struct.taskDiagnosticData.put(_key35, _val36);
                }
                iprot.readMapEnd();
              }
              struct.setTaskDiagnosticDataIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 12: // COUNTERS
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.counters = new ThriftGroupList();
              struct.counters.read(iprot);
              struct.setCountersIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 13: // MOST_RECENT_STATE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.mostRecentState = iprot.readString();
              struct.setMostRecentStateIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 14: // RUNNING_ATTEMPTS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list40 = iprot.readListBegin();
                struct.runningAttempts = new ArrayList<String>(_list40.size);
                for (int _i41 = 0; _i41 < _list40.size; ++_i41)
                {
                  String _elem42; // required
                  _elem42 = iprot.readString();
                  struct.runningAttempts.add(_elem42);
                }
                iprot.readListEnd();
              }
              struct.setRunningAttemptsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 15: // SUCCESSFUL_ATTEMPT
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.successfulAttempt = iprot.readString();
              struct.setSuccessfulAttemptIsSet(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, ThriftTaskInProgress struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(EXEC_START_TIME_FIELD_DESC);
      oprot.writeI64(struct.execStartTime);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(EXEC_FINISH_TIME_FIELD_DESC);
      oprot.writeI64(struct.execFinishTime);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(PROGRESS_FIELD_DESC);
      oprot.writeDouble(struct.progress);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(START_TIME_FIELD_DESC);
      oprot.writeI64(struct.startTime);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(FAILED_FIELD_DESC);
      oprot.writeBool(struct.failed);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(COMPLETE_FIELD_DESC);
      oprot.writeBool(struct.complete);
      oprot.writeFieldEnd();
      if (struct.taskID != null) {
        oprot.writeFieldBegin(TASK_ID_FIELD_DESC);
        struct.taskID.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.tasks != null) {
        oprot.writeFieldBegin(TASKS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.tasks.size()));
          for (ThriftTaskAttemptID _iter43 : struct.tasks)
          {
            _iter43.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.taskStatuses != null) {
        oprot.writeFieldBegin(TASK_STATUSES_FIELD_DESC);
        {
          oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRUCT, struct.taskStatuses.size()));
          for (Map.Entry<String, ThriftTaskStatus> _iter44 : struct.taskStatuses.entrySet())
          {
            oprot.writeString(_iter44.getKey());
            _iter44.getValue().write(oprot);
          }
          oprot.writeMapEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.taskDiagnosticData != null) {
        oprot.writeFieldBegin(TASK_DIAGNOSTIC_DATA_FIELD_DESC);
        {
          oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.LIST, struct.taskDiagnosticData.size()));
          for (Map.Entry<String, List<String>> _iter45 : struct.taskDiagnosticData.entrySet())
          {
            oprot.writeString(_iter45.getKey());
            {
              oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, _iter45.getValue().size()));
              for (String _iter46 : _iter45.getValue())
              {
                oprot.writeString(_iter46);
              }
              oprot.writeListEnd();
            }
          }
          oprot.writeMapEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.counters != null) {
        oprot.writeFieldBegin(COUNTERS_FIELD_DESC);
        struct.counters.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.mostRecentState != null) {
        oprot.writeFieldBegin(MOST_RECENT_STATE_FIELD_DESC);
        oprot.writeString(struct.mostRecentState);
        oprot.writeFieldEnd();
      }
      if (struct.runningAttempts != null) {
        oprot.writeFieldBegin(RUNNING_ATTEMPTS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.runningAttempts.size()));
          for (String _iter47 : struct.runningAttempts)
          {
            oprot.writeString(_iter47);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.successfulAttempt != null) {
        oprot.writeFieldBegin(SUCCESSFUL_ATTEMPT_FIELD_DESC);
        oprot.writeString(struct.successfulAttempt);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class ThriftTaskInProgressTupleSchemeFactory implements SchemeFactory {
    public ThriftTaskInProgressTupleScheme getScheme() {
      return new ThriftTaskInProgressTupleScheme();
    }
  }

  private static class ThriftTaskInProgressTupleScheme extends TupleScheme<ThriftTaskInProgress> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, ThriftTaskInProgress struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetExecStartTime()) {
        optionals.set(0);
      }
      if (struct.isSetExecFinishTime()) {
        optionals.set(1);
      }
      if (struct.isSetProgress()) {
        optionals.set(2);
      }
      if (struct.isSetStartTime()) {
        optionals.set(3);
      }
      if (struct.isSetFailed()) {
        optionals.set(4);
      }
      if (struct.isSetComplete()) {
        optionals.set(5);
      }
      if (struct.isSetTaskID()) {
        optionals.set(6);
      }
      if (struct.isSetTasks()) {
        optionals.set(7);
      }
      if (struct.isSetTaskStatuses()) {
        optionals.set(8);
      }
      if (struct.isSetTaskDiagnosticData()) {
        optionals.set(9);
      }
      if (struct.isSetCounters()) {
        optionals.set(10);
      }
      if (struct.isSetMostRecentState()) {
        optionals.set(11);
      }
      if (struct.isSetRunningAttempts()) {
        optionals.set(12);
      }
      if (struct.isSetSuccessfulAttempt()) {
        optionals.set(13);
      }
      oprot.writeBitSet(optionals, 14);
      if (struct.isSetExecStartTime()) {
        oprot.writeI64(struct.execStartTime);
      }
      if (struct.isSetExecFinishTime()) {
        oprot.writeI64(struct.execFinishTime);
      }
      if (struct.isSetProgress()) {
        oprot.writeDouble(struct.progress);
      }
      if (struct.isSetStartTime()) {
        oprot.writeI64(struct.startTime);
      }
      if (struct.isSetFailed()) {
        oprot.writeBool(struct.failed);
      }
      if (struct.isSetComplete()) {
        oprot.writeBool(struct.complete);
      }
      if (struct.isSetTaskID()) {
        struct.taskID.write(oprot);
      }
      if (struct.isSetTasks()) {
        {
          oprot.writeI32(struct.tasks.size());
          for (ThriftTaskAttemptID _iter48 : struct.tasks)
          {
            _iter48.write(oprot);
          }
        }
      }
      if (struct.isSetTaskStatuses()) {
        {
          oprot.writeI32(struct.taskStatuses.size());
          for (Map.Entry<String, ThriftTaskStatus> _iter49 : struct.taskStatuses.entrySet())
          {
            oprot.writeString(_iter49.getKey());
            _iter49.getValue().write(oprot);
          }
        }
      }
      if (struct.isSetTaskDiagnosticData()) {
        {
          oprot.writeI32(struct.taskDiagnosticData.size());
          for (Map.Entry<String, List<String>> _iter50 : struct.taskDiagnosticData.entrySet())
          {
            oprot.writeString(_iter50.getKey());
            {
              oprot.writeI32(_iter50.getValue().size());
              for (String _iter51 : _iter50.getValue())
              {
                oprot.writeString(_iter51);
              }
            }
          }
        }
      }
      if (struct.isSetCounters()) {
        struct.counters.write(oprot);
      }
      if (struct.isSetMostRecentState()) {
        oprot.writeString(struct.mostRecentState);
      }
      if (struct.isSetRunningAttempts()) {
        {
          oprot.writeI32(struct.runningAttempts.size());
          for (String _iter52 : struct.runningAttempts)
          {
            oprot.writeString(_iter52);
          }
        }
      }
      if (struct.isSetSuccessfulAttempt()) {
        oprot.writeString(struct.successfulAttempt);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, ThriftTaskInProgress struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(14);
      if (incoming.get(0)) {
        struct.execStartTime = iprot.readI64();
        struct.setExecStartTimeIsSet(true);
      }
      if (incoming.get(1)) {
        struct.execFinishTime = iprot.readI64();
        struct.setExecFinishTimeIsSet(true);
      }
      if (incoming.get(2)) {
        struct.progress = iprot.readDouble();
        struct.setProgressIsSet(true);
      }
      if (incoming.get(3)) {
        struct.startTime = iprot.readI64();
        struct.setStartTimeIsSet(true);
      }
      if (incoming.get(4)) {
        struct.failed = iprot.readBool();
        struct.setFailedIsSet(true);
      }
      if (incoming.get(5)) {
        struct.complete = iprot.readBool();
        struct.setCompleteIsSet(true);
      }
      if (incoming.get(6)) {
        struct.taskID = new ThriftTaskID();
        struct.taskID.read(iprot);
        struct.setTaskIDIsSet(true);
      }
      if (incoming.get(7)) {
        {
          org.apache.thrift.protocol.TList _list53 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
          struct.tasks = new ArrayList<ThriftTaskAttemptID>(_list53.size);
          for (int _i54 = 0; _i54 < _list53.size; ++_i54)
          {
            ThriftTaskAttemptID _elem55; // required
            _elem55 = new ThriftTaskAttemptID();
            _elem55.read(iprot);
            struct.tasks.add(_elem55);
          }
        }
        struct.setTasksIsSet(true);
      }
      if (incoming.get(8)) {
        {
          org.apache.thrift.protocol.TMap _map56 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
          struct.taskStatuses = new HashMap<String,ThriftTaskStatus>(2*_map56.size);
          for (int _i57 = 0; _i57 < _map56.size; ++_i57)
          {
            String _key58; // required
            ThriftTaskStatus _val59; // required
            _key58 = iprot.readString();
            _val59 = new ThriftTaskStatus();
            _val59.read(iprot);
            struct.taskStatuses.put(_key58, _val59);
          }
        }
        struct.setTaskStatusesIsSet(true);
      }
      if (incoming.get(9)) {
        {
          org.apache.thrift.protocol.TMap _map60 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.LIST, iprot.readI32());
          struct.taskDiagnosticData = new HashMap<String,List<String>>(2*_map60.size);
          for (int _i61 = 0; _i61 < _map60.size; ++_i61)
          {
            String _key62; // required
            List<String> _val63; // required
            _key62 = iprot.readString();
            {
              org.apache.thrift.protocol.TList _list64 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
              _val63 = new ArrayList<String>(_list64.size);
              for (int _i65 = 0; _i65 < _list64.size; ++_i65)
              {
                String _elem66; // required
                _elem66 = iprot.readString();
                _val63.add(_elem66);
              }
            }
            struct.taskDiagnosticData.put(_key62, _val63);
          }
        }
        struct.setTaskDiagnosticDataIsSet(true);
      }
      if (incoming.get(10)) {
        struct.counters = new ThriftGroupList();
        struct.counters.read(iprot);
        struct.setCountersIsSet(true);
      }
      if (incoming.get(11)) {
        struct.mostRecentState = iprot.readString();
        struct.setMostRecentStateIsSet(true);
      }
      if (incoming.get(12)) {
        {
          org.apache.thrift.protocol.TList _list67 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
          struct.runningAttempts = new ArrayList<String>(_list67.size);
          for (int _i68 = 0; _i68 < _list67.size; ++_i68)
          {
            String _elem69; // required
            _elem69 = iprot.readString();
            struct.runningAttempts.add(_elem69);
          }
        }
        struct.setRunningAttemptsIsSet(true);
      }
      if (incoming.get(13)) {
        struct.successfulAttempt = iprot.readString();
        struct.setSuccessfulAttemptIsSet(true);
      }
    }
  }

}

