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

org.apache.iotdb.common.rpc.thrift.TSpaceQuota 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.common.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 TSpaceQuota 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("TSpaceQuota");

  private static final org.apache.thrift.protocol.TField DISK_SIZE_FIELD_DESC = new org.apache.thrift.protocol.TField("diskSize", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField DEVICE_NUM_FIELD_DESC = new org.apache.thrift.protocol.TField("deviceNum", org.apache.thrift.protocol.TType.I64, (short)2);
  private static final org.apache.thrift.protocol.TField TIMESERIE_NUM_FIELD_DESC = new org.apache.thrift.protocol.TField("timeserieNum", org.apache.thrift.protocol.TType.I64, (short)3);

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

  public long diskSize; // optional
  public long deviceNum; // optional
  public long timeserieNum; // 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 {
    DISK_SIZE((short)1, "diskSize"),
    DEVICE_NUM((short)2, "deviceNum"),
    TIMESERIE_NUM((short)3, "timeserieNum");

    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: // DISK_SIZE
          return DISK_SIZE;
        case 2: // DEVICE_NUM
          return DEVICE_NUM;
        case 3: // TIMESERIE_NUM
          return TIMESERIE_NUM;
        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 __DISKSIZE_ISSET_ID = 0;
  private static final int __DEVICENUM_ISSET_ID = 1;
  private static final int __TIMESERIENUM_ISSET_ID = 2;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.DISK_SIZE,_Fields.DEVICE_NUM,_Fields.TIMESERIE_NUM};
  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.DISK_SIZE, new org.apache.thrift.meta_data.FieldMetaData("diskSize", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.DEVICE_NUM, new org.apache.thrift.meta_data.FieldMetaData("deviceNum", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.TIMESERIE_NUM, new org.apache.thrift.meta_data.FieldMetaData("timeserieNum", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        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(TSpaceQuota.class, metaDataMap);
  }

  public TSpaceQuota() {
  }

  /**
   * Performs a deep copy on other.
   */
  public TSpaceQuota(TSpaceQuota other) {
    __isset_bitfield = other.__isset_bitfield;
    this.diskSize = other.diskSize;
    this.deviceNum = other.deviceNum;
    this.timeserieNum = other.timeserieNum;
  }

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

  @Override
  public void clear() {
    setDiskSizeIsSet(false);
    this.diskSize = 0;
    setDeviceNumIsSet(false);
    this.deviceNum = 0;
    setTimeserieNumIsSet(false);
    this.timeserieNum = 0;
  }

  public long getDiskSize() {
    return this.diskSize;
  }

  public TSpaceQuota setDiskSize(long diskSize) {
    this.diskSize = diskSize;
    setDiskSizeIsSet(true);
    return this;
  }

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

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

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

  public long getDeviceNum() {
    return this.deviceNum;
  }

  public TSpaceQuota setDeviceNum(long deviceNum) {
    this.deviceNum = deviceNum;
    setDeviceNumIsSet(true);
    return this;
  }

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

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

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

  public long getTimeserieNum() {
    return this.timeserieNum;
  }

  public TSpaceQuota setTimeserieNum(long timeserieNum) {
    this.timeserieNum = timeserieNum;
    setTimeserieNumIsSet(true);
    return this;
  }

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

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

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

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

    case DEVICE_NUM:
      if (value == null) {
        unsetDeviceNum();
      } else {
        setDeviceNum((java.lang.Long)value);
      }
      break;

    case TIMESERIE_NUM:
      if (value == null) {
        unsetTimeserieNum();
      } else {
        setTimeserieNum((java.lang.Long)value);
      }
      break;

    }
  }

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

    case DEVICE_NUM:
      return getDeviceNum();

    case TIMESERIE_NUM:
      return getTimeserieNum();

    }
    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 DISK_SIZE:
      return isSetDiskSize();
    case DEVICE_NUM:
      return isSetDeviceNum();
    case TIMESERIE_NUM:
      return isSetTimeserieNum();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_diskSize = true && this.isSetDiskSize();
    boolean that_present_diskSize = true && that.isSetDiskSize();
    if (this_present_diskSize || that_present_diskSize) {
      if (!(this_present_diskSize && that_present_diskSize))
        return false;
      if (this.diskSize != that.diskSize)
        return false;
    }

    boolean this_present_deviceNum = true && this.isSetDeviceNum();
    boolean that_present_deviceNum = true && that.isSetDeviceNum();
    if (this_present_deviceNum || that_present_deviceNum) {
      if (!(this_present_deviceNum && that_present_deviceNum))
        return false;
      if (this.deviceNum != that.deviceNum)
        return false;
    }

    boolean this_present_timeserieNum = true && this.isSetTimeserieNum();
    boolean that_present_timeserieNum = true && that.isSetTimeserieNum();
    if (this_present_timeserieNum || that_present_timeserieNum) {
      if (!(this_present_timeserieNum && that_present_timeserieNum))
        return false;
      if (this.timeserieNum != that.timeserieNum)
        return false;
    }

    return true;
  }

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

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

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

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

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetDiskSize(), other.isSetDiskSize());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDiskSize()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.diskSize, other.diskSize);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetDeviceNum(), other.isSetDeviceNum());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDeviceNum()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.deviceNum, other.deviceNum);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetTimeserieNum(), other.isSetTimeserieNum());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTimeserieNum()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timeserieNum, other.timeserieNum);
      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("TSpaceQuota(");
    boolean first = true;

    if (isSetDiskSize()) {
      sb.append("diskSize:");
      sb.append(this.diskSize);
      first = false;
    }
    if (isSetDeviceNum()) {
      if (!first) sb.append(", ");
      sb.append("deviceNum:");
      sb.append(this.deviceNum);
      first = false;
    }
    if (isSetTimeserieNum()) {
      if (!first) sb.append(", ");
      sb.append("timeserieNum:");
      sb.append(this.timeserieNum);
      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 TSpaceQuotaStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TSpaceQuotaStandardScheme getScheme() {
      return new TSpaceQuotaStandardScheme();
    }
  }

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

    public void read(org.apache.thrift.protocol.TProtocol iprot, TSpaceQuota 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: // DISK_SIZE
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.diskSize = iprot.readI64();
              struct.setDiskSizeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // DEVICE_NUM
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.deviceNum = iprot.readI64();
              struct.setDeviceNumIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // TIMESERIE_NUM
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.timeserieNum = iprot.readI64();
              struct.setTimeserieNumIsSet(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, TSpaceQuota struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.isSetDiskSize()) {
        oprot.writeFieldBegin(DISK_SIZE_FIELD_DESC);
        oprot.writeI64(struct.diskSize);
        oprot.writeFieldEnd();
      }
      if (struct.isSetDeviceNum()) {
        oprot.writeFieldBegin(DEVICE_NUM_FIELD_DESC);
        oprot.writeI64(struct.deviceNum);
        oprot.writeFieldEnd();
      }
      if (struct.isSetTimeserieNum()) {
        oprot.writeFieldBegin(TIMESERIE_NUM_FIELD_DESC);
        oprot.writeI64(struct.timeserieNum);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

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

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TSpaceQuota 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.isSetDiskSize()) {
        optionals.set(0);
      }
      if (struct.isSetDeviceNum()) {
        optionals.set(1);
      }
      if (struct.isSetTimeserieNum()) {
        optionals.set(2);
      }
      oprot.writeBitSet(optionals, 3);
      if (struct.isSetDiskSize()) {
        oprot.writeI64(struct.diskSize);
      }
      if (struct.isSetDeviceNum()) {
        oprot.writeI64(struct.deviceNum);
      }
      if (struct.isSetTimeserieNum()) {
        oprot.writeI64(struct.timeserieNum);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TSpaceQuota struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet incoming = iprot.readBitSet(3);
      if (incoming.get(0)) {
        struct.diskSize = iprot.readI64();
        struct.setDiskSizeIsSet(true);
      }
      if (incoming.get(1)) {
        struct.deviceNum = iprot.readI64();
        struct.setDeviceNumIsSet(true);
      }
      if (incoming.get(2)) {
        struct.timeserieNum = iprot.readI64();
        struct.setTimeserieNumIsSet(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