TAnalyticWindow.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 TAnalyticWindow implements org.apache.thrift.TBase<TAnalyticWindow, TAnalyticWindow._Fields>, java.io.Serializable, Cloneable, Comparable<TAnalyticWindow> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAnalyticWindow");

  private static final org.apache.thrift.protocol.TField TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("type", org.apache.thrift.protocol.TType.I32, (short)1);
  private static final org.apache.thrift.protocol.TField WINDOW_START_FIELD_DESC = new org.apache.thrift.protocol.TField("window_start", org.apache.thrift.protocol.TType.STRUCT, (short)2);
  private static final org.apache.thrift.protocol.TField WINDOW_END_FIELD_DESC = new org.apache.thrift.protocol.TField("window_end", org.apache.thrift.protocol.TType.STRUCT, (short)3);

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

  /**
   * 
   * @see TAnalyticWindowType
   */
  public @org.apache.thrift.annotation.Nullable TAnalyticWindowType type; // required
  public @org.apache.thrift.annotation.Nullable TAnalyticWindowBoundary window_start; // optional
  public @org.apache.thrift.annotation.Nullable TAnalyticWindowBoundary window_end; // 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 {
    /**
     * 
     * @see TAnalyticWindowType
     */
    TYPE((short)1, "type"),
    WINDOW_START((short)2, "window_start"),
    WINDOW_END((short)3, "window_end");

    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: // TYPE
          return TYPE;
        case 2: // WINDOW_START
          return WINDOW_START;
        case 3: // WINDOW_END
          return WINDOW_END;
        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 _Fields optionals[] = {_Fields.WINDOW_START,_Fields.WINDOW_END};
  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.TYPE, new org.apache.thrift.meta_data.FieldMetaData("type", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TAnalyticWindowType.class)));
    tmpMap.put(_Fields.WINDOW_START, new org.apache.thrift.meta_data.FieldMetaData("window_start", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TAnalyticWindowBoundary.class)));
    tmpMap.put(_Fields.WINDOW_END, new org.apache.thrift.meta_data.FieldMetaData("window_end", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TAnalyticWindowBoundary.class)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAnalyticWindow.class, metaDataMap);
  }

  public TAnalyticWindow() {
  }

  public TAnalyticWindow(
    TAnalyticWindowType type)
  {
    this();
    this.type = type;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TAnalyticWindow(TAnalyticWindow other) {
    if (other.isSetType()) {
      this.type = other.type;
    }
    if (other.isSetWindowStart()) {
      this.window_start = new TAnalyticWindowBoundary(other.window_start);
    }
    if (other.isSetWindowEnd()) {
      this.window_end = new TAnalyticWindowBoundary(other.window_end);
    }
  }

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

  @Override
  public void clear() {
    this.type = null;
    this.window_start = null;
    this.window_end = null;
  }

  /**
   * 
   * @see TAnalyticWindowType
   */
  @org.apache.thrift.annotation.Nullable
  public TAnalyticWindowType getType() {
    return this.type;
  }

  /**
   * 
   * @see TAnalyticWindowType
   */
  public TAnalyticWindow setType(@org.apache.thrift.annotation.Nullable TAnalyticWindowType type) {
    this.type = type;
    return this;
  }

  public void unsetType() {
    this.type = null;
  }

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

  public void setTypeIsSet(boolean value) {
    if (!value) {
      this.type = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public TAnalyticWindowBoundary getWindowStart() {
    return this.window_start;
  }

  public TAnalyticWindow setWindowStart(@org.apache.thrift.annotation.Nullable TAnalyticWindowBoundary window_start) {
    this.window_start = window_start;
    return this;
  }

  public void unsetWindowStart() {
    this.window_start = null;
  }

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

  public void setWindowStartIsSet(boolean value) {
    if (!value) {
      this.window_start = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public TAnalyticWindowBoundary getWindowEnd() {
    return this.window_end;
  }

  public TAnalyticWindow setWindowEnd(@org.apache.thrift.annotation.Nullable TAnalyticWindowBoundary window_end) {
    this.window_end = window_end;
    return this;
  }

  public void unsetWindowEnd() {
    this.window_end = null;
  }

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

  public void setWindowEndIsSet(boolean value) {
    if (!value) {
      this.window_end = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case TYPE:
      if (value == null) {
        unsetType();
      } else {
        setType((TAnalyticWindowType)value);
      }
      break;

    case WINDOW_START:
      if (value == null) {
        unsetWindowStart();
      } else {
        setWindowStart((TAnalyticWindowBoundary)value);
      }
      break;

    case WINDOW_END:
      if (value == null) {
        unsetWindowEnd();
      } else {
        setWindowEnd((TAnalyticWindowBoundary)value);
      }
      break;

    }
  }

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

    case WINDOW_START:
      return getWindowStart();

    case WINDOW_END:
      return getWindowEnd();

    }
    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 TYPE:
      return isSetType();
    case WINDOW_START:
      return isSetWindowStart();
    case WINDOW_END:
      return isSetWindowEnd();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_type = true && this.isSetType();
    boolean that_present_type = true && that.isSetType();
    if (this_present_type || that_present_type) {
      if (!(this_present_type && that_present_type))
        return false;
      if (!this.type.equals(that.type))
        return false;
    }

    boolean this_present_window_start = true && this.isSetWindowStart();
    boolean that_present_window_start = true && that.isSetWindowStart();
    if (this_present_window_start || that_present_window_start) {
      if (!(this_present_window_start && that_present_window_start))
        return false;
      if (!this.window_start.equals(that.window_start))
        return false;
    }

    boolean this_present_window_end = true && this.isSetWindowEnd();
    boolean that_present_window_end = true && that.isSetWindowEnd();
    if (this_present_window_end || that_present_window_end) {
      if (!(this_present_window_end && that_present_window_end))
        return false;
      if (!this.window_end.equals(that.window_end))
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetType()) ? 131071 : 524287);
    if (isSetType())
      hashCode = hashCode * 8191 + type.getValue();

    hashCode = hashCode * 8191 + ((isSetWindowStart()) ? 131071 : 524287);
    if (isSetWindowStart())
      hashCode = hashCode * 8191 + window_start.hashCode();

    hashCode = hashCode * 8191 + ((isSetWindowEnd()) ? 131071 : 524287);
    if (isSetWindowEnd())
      hashCode = hashCode * 8191 + window_end.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetType(), other.isSetType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type, other.type);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetWindowStart(), other.isSetWindowStart());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetWindowStart()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.window_start, other.window_start);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetWindowEnd(), other.isSetWindowEnd());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetWindowEnd()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.window_end, other.window_end);
      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("TAnalyticWindow(");
    boolean first = true;

    sb.append("type:");
    if (this.type == null) {
      sb.append("null");
    } else {
      sb.append(this.type);
    }
    first = false;
    if (isSetWindowStart()) {
      if (!first) sb.append(", ");
      sb.append("window_start:");
      if (this.window_start == null) {
        sb.append("null");
      } else {
        sb.append(this.window_start);
      }
      first = false;
    }
    if (isSetWindowEnd()) {
      if (!first) sb.append(", ");
      sb.append("window_end:");
      if (this.window_end == null) {
        sb.append("null");
      } else {
        sb.append(this.window_end);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (type == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'type' was not present! Struct: " + toString());
    }
    // check for sub-struct validity
    if (window_start != null) {
      window_start.validate();
    }
    if (window_end != null) {
      window_end.validate();
    }
  }

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

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

  private static class TAnalyticWindowStandardScheme extends org.apache.thrift.scheme.StandardScheme<TAnalyticWindow> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TAnalyticWindow 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: // TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.type = org.apache.doris.thrift.TAnalyticWindowType.findByValue(iprot.readI32());
              struct.setTypeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // WINDOW_START
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.window_start = new TAnalyticWindowBoundary();
              struct.window_start.read(iprot);
              struct.setWindowStartIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // WINDOW_END
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.window_end = new TAnalyticWindowBoundary();
              struct.window_end.read(iprot);
              struct.setWindowEndIsSet(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, TAnalyticWindow struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.type != null) {
        oprot.writeFieldBegin(TYPE_FIELD_DESC);
        oprot.writeI32(struct.type.getValue());
        oprot.writeFieldEnd();
      }
      if (struct.window_start != null) {
        if (struct.isSetWindowStart()) {
          oprot.writeFieldBegin(WINDOW_START_FIELD_DESC);
          struct.window_start.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.window_end != null) {
        if (struct.isSetWindowEnd()) {
          oprot.writeFieldBegin(WINDOW_END_FIELD_DESC);
          struct.window_end.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

  private static class TAnalyticWindowTupleScheme extends org.apache.thrift.scheme.TupleScheme<TAnalyticWindow> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TAnalyticWindow struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      oprot.writeI32(struct.type.getValue());
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetWindowStart()) {
        optionals.set(0);
      }
      if (struct.isSetWindowEnd()) {
        optionals.set(1);
      }
      oprot.writeBitSet(optionals, 2);
      if (struct.isSetWindowStart()) {
        struct.window_start.write(oprot);
      }
      if (struct.isSetWindowEnd()) {
        struct.window_end.write(oprot);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TAnalyticWindow struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.type = org.apache.doris.thrift.TAnalyticWindowType.findByValue(iprot.readI32());
      struct.setTypeIsSet(true);
      java.util.BitSet incoming = iprot.readBitSet(2);
      if (incoming.get(0)) {
        struct.window_start = new TAnalyticWindowBoundary();
        struct.window_start.read(iprot);
        struct.setWindowStartIsSet(true);
      }
      if (incoming.get(1)) {
        struct.window_end = new TAnalyticWindowBoundary();
        struct.window_end.read(iprot);
        struct.setWindowEndIsSet(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();
  }
}