All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.iotdb.mpp.rpc.thrift.TSendSinglePlanNodeReq Maven / Gradle / Ivy

The newest version!
/**
 * Autogenerated by Thrift Compiler (0.14.1)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.iotdb.mpp.rpc.thrift;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.14.1)", date = "2024-09-12")
public class TSendSinglePlanNodeReq implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSendSinglePlanNodeReq");

  private static final org.apache.thrift.protocol.TField PLAN_NODE_FIELD_DESC = new org.apache.thrift.protocol.TField("planNode", org.apache.thrift.protocol.TType.STRUCT, (short)1);
  private static final org.apache.thrift.protocol.TField CONSENSUS_GROUP_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("consensusGroupId", org.apache.thrift.protocol.TType.STRUCT, (short)2);

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

  public @org.apache.thrift.annotation.Nullable TPlanNode planNode; // required
  public @org.apache.thrift.annotation.Nullable org.apache.iotdb.common.rpc.thrift.TConsensusGroupId consensusGroupId; // 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 {
    PLAN_NODE((short)1, "planNode"),
    CONSENSUS_GROUP_ID((short)2, "consensusGroupId");

    private static final java.util.Map byName = new java.util.HashMap();

    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: // PLAN_NODE
          return PLAN_NODE;
        case 2: // CONSENSUS_GROUP_ID
          return CONSENSUS_GROUP_ID;
        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
  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.PLAN_NODE, new org.apache.thrift.meta_data.FieldMetaData("planNode", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TPlanNode.class)));
    tmpMap.put(_Fields.CONSENSUS_GROUP_ID, new org.apache.thrift.meta_data.FieldMetaData("consensusGroupId", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.iotdb.common.rpc.thrift.TConsensusGroupId.class)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSendSinglePlanNodeReq.class, metaDataMap);
  }

  public TSendSinglePlanNodeReq() {
  }

  public TSendSinglePlanNodeReq(
    TPlanNode planNode,
    org.apache.iotdb.common.rpc.thrift.TConsensusGroupId consensusGroupId)
  {
    this();
    this.planNode = planNode;
    this.consensusGroupId = consensusGroupId;
  }

  /**
   * Performs a deep copy on other.
   */
  public TSendSinglePlanNodeReq(TSendSinglePlanNodeReq other) {
    if (other.isSetPlanNode()) {
      this.planNode = new TPlanNode(other.planNode);
    }
    if (other.isSetConsensusGroupId()) {
      this.consensusGroupId = new org.apache.iotdb.common.rpc.thrift.TConsensusGroupId(other.consensusGroupId);
    }
  }

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

  @Override
  public void clear() {
    this.planNode = null;
    this.consensusGroupId = null;
  }

  @org.apache.thrift.annotation.Nullable
  public TPlanNode getPlanNode() {
    return this.planNode;
  }

  public TSendSinglePlanNodeReq setPlanNode(@org.apache.thrift.annotation.Nullable TPlanNode planNode) {
    this.planNode = planNode;
    return this;
  }

  public void unsetPlanNode() {
    this.planNode = null;
  }

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

  public void setPlanNodeIsSet(boolean value) {
    if (!value) {
      this.planNode = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public org.apache.iotdb.common.rpc.thrift.TConsensusGroupId getConsensusGroupId() {
    return this.consensusGroupId;
  }

  public TSendSinglePlanNodeReq setConsensusGroupId(@org.apache.thrift.annotation.Nullable org.apache.iotdb.common.rpc.thrift.TConsensusGroupId consensusGroupId) {
    this.consensusGroupId = consensusGroupId;
    return this;
  }

  public void unsetConsensusGroupId() {
    this.consensusGroupId = null;
  }

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

  public void setConsensusGroupIdIsSet(boolean value) {
    if (!value) {
      this.consensusGroupId = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case PLAN_NODE:
      if (value == null) {
        unsetPlanNode();
      } else {
        setPlanNode((TPlanNode)value);
      }
      break;

    case CONSENSUS_GROUP_ID:
      if (value == null) {
        unsetConsensusGroupId();
      } else {
        setConsensusGroupId((org.apache.iotdb.common.rpc.thrift.TConsensusGroupId)value);
      }
      break;

    }
  }

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

    case CONSENSUS_GROUP_ID:
      return getConsensusGroupId();

    }
    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 PLAN_NODE:
      return isSetPlanNode();
    case CONSENSUS_GROUP_ID:
      return isSetConsensusGroupId();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_planNode = true && this.isSetPlanNode();
    boolean that_present_planNode = true && that.isSetPlanNode();
    if (this_present_planNode || that_present_planNode) {
      if (!(this_present_planNode && that_present_planNode))
        return false;
      if (!this.planNode.equals(that.planNode))
        return false;
    }

    boolean this_present_consensusGroupId = true && this.isSetConsensusGroupId();
    boolean that_present_consensusGroupId = true && that.isSetConsensusGroupId();
    if (this_present_consensusGroupId || that_present_consensusGroupId) {
      if (!(this_present_consensusGroupId && that_present_consensusGroupId))
        return false;
      if (!this.consensusGroupId.equals(that.consensusGroupId))
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetPlanNode()) ? 131071 : 524287);
    if (isSetPlanNode())
      hashCode = hashCode * 8191 + planNode.hashCode();

    hashCode = hashCode * 8191 + ((isSetConsensusGroupId()) ? 131071 : 524287);
    if (isSetConsensusGroupId())
      hashCode = hashCode * 8191 + consensusGroupId.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetPlanNode(), other.isSetPlanNode());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPlanNode()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.planNode, other.planNode);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetConsensusGroupId(), other.isSetConsensusGroupId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetConsensusGroupId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.consensusGroupId, other.consensusGroupId);
      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("TSendSinglePlanNodeReq(");
    boolean first = true;

    sb.append("planNode:");
    if (this.planNode == null) {
      sb.append("null");
    } else {
      sb.append(this.planNode);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("consensusGroupId:");
    if (this.consensusGroupId == null) {
      sb.append("null");
    } else {
      sb.append(this.consensusGroupId);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (planNode == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'planNode' was not present! Struct: " + toString());
    }
    if (consensusGroupId == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'consensusGroupId' was not present! Struct: " + toString());
    }
    // check for sub-struct validity
    if (planNode != null) {
      planNode.validate();
    }
    if (consensusGroupId != null) {
      consensusGroupId.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 TSendSinglePlanNodeReqStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TSendSinglePlanNodeReqStandardScheme getScheme() {
      return new TSendSinglePlanNodeReqStandardScheme();
    }
  }

  private static class TSendSinglePlanNodeReqStandardScheme extends org.apache.thrift.scheme.StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TSendSinglePlanNodeReq 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: // PLAN_NODE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.planNode = new TPlanNode();
              struct.planNode.read(iprot);
              struct.setPlanNodeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // CONSENSUS_GROUP_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.consensusGroupId = new org.apache.iotdb.common.rpc.thrift.TConsensusGroupId();
              struct.consensusGroupId.read(iprot);
              struct.setConsensusGroupIdIsSet(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, TSendSinglePlanNodeReq struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.planNode != null) {
        oprot.writeFieldBegin(PLAN_NODE_FIELD_DESC);
        struct.planNode.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.consensusGroupId != null) {
        oprot.writeFieldBegin(CONSENSUS_GROUP_ID_FIELD_DESC);
        struct.consensusGroupId.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

  private static class TSendSinglePlanNodeReqTupleScheme extends org.apache.thrift.scheme.TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TSendSinglePlanNodeReq struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.planNode.write(oprot);
      struct.consensusGroupId.write(oprot);
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TSendSinglePlanNodeReq struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.planNode = new TPlanNode();
      struct.planNode.read(iprot);
      struct.setPlanNodeIsSet(true);
      struct.consensusGroupId = new org.apache.iotdb.common.rpc.thrift.TConsensusGroupId();
      struct.consensusGroupId.read(iprot);
      struct.setConsensusGroupIdIsSet(true);
    }
  }

  private static  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();
  }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy