/**
 * Autogenerated by Thrift Compiler (0.20.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package com.jetbrains.python.console.protocol;

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

  private static final org.apache.thrift.protocol.TField COL_HEADERS_FIELD_DESC = new org.apache.thrift.protocol.TField("colHeaders", org.apache.thrift.protocol.TType.LIST, (short)1);
  private static final org.apache.thrift.protocol.TField ROW_HEADERS_FIELD_DESC = new org.apache.thrift.protocol.TField("rowHeaders", org.apache.thrift.protocol.TType.LIST, (short)2);

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

  public @org.apache.thrift.annotation.Nullable java.util.List<ColHeader> colHeaders; // required
  public @org.apache.thrift.annotation.Nullable java.util.List<RowHeader> rowHeaders; // 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 {
    COL_HEADERS((short)1, "colHeaders"),
    ROW_HEADERS((short)2, "rowHeaders");

    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: // COL_HEADERS
          return COL_HEADERS;
        case 2: // ROW_HEADERS
          return ROW_HEADERS;
        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;
    }

    @Override
    public short getThriftFieldId() {
      return _thriftId;
    }

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

  // isset id assignments
  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.COL_HEADERS, new org.apache.thrift.meta_data.FieldMetaData("colHeaders", 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, ColHeader.class))));
    tmpMap.put(_Fields.ROW_HEADERS, new org.apache.thrift.meta_data.FieldMetaData("rowHeaders", 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, RowHeader.class))));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ArrayHeaders.class, metaDataMap);
  }

  public ArrayHeaders() {
  }

  public ArrayHeaders(
    java.util.List<ColHeader> colHeaders,
    java.util.List<RowHeader> rowHeaders)
  {
    this();
    this.colHeaders = colHeaders;
    this.rowHeaders = rowHeaders;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public ArrayHeaders(ArrayHeaders other) {
    if (other.isSetColHeaders()) {
      java.util.List<ColHeader> __this__colHeaders = new java.util.ArrayList<ColHeader>(other.colHeaders.size());
      for (ColHeader other_element : other.colHeaders) {
        __this__colHeaders.add(new ColHeader(other_element));
      }
      this.colHeaders = __this__colHeaders;
    }
    if (other.isSetRowHeaders()) {
      java.util.List<RowHeader> __this__rowHeaders = new java.util.ArrayList<RowHeader>(other.rowHeaders.size());
      for (RowHeader other_element : other.rowHeaders) {
        __this__rowHeaders.add(new RowHeader(other_element));
      }
      this.rowHeaders = __this__rowHeaders;
    }
  }

  @Override
  public ArrayHeaders deepCopy() {
    return new ArrayHeaders(this);
  }

  @Override
  public void clear() {
    this.colHeaders = null;
    this.rowHeaders = null;
  }

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

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

  public void addToColHeaders(ColHeader elem) {
    if (this.colHeaders == null) {
      this.colHeaders = new java.util.ArrayList<ColHeader>();
    }
    this.colHeaders.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<ColHeader> getColHeaders() {
    return this.colHeaders;
  }

  public ArrayHeaders setColHeaders(@org.apache.thrift.annotation.Nullable java.util.List<ColHeader> colHeaders) {
    this.colHeaders = colHeaders;
    return this;
  }

  public void unsetColHeaders() {
    this.colHeaders = null;
  }

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

  public void setColHeadersIsSet(boolean value) {
    if (!value) {
      this.colHeaders = null;
    }
  }

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

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

  public void addToRowHeaders(RowHeader elem) {
    if (this.rowHeaders == null) {
      this.rowHeaders = new java.util.ArrayList<RowHeader>();
    }
    this.rowHeaders.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<RowHeader> getRowHeaders() {
    return this.rowHeaders;
  }

  public ArrayHeaders setRowHeaders(@org.apache.thrift.annotation.Nullable java.util.List<RowHeader> rowHeaders) {
    this.rowHeaders = rowHeaders;
    return this;
  }

  public void unsetRowHeaders() {
    this.rowHeaders = null;
  }

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

  public void setRowHeadersIsSet(boolean value) {
    if (!value) {
      this.rowHeaders = null;
    }
  }

  @Override
  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case COL_HEADERS:
      if (value == null) {
        unsetColHeaders();
      } else {
        setColHeaders((java.util.List<ColHeader>)value);
      }
      break;

    case ROW_HEADERS:
      if (value == null) {
        unsetRowHeaders();
      } else {
        setRowHeaders((java.util.List<RowHeader>)value);
      }
      break;

    }
  }

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

    case ROW_HEADERS:
      return getRowHeaders();

    }
    throw new java.lang.IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  @Override
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new java.lang.IllegalArgumentException();
    }

    switch (field) {
    case COL_HEADERS:
      return isSetColHeaders();
    case ROW_HEADERS:
      return isSetRowHeaders();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_colHeaders = true && this.isSetColHeaders();
    boolean that_present_colHeaders = true && that.isSetColHeaders();
    if (this_present_colHeaders || that_present_colHeaders) {
      if (!(this_present_colHeaders && that_present_colHeaders))
        return false;
      if (!this.colHeaders.equals(that.colHeaders))
        return false;
    }

    boolean this_present_rowHeaders = true && this.isSetRowHeaders();
    boolean that_present_rowHeaders = true && that.isSetRowHeaders();
    if (this_present_rowHeaders || that_present_rowHeaders) {
      if (!(this_present_rowHeaders && that_present_rowHeaders))
        return false;
      if (!this.rowHeaders.equals(that.rowHeaders))
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetColHeaders()) ? 131071 : 524287);
    if (isSetColHeaders())
      hashCode = hashCode * 8191 + colHeaders.hashCode();

    hashCode = hashCode * 8191 + ((isSetRowHeaders()) ? 131071 : 524287);
    if (isSetRowHeaders())
      hashCode = hashCode * 8191 + rowHeaders.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetColHeaders(), other.isSetColHeaders());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetColHeaders()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.colHeaders, other.colHeaders);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetRowHeaders(), other.isSetRowHeaders());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRowHeaders()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.rowHeaders, other.rowHeaders);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

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

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

  @Override
  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("ArrayHeaders(");
    boolean first = true;

    sb.append("colHeaders:");
    if (this.colHeaders == null) {
      sb.append("null");
    } else {
      sb.append(this.colHeaders);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("rowHeaders:");
    if (this.rowHeaders == null) {
      sb.append("null");
    } else {
      sb.append(this.rowHeaders);
    }
    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 {
      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 ArrayHeadersStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    @Override
    public ArrayHeadersStandardScheme getScheme() {
      return new ArrayHeadersStandardScheme();
    }
  }

  private static class ArrayHeadersStandardScheme extends org.apache.thrift.scheme.StandardScheme<ArrayHeaders> {

    @Override
    public void read(org.apache.thrift.protocol.TProtocol iprot, ArrayHeaders 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: // COL_HEADERS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
                struct.colHeaders = new java.util.ArrayList<ColHeader>(_list0.size);
                @org.apache.thrift.annotation.Nullable ColHeader _elem1;
                for (int _i2 = 0; _i2 < _list0.size; ++_i2)
                {
                  _elem1 = new ColHeader();
                  _elem1.read(iprot);
                  struct.colHeaders.add(_elem1);
                }
                iprot.readListEnd();
              }
              struct.setColHeadersIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // ROW_HEADERS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list3 = iprot.readListBegin();
                struct.rowHeaders = new java.util.ArrayList<RowHeader>(_list3.size);
                @org.apache.thrift.annotation.Nullable RowHeader _elem4;
                for (int _i5 = 0; _i5 < _list3.size; ++_i5)
                {
                  _elem4 = new RowHeader();
                  _elem4.read(iprot);
                  struct.rowHeaders.add(_elem4);
                }
                iprot.readListEnd();
              }
              struct.setRowHeadersIsSet(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();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.colHeaders != null) {
        oprot.writeFieldBegin(COL_HEADERS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.colHeaders.size()));
          for (ColHeader _iter6 : struct.colHeaders)
          {
            _iter6.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.rowHeaders != null) {
        oprot.writeFieldBegin(ROW_HEADERS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.rowHeaders.size()));
          for (RowHeader _iter7 : struct.rowHeaders)
          {
            _iter7.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class ArrayHeadersTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    @Override
    public ArrayHeadersTupleScheme getScheme() {
      return new ArrayHeadersTupleScheme();
    }
  }

  private static class ArrayHeadersTupleScheme extends org.apache.thrift.scheme.TupleScheme<ArrayHeaders> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, ArrayHeaders 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.isSetColHeaders()) {
        optionals.set(0);
      }
      if (struct.isSetRowHeaders()) {
        optionals.set(1);
      }
      oprot.writeBitSet(optionals, 2);
      if (struct.isSetColHeaders()) {
        {
          oprot.writeI32(struct.colHeaders.size());
          for (ColHeader _iter8 : struct.colHeaders)
          {
            _iter8.write(oprot);
          }
        }
      }
      if (struct.isSetRowHeaders()) {
        {
          oprot.writeI32(struct.rowHeaders.size());
          for (RowHeader _iter9 : struct.rowHeaders)
          {
            _iter9.write(oprot);
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, ArrayHeaders struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet incoming = iprot.readBitSet(2);
      if (incoming.get(0)) {
        {
          org.apache.thrift.protocol.TList _list10 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
          struct.colHeaders = new java.util.ArrayList<ColHeader>(_list10.size);
          @org.apache.thrift.annotation.Nullable ColHeader _elem11;
          for (int _i12 = 0; _i12 < _list10.size; ++_i12)
          {
            _elem11 = new ColHeader();
            _elem11.read(iprot);
            struct.colHeaders.add(_elem11);
          }
        }
        struct.setColHeadersIsSet(true);
      }
      if (incoming.get(1)) {
        {
          org.apache.thrift.protocol.TList _list13 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
          struct.rowHeaders = new java.util.ArrayList<RowHeader>(_list13.size);
          @org.apache.thrift.annotation.Nullable RowHeader _elem14;
          for (int _i15 = 0; _i15 < _list13.size; ++_i15)
          {
            _elem14 = new RowHeader();
            _elem14.read(iprot);
            struct.rowHeaders.add(_elem14);
          }
        }
        struct.setRowHeadersIsSet(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();
  }
}

