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

scray.service.qservice.thriftjava.ScrayTResultFrame Maven / Gradle / Ivy

The newest version!
/**
 * Autogenerated by Thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 */
package scray.service.qservice.thriftjava;

import org.apache.commons.lang.builder.HashCodeBuilder;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.thrift.*;
import org.apache.thrift.async.*;
import org.apache.thrift.meta_data.*;
import org.apache.thrift.transport.*;
import org.apache.thrift.protocol.*;

// No additional import required for struct/union.

public class ScrayTResultFrame implements TBase, java.io.Serializable, Cloneable {
  private static final TStruct STRUCT_DESC = new TStruct("ScrayTResultFrame");

  private static final TField QUERY_INFO_FIELD_DESC = new TField("queryInfo", TType.STRUCT, (short)1);
  private static final TField ROWS_FIELD_DESC = new TField("rows", TType.LIST, (short)2);


  public scray.service.qmodel.thriftjava.ScrayTQueryInfo queryInfo;
  public List rows;

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements TFieldIdEnum {
    QUERY_INFO((short)1, "queryInfo"),
    ROWS((short)2, "rows");
  
    private static final Map byName = new HashMap();
  
    static {
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }
  
    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // QUERY_INFO
          return QUERY_INFO;
        case 2: // ROWS
          return ROWS;
        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 IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }
  
    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    public static _Fields findByName(String name) {
      return byName.get(name);
    }
  
    private final short _thriftId;
    private final String _fieldName;
  
    _Fields(short thriftId, String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }
  
    public short getThriftFieldId() {
      return _thriftId;
    }
  
    public String getFieldName() {
      return _fieldName;
    }
  }


  // isset id assignments

  public static final Map<_Fields, FieldMetaData> metaDataMap;
  static {
    Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.QUERY_INFO, new FieldMetaData("queryInfo", TFieldRequirementType.DEFAULT,
      new StructMetaData(TType.STRUCT, scray.service.qmodel.thriftjava.ScrayTQueryInfo.class)));
    tmpMap.put(_Fields.ROWS, new FieldMetaData("rows", TFieldRequirementType.DEFAULT,
      new ListMetaData(TType.LIST,
                new StructMetaData(TType.STRUCT, scray.service.qmodel.thriftjava.ScrayTRow.class))));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    FieldMetaData.addStructMetaDataMap(ScrayTResultFrame.class, metaDataMap);
  }


  public ScrayTResultFrame() {
  }

  public ScrayTResultFrame(
    scray.service.qmodel.thriftjava.ScrayTQueryInfo queryInfo,
    List rows)
  {
    this();
    this.queryInfo = queryInfo;
    this.rows = rows;
  }

  /**
   * Performs a deep copy on other.
   */
  public ScrayTResultFrame(ScrayTResultFrame other) {
    if (other.isSetQueryInfo()) {
      this.queryInfo = new scray.service.qmodel.thriftjava.ScrayTQueryInfo(other.queryInfo);
    }
    if (other.isSetRows()) {
      List __this__rows = new ArrayList();
      for (scray.service.qmodel.thriftjava.ScrayTRow other_element : other.rows) {
        __this__rows.add(new scray.service.qmodel.thriftjava.ScrayTRow(other_element));
      }
      this.rows = __this__rows;
    }
  }

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

  @java.lang.Override
  public void clear() {
    this.queryInfo = null;
    this.rows = null;
  }

  public scray.service.qmodel.thriftjava.ScrayTQueryInfo getQueryInfo() {
    return this.queryInfo;
  }

  public ScrayTResultFrame setQueryInfo(scray.service.qmodel.thriftjava.ScrayTQueryInfo queryInfo) {
    this.queryInfo = queryInfo;
    
    return this;
  }

  public void unsetQueryInfo() {
    this.queryInfo = null;
  }

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

  public void setQueryInfoIsSet(boolean value) {
    if (!value) {
      this.queryInfo = null;
    }
  }

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

  public java.util.Iterator getRowsIterator() {
    return (this.rows == null) ? null : this.rows.iterator();
  }

  public void addToRows(scray.service.qmodel.thriftjava.ScrayTRow elem) {
    if (this.rows == null) {
      this.rows = new ArrayList();
    }
    this.rows.add(elem);
  }

  public List getRows() {
    return this.rows;
  }

  public ScrayTResultFrame setRows(List rows) {
    this.rows = rows;
    
    return this;
  }

  public void unsetRows() {
    this.rows = null;
  }

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

  public void setRowsIsSet(boolean value) {
    if (!value) {
      this.rows = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case QUERY_INFO:
      if (value == null) {
        unsetQueryInfo();
      } else {
        setQueryInfo((scray.service.qmodel.thriftjava.ScrayTQueryInfo)value);
      }
      break;
    case ROWS:
      if (value == null) {
        unsetRows();
      } else {
        setRows((List)value);
      }
      break;
    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case QUERY_INFO:
      return getQueryInfo();
    case ROWS:
      return getRows();
    }
    throw new IllegalStateException();
  }

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

    switch (field) {
    case QUERY_INFO:
      return isSetQueryInfo();
    case ROWS:
      return isSetRows();
    }
    throw new IllegalStateException();
  }

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

  public boolean equals(ScrayTResultFrame that) {
    if (that == null)
      return false;
    boolean this_present_queryInfo = true && this.isSetQueryInfo();
    boolean that_present_queryInfo = true && that.isSetQueryInfo();
    if (this_present_queryInfo || that_present_queryInfo) {
      if (!(this_present_queryInfo && that_present_queryInfo))
        return false;
      if (!this.queryInfo.equals(that.queryInfo))
        return false;
    }
    boolean this_present_rows = true && this.isSetRows();
    boolean that_present_rows = true && that.isSetRows();
    if (this_present_rows || that_present_rows) {
      if (!(this_present_rows && that_present_rows))
        return false;
      if (!this.rows.equals(that.rows))
        return false;
    }

    return true;
  }

  @java.lang.Override
  public int hashCode() {
    HashCodeBuilder builder = new HashCodeBuilder();
    boolean present_queryInfo = true && (isSetQueryInfo());
    builder.append(present_queryInfo);
    if (present_queryInfo)
      builder.append(queryInfo);
    boolean present_rows = true && (isSetRows());
    builder.append(present_rows);
    if (present_rows)
      builder.append(rows);
    return builder.toHashCode();
  }

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

    int lastComparison = 0;
    ScrayTResultFrame typedOther = (ScrayTResultFrame)other;

    lastComparison = Boolean.valueOf(isSetQueryInfo()).compareTo(typedOther.isSetQueryInfo());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetQueryInfo()) {
      lastComparison = TBaseHelper.compareTo(this.queryInfo, typedOther.queryInfo);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetRows()).compareTo(typedOther.isSetRows());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRows()) {
      lastComparison = TBaseHelper.compareTo(this.rows, typedOther.rows);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }


  public void read(TProtocol iprot) throws TException {
    TField field;
    iprot.readStructBegin();
    while (true)
    {
      field = iprot.readFieldBegin();
      if (field.type == TType.STOP) {
        break;
      }
      switch (field.id) {
        case 1: // QUERY_INFO
          if (field.type == TType.STRUCT) {
            this.queryInfo = new scray.service.qmodel.thriftjava.ScrayTQueryInfo();
            this.queryInfo.read(iprot);
          } else {
            TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // ROWS
          if (field.type == TType.LIST) {
            {
            TList _list0 = iprot.readListBegin();
            this.rows = new ArrayList(_list0.size);
            for (int _i1 = 0; _i1 < _list0.size; ++_i1)
            {
              scray.service.qmodel.thriftjava.ScrayTRow _elem2;
              _elem2 = new scray.service.qmodel.thriftjava.ScrayTRow();
              _elem2.read(iprot);
              this.rows.add(_elem2);
            }
            iprot.readListEnd();
            }
          } else {
            TProtocolUtil.skip(iprot, field.type);
          }
          break;
        default:
          TProtocolUtil.skip(iprot, field.type);
      }
      iprot.readFieldEnd();
    }
    iprot.readStructEnd();

    // check for required fields of primitive type, which can't be checked in the validate method
    validate();
  }

  public void write(TProtocol oprot) throws TException {
    validate();
    
    oprot.writeStructBegin(STRUCT_DESC);
    if (this.queryInfo != null) {
      oprot.writeFieldBegin(QUERY_INFO_FIELD_DESC);
      this.queryInfo.write(oprot);
      oprot.writeFieldEnd();
    }
    if (this.rows != null) {
      oprot.writeFieldBegin(ROWS_FIELD_DESC);
      {
        oprot.writeListBegin(new TList(TType.STRUCT, this.rows.size()));
        for (scray.service.qmodel.thriftjava.ScrayTRow _iter3 : this.rows)
        {
          _iter3.write(oprot);
        }
        oprot.writeListEnd();
      }
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @java.lang.Override
  public String toString() {
    StringBuilder sb = new StringBuilder("ScrayTResultFrame(");
    boolean first = true;
    sb.append("queryInfo:");
    if (this.queryInfo == null) {
      sb.append("null");
    } else {
      sb.append(this.queryInfo);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("rows:");
    if (this.rows == null) {
      sb.append("null");
    } else {
      sb.append(this.rows);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws TException {
    // check for required fields
  }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy