TWorkloadSchedPolicy.java

/**
 * Autogenerated by Thrift Compiler (0.16.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.doris.thrift;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.16.0)", date = "2026-05-14")
public class TWorkloadSchedPolicy implements org.apache.thrift.TBase<TWorkloadSchedPolicy, TWorkloadSchedPolicy._Fields>, java.io.Serializable, Cloneable, Comparable<TWorkloadSchedPolicy> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TWorkloadSchedPolicy");

  private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("version", org.apache.thrift.protocol.TType.I32, (short)3);
  private static final org.apache.thrift.protocol.TField PRIORITY_FIELD_DESC = new org.apache.thrift.protocol.TField("priority", org.apache.thrift.protocol.TType.I32, (short)4);
  private static final org.apache.thrift.protocol.TField ENABLED_FIELD_DESC = new org.apache.thrift.protocol.TField("enabled", org.apache.thrift.protocol.TType.BOOL, (short)5);
  private static final org.apache.thrift.protocol.TField CONDITION_LIST_FIELD_DESC = new org.apache.thrift.protocol.TField("condition_list", org.apache.thrift.protocol.TType.LIST, (short)6);
  private static final org.apache.thrift.protocol.TField ACTION_LIST_FIELD_DESC = new org.apache.thrift.protocol.TField("action_list", org.apache.thrift.protocol.TType.LIST, (short)7);
  private static final org.apache.thrift.protocol.TField WG_ID_LIST_FIELD_DESC = new org.apache.thrift.protocol.TField("wg_id_list", org.apache.thrift.protocol.TType.LIST, (short)8);

  private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new TWorkloadSchedPolicyStandardSchemeFactory();
  private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new TWorkloadSchedPolicyTupleSchemeFactory();

  public long id; // optional
  public @org.apache.thrift.annotation.Nullable java.lang.String name; // optional
  public int version; // optional
  public int priority; // optional
  public boolean enabled; // optional
  public @org.apache.thrift.annotation.Nullable java.util.List<TWorkloadCondition> condition_list; // optional
  public @org.apache.thrift.annotation.Nullable java.util.List<TWorkloadAction> action_list; // optional
  public @org.apache.thrift.annotation.Nullable java.util.List<java.lang.Long> wg_id_list; // optional

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    ID((short)1, "id"),
    NAME((short)2, "name"),
    VERSION((short)3, "version"),
    PRIORITY((short)4, "priority"),
    ENABLED((short)5, "enabled"),
    CONDITION_LIST((short)6, "condition_list"),
    ACTION_LIST((short)7, "action_list"),
    WG_ID_LIST((short)8, "wg_id_list");

    private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();

    static {
      for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // ID
          return ID;
        case 2: // NAME
          return NAME;
        case 3: // VERSION
          return VERSION;
        case 4: // PRIORITY
          return PRIORITY;
        case 5: // ENABLED
          return ENABLED;
        case 6: // CONDITION_LIST
          return CONDITION_LIST;
        case 7: // ACTION_LIST
          return ACTION_LIST;
        case 8: // WG_ID_LIST
          return WG_ID_LIST;
        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 java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByName(java.lang.String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final java.lang.String _fieldName;

    _Fields(short thriftId, java.lang.String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public java.lang.String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final int __ID_ISSET_ID = 0;
  private static final int __VERSION_ISSET_ID = 1;
  private static final int __PRIORITY_ISSET_ID = 2;
  private static final int __ENABLED_ISSET_ID = 3;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.ID,_Fields.NAME,_Fields.VERSION,_Fields.PRIORITY,_Fields.ENABLED,_Fields.CONDITION_LIST,_Fields.ACTION_LIST,_Fields.WG_ID_LIST};
  public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.VERSION, new org.apache.thrift.meta_data.FieldMetaData("version", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.PRIORITY, new org.apache.thrift.meta_data.FieldMetaData("priority", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.ENABLED, new org.apache.thrift.meta_data.FieldMetaData("enabled", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.CONDITION_LIST, new org.apache.thrift.meta_data.FieldMetaData("condition_list", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        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, TWorkloadCondition.class))));
    tmpMap.put(_Fields.ACTION_LIST, new org.apache.thrift.meta_data.FieldMetaData("action_list", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        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, TWorkloadAction.class))));
    tmpMap.put(_Fields.WG_ID_LIST, new org.apache.thrift.meta_data.FieldMetaData("wg_id_list", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        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.I64))));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TWorkloadSchedPolicy.class, metaDataMap);
  }

  public TWorkloadSchedPolicy() {
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TWorkloadSchedPolicy(TWorkloadSchedPolicy other) {
    __isset_bitfield = other.__isset_bitfield;
    this.id = other.id;
    if (other.isSetName()) {
      this.name = other.name;
    }
    this.version = other.version;
    this.priority = other.priority;
    this.enabled = other.enabled;
    if (other.isSetConditionList()) {
      java.util.List<TWorkloadCondition> __this__condition_list = new java.util.ArrayList<TWorkloadCondition>(other.condition_list.size());
      for (TWorkloadCondition other_element : other.condition_list) {
        __this__condition_list.add(new TWorkloadCondition(other_element));
      }
      this.condition_list = __this__condition_list;
    }
    if (other.isSetActionList()) {
      java.util.List<TWorkloadAction> __this__action_list = new java.util.ArrayList<TWorkloadAction>(other.action_list.size());
      for (TWorkloadAction other_element : other.action_list) {
        __this__action_list.add(new TWorkloadAction(other_element));
      }
      this.action_list = __this__action_list;
    }
    if (other.isSetWgIdList()) {
      java.util.List<java.lang.Long> __this__wg_id_list = new java.util.ArrayList<java.lang.Long>(other.wg_id_list);
      this.wg_id_list = __this__wg_id_list;
    }
  }

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

  @Override
  public void clear() {
    setIdIsSet(false);
    this.id = 0;
    this.name = null;
    setVersionIsSet(false);
    this.version = 0;
    setPriorityIsSet(false);
    this.priority = 0;
    setEnabledIsSet(false);
    this.enabled = false;
    this.condition_list = null;
    this.action_list = null;
    this.wg_id_list = null;
  }

  public long getId() {
    return this.id;
  }

  public TWorkloadSchedPolicy setId(long id) {
    this.id = id;
    setIdIsSet(true);
    return this;
  }

  public void unsetId() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __ID_ISSET_ID);
  }

  /** Returns true if field id is set (has been assigned a value) and false otherwise */
  public boolean isSetId() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __ID_ISSET_ID);
  }

  public void setIdIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __ID_ISSET_ID, value);
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getName() {
    return this.name;
  }

  public TWorkloadSchedPolicy setName(@org.apache.thrift.annotation.Nullable java.lang.String name) {
    this.name = name;
    return this;
  }

  public void unsetName() {
    this.name = null;
  }

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

  public void setNameIsSet(boolean value) {
    if (!value) {
      this.name = null;
    }
  }

  public int getVersion() {
    return this.version;
  }

  public TWorkloadSchedPolicy setVersion(int version) {
    this.version = version;
    setVersionIsSet(true);
    return this;
  }

  public void unsetVersion() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __VERSION_ISSET_ID);
  }

  /** Returns true if field version is set (has been assigned a value) and false otherwise */
  public boolean isSetVersion() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __VERSION_ISSET_ID);
  }

  public void setVersionIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __VERSION_ISSET_ID, value);
  }

  public int getPriority() {
    return this.priority;
  }

  public TWorkloadSchedPolicy setPriority(int priority) {
    this.priority = priority;
    setPriorityIsSet(true);
    return this;
  }

  public void unsetPriority() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __PRIORITY_ISSET_ID);
  }

  /** Returns true if field priority is set (has been assigned a value) and false otherwise */
  public boolean isSetPriority() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __PRIORITY_ISSET_ID);
  }

  public void setPriorityIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __PRIORITY_ISSET_ID, value);
  }

  public boolean isEnabled() {
    return this.enabled;
  }

  public TWorkloadSchedPolicy setEnabled(boolean enabled) {
    this.enabled = enabled;
    setEnabledIsSet(true);
    return this;
  }

  public void unsetEnabled() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __ENABLED_ISSET_ID);
  }

  /** Returns true if field enabled is set (has been assigned a value) and false otherwise */
  public boolean isSetEnabled() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __ENABLED_ISSET_ID);
  }

  public void setEnabledIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __ENABLED_ISSET_ID, value);
  }

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

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<TWorkloadCondition> getConditionListIterator() {
    return (this.condition_list == null) ? null : this.condition_list.iterator();
  }

  public void addToConditionList(TWorkloadCondition elem) {
    if (this.condition_list == null) {
      this.condition_list = new java.util.ArrayList<TWorkloadCondition>();
    }
    this.condition_list.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<TWorkloadCondition> getConditionList() {
    return this.condition_list;
  }

  public TWorkloadSchedPolicy setConditionList(@org.apache.thrift.annotation.Nullable java.util.List<TWorkloadCondition> condition_list) {
    this.condition_list = condition_list;
    return this;
  }

  public void unsetConditionList() {
    this.condition_list = null;
  }

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

  public void setConditionListIsSet(boolean value) {
    if (!value) {
      this.condition_list = null;
    }
  }

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

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<TWorkloadAction> getActionListIterator() {
    return (this.action_list == null) ? null : this.action_list.iterator();
  }

  public void addToActionList(TWorkloadAction elem) {
    if (this.action_list == null) {
      this.action_list = new java.util.ArrayList<TWorkloadAction>();
    }
    this.action_list.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<TWorkloadAction> getActionList() {
    return this.action_list;
  }

  public TWorkloadSchedPolicy setActionList(@org.apache.thrift.annotation.Nullable java.util.List<TWorkloadAction> action_list) {
    this.action_list = action_list;
    return this;
  }

  public void unsetActionList() {
    this.action_list = null;
  }

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

  public void setActionListIsSet(boolean value) {
    if (!value) {
      this.action_list = null;
    }
  }

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

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<java.lang.Long> getWgIdListIterator() {
    return (this.wg_id_list == null) ? null : this.wg_id_list.iterator();
  }

  public void addToWgIdList(long elem) {
    if (this.wg_id_list == null) {
      this.wg_id_list = new java.util.ArrayList<java.lang.Long>();
    }
    this.wg_id_list.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<java.lang.Long> getWgIdList() {
    return this.wg_id_list;
  }

  public TWorkloadSchedPolicy setWgIdList(@org.apache.thrift.annotation.Nullable java.util.List<java.lang.Long> wg_id_list) {
    this.wg_id_list = wg_id_list;
    return this;
  }

  public void unsetWgIdList() {
    this.wg_id_list = null;
  }

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

  public void setWgIdListIsSet(boolean value) {
    if (!value) {
      this.wg_id_list = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case ID:
      if (value == null) {
        unsetId();
      } else {
        setId((java.lang.Long)value);
      }
      break;

    case NAME:
      if (value == null) {
        unsetName();
      } else {
        setName((java.lang.String)value);
      }
      break;

    case VERSION:
      if (value == null) {
        unsetVersion();
      } else {
        setVersion((java.lang.Integer)value);
      }
      break;

    case PRIORITY:
      if (value == null) {
        unsetPriority();
      } else {
        setPriority((java.lang.Integer)value);
      }
      break;

    case ENABLED:
      if (value == null) {
        unsetEnabled();
      } else {
        setEnabled((java.lang.Boolean)value);
      }
      break;

    case CONDITION_LIST:
      if (value == null) {
        unsetConditionList();
      } else {
        setConditionList((java.util.List<TWorkloadCondition>)value);
      }
      break;

    case ACTION_LIST:
      if (value == null) {
        unsetActionList();
      } else {
        setActionList((java.util.List<TWorkloadAction>)value);
      }
      break;

    case WG_ID_LIST:
      if (value == null) {
        unsetWgIdList();
      } else {
        setWgIdList((java.util.List<java.lang.Long>)value);
      }
      break;

    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.Object getFieldValue(_Fields field) {
    switch (field) {
    case ID:
      return getId();

    case NAME:
      return getName();

    case VERSION:
      return getVersion();

    case PRIORITY:
      return getPriority();

    case ENABLED:
      return isEnabled();

    case CONDITION_LIST:
      return getConditionList();

    case ACTION_LIST:
      return getActionList();

    case WG_ID_LIST:
      return getWgIdList();

    }
    throw new java.lang.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 java.lang.IllegalArgumentException();
    }

    switch (field) {
    case ID:
      return isSetId();
    case NAME:
      return isSetName();
    case VERSION:
      return isSetVersion();
    case PRIORITY:
      return isSetPriority();
    case ENABLED:
      return isSetEnabled();
    case CONDITION_LIST:
      return isSetConditionList();
    case ACTION_LIST:
      return isSetActionList();
    case WG_ID_LIST:
      return isSetWgIdList();
    }
    throw new java.lang.IllegalStateException();
  }

  @Override
  public boolean equals(java.lang.Object that) {
    if (that instanceof TWorkloadSchedPolicy)
      return this.equals((TWorkloadSchedPolicy)that);
    return false;
  }

  public boolean equals(TWorkloadSchedPolicy that) {
    if (that == null)
      return false;
    if (this == that)
      return true;

    boolean this_present_id = true && this.isSetId();
    boolean that_present_id = true && that.isSetId();
    if (this_present_id || that_present_id) {
      if (!(this_present_id && that_present_id))
        return false;
      if (this.id != that.id)
        return false;
    }

    boolean this_present_name = true && this.isSetName();
    boolean that_present_name = true && that.isSetName();
    if (this_present_name || that_present_name) {
      if (!(this_present_name && that_present_name))
        return false;
      if (!this.name.equals(that.name))
        return false;
    }

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

    boolean this_present_priority = true && this.isSetPriority();
    boolean that_present_priority = true && that.isSetPriority();
    if (this_present_priority || that_present_priority) {
      if (!(this_present_priority && that_present_priority))
        return false;
      if (this.priority != that.priority)
        return false;
    }

    boolean this_present_enabled = true && this.isSetEnabled();
    boolean that_present_enabled = true && that.isSetEnabled();
    if (this_present_enabled || that_present_enabled) {
      if (!(this_present_enabled && that_present_enabled))
        return false;
      if (this.enabled != that.enabled)
        return false;
    }

    boolean this_present_condition_list = true && this.isSetConditionList();
    boolean that_present_condition_list = true && that.isSetConditionList();
    if (this_present_condition_list || that_present_condition_list) {
      if (!(this_present_condition_list && that_present_condition_list))
        return false;
      if (!this.condition_list.equals(that.condition_list))
        return false;
    }

    boolean this_present_action_list = true && this.isSetActionList();
    boolean that_present_action_list = true && that.isSetActionList();
    if (this_present_action_list || that_present_action_list) {
      if (!(this_present_action_list && that_present_action_list))
        return false;
      if (!this.action_list.equals(that.action_list))
        return false;
    }

    boolean this_present_wg_id_list = true && this.isSetWgIdList();
    boolean that_present_wg_id_list = true && that.isSetWgIdList();
    if (this_present_wg_id_list || that_present_wg_id_list) {
      if (!(this_present_wg_id_list && that_present_wg_id_list))
        return false;
      if (!this.wg_id_list.equals(that.wg_id_list))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    int hashCode = 1;

    hashCode = hashCode * 8191 + ((isSetId()) ? 131071 : 524287);
    if (isSetId())
      hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(id);

    hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287);
    if (isSetName())
      hashCode = hashCode * 8191 + name.hashCode();

    hashCode = hashCode * 8191 + ((isSetVersion()) ? 131071 : 524287);
    if (isSetVersion())
      hashCode = hashCode * 8191 + version;

    hashCode = hashCode * 8191 + ((isSetPriority()) ? 131071 : 524287);
    if (isSetPriority())
      hashCode = hashCode * 8191 + priority;

    hashCode = hashCode * 8191 + ((isSetEnabled()) ? 131071 : 524287);
    if (isSetEnabled())
      hashCode = hashCode * 8191 + ((enabled) ? 131071 : 524287);

    hashCode = hashCode * 8191 + ((isSetConditionList()) ? 131071 : 524287);
    if (isSetConditionList())
      hashCode = hashCode * 8191 + condition_list.hashCode();

    hashCode = hashCode * 8191 + ((isSetActionList()) ? 131071 : 524287);
    if (isSetActionList())
      hashCode = hashCode * 8191 + action_list.hashCode();

    hashCode = hashCode * 8191 + ((isSetWgIdList()) ? 131071 : 524287);
    if (isSetWgIdList())
      hashCode = hashCode * 8191 + wg_id_list.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetId(), other.isSetId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, other.id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetName(), other.isSetName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetName()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetVersion(), other.isSetVersion());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetVersion()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.version, other.version);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetPriority(), other.isSetPriority());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPriority()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.priority, other.priority);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetEnabled(), other.isSetEnabled());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEnabled()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.enabled, other.enabled);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetConditionList(), other.isSetConditionList());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetConditionList()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.condition_list, other.condition_list);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetActionList(), other.isSetActionList());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetActionList()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.action_list, other.action_list);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetWgIdList(), other.isSetWgIdList());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetWgIdList()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.wg_id_list, other.wg_id_list);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  @org.apache.thrift.annotation.Nullable
  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    scheme(iprot).read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    scheme(oprot).write(oprot, this);
  }

  @Override
  public java.lang.String toString() {
    java.lang.StringBuilder sb = new java.lang.StringBuilder("TWorkloadSchedPolicy(");
    boolean first = true;

    if (isSetId()) {
      sb.append("id:");
      sb.append(this.id);
      first = false;
    }
    if (isSetName()) {
      if (!first) sb.append(", ");
      sb.append("name:");
      if (this.name == null) {
        sb.append("null");
      } else {
        sb.append(this.name);
      }
      first = false;
    }
    if (isSetVersion()) {
      if (!first) sb.append(", ");
      sb.append("version:");
      sb.append(this.version);
      first = false;
    }
    if (isSetPriority()) {
      if (!first) sb.append(", ");
      sb.append("priority:");
      sb.append(this.priority);
      first = false;
    }
    if (isSetEnabled()) {
      if (!first) sb.append(", ");
      sb.append("enabled:");
      sb.append(this.enabled);
      first = false;
    }
    if (isSetConditionList()) {
      if (!first) sb.append(", ");
      sb.append("condition_list:");
      if (this.condition_list == null) {
        sb.append("null");
      } else {
        sb.append(this.condition_list);
      }
      first = false;
    }
    if (isSetActionList()) {
      if (!first) sb.append(", ");
      sb.append("action_list:");
      if (this.action_list == null) {
        sb.append("null");
      } else {
        sb.append(this.action_list);
      }
      first = false;
    }
    if (isSetWgIdList()) {
      if (!first) sb.append(", ");
      sb.append("wg_id_list:");
      if (this.wg_id_list == null) {
        sb.append("null");
      } else {
        sb.append(this.wg_id_list);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // check for sub-struct validity
  }

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

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.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 TWorkloadSchedPolicyStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TWorkloadSchedPolicyStandardScheme getScheme() {
      return new TWorkloadSchedPolicyStandardScheme();
    }
  }

  private static class TWorkloadSchedPolicyStandardScheme extends org.apache.thrift.scheme.StandardScheme<TWorkloadSchedPolicy> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TWorkloadSchedPolicy struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
          break;
        }
        switch (schemeField.id) {
          case 1: // ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.id = iprot.readI64();
              struct.setIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.name = iprot.readString();
              struct.setNameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // VERSION
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.version = iprot.readI32();
              struct.setVersionIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // PRIORITY
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.priority = iprot.readI32();
              struct.setPriorityIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // ENABLED
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.enabled = iprot.readBool();
              struct.setEnabledIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // CONDITION_LIST
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list138 = iprot.readListBegin();
                struct.condition_list = new java.util.ArrayList<TWorkloadCondition>(_list138.size);
                @org.apache.thrift.annotation.Nullable TWorkloadCondition _elem139;
                for (int _i140 = 0; _i140 < _list138.size; ++_i140)
                {
                  _elem139 = new TWorkloadCondition();
                  _elem139.read(iprot);
                  struct.condition_list.add(_elem139);
                }
                iprot.readListEnd();
              }
              struct.setConditionListIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // ACTION_LIST
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list141 = iprot.readListBegin();
                struct.action_list = new java.util.ArrayList<TWorkloadAction>(_list141.size);
                @org.apache.thrift.annotation.Nullable TWorkloadAction _elem142;
                for (int _i143 = 0; _i143 < _list141.size; ++_i143)
                {
                  _elem142 = new TWorkloadAction();
                  _elem142.read(iprot);
                  struct.action_list.add(_elem142);
                }
                iprot.readListEnd();
              }
              struct.setActionListIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // WG_ID_LIST
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list144 = iprot.readListBegin();
                struct.wg_id_list = new java.util.ArrayList<java.lang.Long>(_list144.size);
                long _elem145;
                for (int _i146 = 0; _i146 < _list144.size; ++_i146)
                {
                  _elem145 = iprot.readI64();
                  struct.wg_id_list.add(_elem145);
                }
                iprot.readListEnd();
              }
              struct.setWgIdListIsSet(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, TWorkloadSchedPolicy struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.isSetId()) {
        oprot.writeFieldBegin(ID_FIELD_DESC);
        oprot.writeI64(struct.id);
        oprot.writeFieldEnd();
      }
      if (struct.name != null) {
        if (struct.isSetName()) {
          oprot.writeFieldBegin(NAME_FIELD_DESC);
          oprot.writeString(struct.name);
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetVersion()) {
        oprot.writeFieldBegin(VERSION_FIELD_DESC);
        oprot.writeI32(struct.version);
        oprot.writeFieldEnd();
      }
      if (struct.isSetPriority()) {
        oprot.writeFieldBegin(PRIORITY_FIELD_DESC);
        oprot.writeI32(struct.priority);
        oprot.writeFieldEnd();
      }
      if (struct.isSetEnabled()) {
        oprot.writeFieldBegin(ENABLED_FIELD_DESC);
        oprot.writeBool(struct.enabled);
        oprot.writeFieldEnd();
      }
      if (struct.condition_list != null) {
        if (struct.isSetConditionList()) {
          oprot.writeFieldBegin(CONDITION_LIST_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.condition_list.size()));
            for (TWorkloadCondition _iter147 : struct.condition_list)
            {
              _iter147.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.action_list != null) {
        if (struct.isSetActionList()) {
          oprot.writeFieldBegin(ACTION_LIST_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.action_list.size()));
            for (TWorkloadAction _iter148 : struct.action_list)
            {
              _iter148.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.wg_id_list != null) {
        if (struct.isSetWgIdList()) {
          oprot.writeFieldBegin(WG_ID_LIST_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I64, struct.wg_id_list.size()));
            for (long _iter149 : struct.wg_id_list)
            {
              oprot.writeI64(_iter149);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class TWorkloadSchedPolicyTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TWorkloadSchedPolicyTupleScheme getScheme() {
      return new TWorkloadSchedPolicyTupleScheme();
    }
  }

  private static class TWorkloadSchedPolicyTupleScheme extends org.apache.thrift.scheme.TupleScheme<TWorkloadSchedPolicy> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TWorkloadSchedPolicy struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetId()) {
        optionals.set(0);
      }
      if (struct.isSetName()) {
        optionals.set(1);
      }
      if (struct.isSetVersion()) {
        optionals.set(2);
      }
      if (struct.isSetPriority()) {
        optionals.set(3);
      }
      if (struct.isSetEnabled()) {
        optionals.set(4);
      }
      if (struct.isSetConditionList()) {
        optionals.set(5);
      }
      if (struct.isSetActionList()) {
        optionals.set(6);
      }
      if (struct.isSetWgIdList()) {
        optionals.set(7);
      }
      oprot.writeBitSet(optionals, 8);
      if (struct.isSetId()) {
        oprot.writeI64(struct.id);
      }
      if (struct.isSetName()) {
        oprot.writeString(struct.name);
      }
      if (struct.isSetVersion()) {
        oprot.writeI32(struct.version);
      }
      if (struct.isSetPriority()) {
        oprot.writeI32(struct.priority);
      }
      if (struct.isSetEnabled()) {
        oprot.writeBool(struct.enabled);
      }
      if (struct.isSetConditionList()) {
        {
          oprot.writeI32(struct.condition_list.size());
          for (TWorkloadCondition _iter150 : struct.condition_list)
          {
            _iter150.write(oprot);
          }
        }
      }
      if (struct.isSetActionList()) {
        {
          oprot.writeI32(struct.action_list.size());
          for (TWorkloadAction _iter151 : struct.action_list)
          {
            _iter151.write(oprot);
          }
        }
      }
      if (struct.isSetWgIdList()) {
        {
          oprot.writeI32(struct.wg_id_list.size());
          for (long _iter152 : struct.wg_id_list)
          {
            oprot.writeI64(_iter152);
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TWorkloadSchedPolicy struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet incoming = iprot.readBitSet(8);
      if (incoming.get(0)) {
        struct.id = iprot.readI64();
        struct.setIdIsSet(true);
      }
      if (incoming.get(1)) {
        struct.name = iprot.readString();
        struct.setNameIsSet(true);
      }
      if (incoming.get(2)) {
        struct.version = iprot.readI32();
        struct.setVersionIsSet(true);
      }
      if (incoming.get(3)) {
        struct.priority = iprot.readI32();
        struct.setPriorityIsSet(true);
      }
      if (incoming.get(4)) {
        struct.enabled = iprot.readBool();
        struct.setEnabledIsSet(true);
      }
      if (incoming.get(5)) {
        {
          org.apache.thrift.protocol.TList _list153 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
          struct.condition_list = new java.util.ArrayList<TWorkloadCondition>(_list153.size);
          @org.apache.thrift.annotation.Nullable TWorkloadCondition _elem154;
          for (int _i155 = 0; _i155 < _list153.size; ++_i155)
          {
            _elem154 = new TWorkloadCondition();
            _elem154.read(iprot);
            struct.condition_list.add(_elem154);
          }
        }
        struct.setConditionListIsSet(true);
      }
      if (incoming.get(6)) {
        {
          org.apache.thrift.protocol.TList _list156 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
          struct.action_list = new java.util.ArrayList<TWorkloadAction>(_list156.size);
          @org.apache.thrift.annotation.Nullable TWorkloadAction _elem157;
          for (int _i158 = 0; _i158 < _list156.size; ++_i158)
          {
            _elem157 = new TWorkloadAction();
            _elem157.read(iprot);
            struct.action_list.add(_elem157);
          }
        }
        struct.setActionListIsSet(true);
      }
      if (incoming.get(7)) {
        {
          org.apache.thrift.protocol.TList _list159 = iprot.readListBegin(org.apache.thrift.protocol.TType.I64);
          struct.wg_id_list = new java.util.ArrayList<java.lang.Long>(_list159.size);
          long _elem160;
          for (int _i161 = 0; _i161 < _list159.size; ++_i161)
          {
            _elem160 = iprot.readI64();
            struct.wg_id_list.add(_elem160);
          }
        }
        struct.setWgIdListIsSet(true);
      }
    }
  }

  private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
    return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
  }
}