/**
 * Autogenerated by Thrift Compiler (0.7.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 */
package org.apache.hadoop.thriftfs.jobtracker.api;

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);

  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 BitSet __isset_bit_vector = new BitSet(6);

  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_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    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_bit_vector.clear(__EXECSTARTTIME_ISSET_ID);
  }

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

  public void setExecStartTimeIsSet(boolean value) {
    __isset_bit_vector.set(__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_bit_vector.clear(__EXECFINISHTIME_ISSET_ID);
  }

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

  public void setExecFinishTimeIsSet(boolean value) {
    __isset_bit_vector.set(__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_bit_vector.clear(__PROGRESS_ISSET_ID);
  }

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

  public void setProgressIsSet(boolean value) {
    __isset_bit_vector.set(__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_bit_vector.clear(__STARTTIME_ISSET_ID);
  }

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

  public void setStartTimeIsSet(boolean value) {
    __isset_bit_vector.set(__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_bit_vector.clear(__FAILED_ISSET_ID);
  }

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

  public void setFailedIsSet(boolean value) {
    __isset_bit_vector.set(__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_bit_vector.clear(__COMPLETE_ISSET_ID);
  }

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

  public void setCompleteIsSet(boolean value) {
    __isset_bit_vector.set(__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 {
    org.apache.thrift.protocol.TField field;
    iprot.readStructBegin();
    while (true)
    {
      field = iprot.readFieldBegin();
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
        break;
      }
      switch (field.id) {
        case 2: // EXEC_START_TIME
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.execStartTime = iprot.readI64();
            setExecStartTimeIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // EXEC_FINISH_TIME
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.execFinishTime = iprot.readI64();
            setExecFinishTimeIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // PROGRESS
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
            this.progress = iprot.readDouble();
            setProgressIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 5: // START_TIME
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.startTime = iprot.readI64();
            setStartTimeIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 6: // FAILED
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
            this.failed = iprot.readBool();
            setFailedIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 7: // COMPLETE
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
            this.complete = iprot.readBool();
            setCompleteIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 8: // TASK_ID
          if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
            this.taskID = new ThriftTaskID();
            this.taskID.read(iprot);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 9: // TASKS
          if (field.type == org.apache.thrift.protocol.TType.LIST) {
            {
              org.apache.thrift.protocol.TList _list13 = iprot.readListBegin();
              this.tasks = new ArrayList<ThriftTaskAttemptID>(_list13.size);
              for (int _i14 = 0; _i14 < _list13.size; ++_i14)
              {
                ThriftTaskAttemptID _elem15; // required
                _elem15 = new ThriftTaskAttemptID();
                _elem15.read(iprot);
                this.tasks.add(_elem15);
              }
              iprot.readListEnd();
            }
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 10: // TASK_STATUSES
          if (field.type == org.apache.thrift.protocol.TType.MAP) {
            {
              org.apache.thrift.protocol.TMap _map16 = iprot.readMapBegin();
              this.taskStatuses = new HashMap<String,ThriftTaskStatus>(2*_map16.size);
              for (int _i17 = 0; _i17 < _map16.size; ++_i17)
              {
                String _key18; // required
                ThriftTaskStatus _val19; // required
                _key18 = iprot.readString();
                _val19 = new ThriftTaskStatus();
                _val19.read(iprot);
                this.taskStatuses.put(_key18, _val19);
              }
              iprot.readMapEnd();
            }
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 11: // TASK_DIAGNOSTIC_DATA
          if (field.type == org.apache.thrift.protocol.TType.MAP) {
            {
              org.apache.thrift.protocol.TMap _map20 = iprot.readMapBegin();
              this.taskDiagnosticData = new HashMap<String,List<String>>(2*_map20.size);
              for (int _i21 = 0; _i21 < _map20.size; ++_i21)
              {
                String _key22; // required
                List<String> _val23; // required
                _key22 = iprot.readString();
                {
                  org.apache.thrift.protocol.TList _list24 = iprot.readListBegin();
                  _val23 = new ArrayList<String>(_list24.size);
                  for (int _i25 = 0; _i25 < _list24.size; ++_i25)
                  {
                    String _elem26; // required
                    _elem26 = iprot.readString();
                    _val23.add(_elem26);
                  }
                  iprot.readListEnd();
                }
                this.taskDiagnosticData.put(_key22, _val23);
              }
              iprot.readMapEnd();
            }
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 12: // COUNTERS
          if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
            this.counters = new ThriftGroupList();
            this.counters.read(iprot);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 13: // MOST_RECENT_STATE
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.mostRecentState = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 14: // RUNNING_ATTEMPTS
          if (field.type == org.apache.thrift.protocol.TType.LIST) {
            {
              org.apache.thrift.protocol.TList _list27 = iprot.readListBegin();
              this.runningAttempts = new ArrayList<String>(_list27.size);
              for (int _i28 = 0; _i28 < _list27.size; ++_i28)
              {
                String _elem29; // required
                _elem29 = iprot.readString();
                this.runningAttempts.add(_elem29);
              }
              iprot.readListEnd();
            }
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 15: // SUCCESSFUL_ATTEMPT
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.successfulAttempt = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        default:
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
      }
      iprot.readFieldEnd();
    }
    iprot.readStructEnd();

    // check for required fields of primitive type, which can't be checked in the validate method
    validate();
  }

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

    oprot.writeStructBegin(STRUCT_DESC);
    oprot.writeFieldBegin(EXEC_START_TIME_FIELD_DESC);
    oprot.writeI64(this.execStartTime);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(EXEC_FINISH_TIME_FIELD_DESC);
    oprot.writeI64(this.execFinishTime);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(PROGRESS_FIELD_DESC);
    oprot.writeDouble(this.progress);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(START_TIME_FIELD_DESC);
    oprot.writeI64(this.startTime);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(FAILED_FIELD_DESC);
    oprot.writeBool(this.failed);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(COMPLETE_FIELD_DESC);
    oprot.writeBool(this.complete);
    oprot.writeFieldEnd();
    if (this.taskID != null) {
      oprot.writeFieldBegin(TASK_ID_FIELD_DESC);
      this.taskID.write(oprot);
      oprot.writeFieldEnd();
    }
    if (this.tasks != null) {
      oprot.writeFieldBegin(TASKS_FIELD_DESC);
      {
        oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.tasks.size()));
        for (ThriftTaskAttemptID _iter30 : this.tasks)
        {
          _iter30.write(oprot);
        }
        oprot.writeListEnd();
      }
      oprot.writeFieldEnd();
    }
    if (this.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, this.taskStatuses.size()));
        for (Map.Entry<String, ThriftTaskStatus> _iter31 : this.taskStatuses.entrySet())
        {
          oprot.writeString(_iter31.getKey());
          _iter31.getValue().write(oprot);
        }
        oprot.writeMapEnd();
      }
      oprot.writeFieldEnd();
    }
    if (this.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, this.taskDiagnosticData.size()));
        for (Map.Entry<String, List<String>> _iter32 : this.taskDiagnosticData.entrySet())
        {
          oprot.writeString(_iter32.getKey());
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, _iter32.getValue().size()));
            for (String _iter33 : _iter32.getValue())
            {
              oprot.writeString(_iter33);
            }
            oprot.writeListEnd();
          }
        }
        oprot.writeMapEnd();
      }
      oprot.writeFieldEnd();
    }
    if (this.counters != null) {
      oprot.writeFieldBegin(COUNTERS_FIELD_DESC);
      this.counters.write(oprot);
      oprot.writeFieldEnd();
    }
    if (this.mostRecentState != null) {
      oprot.writeFieldBegin(MOST_RECENT_STATE_FIELD_DESC);
      oprot.writeString(this.mostRecentState);
      oprot.writeFieldEnd();
    }
    if (this.runningAttempts != null) {
      oprot.writeFieldBegin(RUNNING_ATTEMPTS_FIELD_DESC);
      {
        oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, this.runningAttempts.size()));
        for (String _iter34 : this.runningAttempts)
        {
          oprot.writeString(_iter34);
        }
        oprot.writeListEnd();
      }
      oprot.writeFieldEnd();
    }
    if (this.successfulAttempt != null) {
      oprot.writeFieldBegin(SUCCESSFUL_ATTEMPT_FIELD_DESC);
      oprot.writeString(this.successfulAttempt);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @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
  }

  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_bit_vector = new BitSet(1);
      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);
    }
  }

}

