/**
* Autogenerated by Thrift
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
package com.flaptor.indextank.rpc;
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.*;
@SuppressWarnings("all") public class SearcherStats implements TBase<SearcherStats, SearcherStats._Fields>, java.io.Serializable, Cloneable {
private static final TStruct STRUCT_DESC = new TStruct("SearcherStats");
private static final TField STATUS_FIELD_DESC = new TField("status", TType.STRING, (short)1);
private static final TField MEAN_QPS_FIELD_DESC = new TField("mean_qps", TType.DOUBLE, (short)2);
private static final TField MAX_QPS_FIELD_DESC = new TField("max_qps", TType.DOUBLE, (short)3);
private static final TField TOP10_FIELD_DESC = new TField("top10", TType.LIST, (short)4);
private String status;
private double mean_qps;
private double max_qps;
private List<String> top10;
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements TFieldIdEnum {
STATUS((short)1, "status"),
MEAN_QPS((short)2, "mean_qps"),
MAX_QPS((short)3, "max_qps"),
TOP10((short)4, "top10");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
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: // STATUS
return STATUS;
case 2: // MEAN_QPS
return MEAN_QPS;
case 3: // MAX_QPS
return MAX_QPS;
case 4: // TOP10
return TOP10;
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
private static final int __MEAN_QPS_ISSET_ID = 0;
private static final int __MAX_QPS_ISSET_ID = 1;
private BitSet __isset_bit_vector = new BitSet(2);
public static final Map<_Fields, FieldMetaData> metaDataMap;
static {
Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.STATUS, new FieldMetaData("status", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.STRING)));
tmpMap.put(_Fields.MEAN_QPS, new FieldMetaData("mean_qps", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.DOUBLE)));
tmpMap.put(_Fields.MAX_QPS, new FieldMetaData("max_qps", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.DOUBLE)));
tmpMap.put(_Fields.TOP10, new FieldMetaData("top10", TFieldRequirementType.DEFAULT,
new ListMetaData(TType.LIST,
new FieldValueMetaData(TType.STRING))));
metaDataMap = Collections.unmodifiableMap(tmpMap);
FieldMetaData.addStructMetaDataMap(SearcherStats.class, metaDataMap);
}
public SearcherStats() {
}
public SearcherStats(
String status,
double mean_qps,
double max_qps,
List<String> top10)
{
this();
this.status = status;
this.mean_qps = mean_qps;
set_mean_qps_isSet(true);
this.max_qps = max_qps;
set_max_qps_isSet(true);
this.top10 = top10;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public SearcherStats(SearcherStats other) {
__isset_bit_vector.clear();
__isset_bit_vector.or(other.__isset_bit_vector);
if (other.is_set_status()) {
this.status = other.status;
}
this.mean_qps = other.mean_qps;
this.max_qps = other.max_qps;
if (other.is_set_top10()) {
List<String> __this__top10 = new ArrayList<String>();
for (String other_element : other.top10) {
__this__top10.add(other_element);
}
this.top10 = __this__top10;
}
}
public SearcherStats deepCopy() {
return new SearcherStats(this);
}
@Override
public void clear() {
this.status = null;
set_mean_qps_isSet(false);
this.mean_qps = 0.0;
set_max_qps_isSet(false);
this.max_qps = 0.0;
this.top10 = null;
}
public String get_status() {
return this.status;
}
public SearcherStats set_status(String status) {
this.status = status;
return this;
}
public void unset_status() {
this.status = null;
}
/** Returns true if field status is set (has been asigned a value) and false otherwise */
public boolean is_set_status() {
return this.status != null;
}
public void set_status_isSet(boolean value) {
if (!value) {
this.status = null;
}
}
public double get_mean_qps() {
return this.mean_qps;
}
public SearcherStats set_mean_qps(double mean_qps) {
this.mean_qps = mean_qps;
set_mean_qps_isSet(true);
return this;
}
public void unset_mean_qps() {
__isset_bit_vector.clear(__MEAN_QPS_ISSET_ID);
}
/** Returns true if field mean_qps is set (has been asigned a value) and false otherwise */
public boolean is_set_mean_qps() {
return __isset_bit_vector.get(__MEAN_QPS_ISSET_ID);
}
public void set_mean_qps_isSet(boolean value) {
__isset_bit_vector.set(__MEAN_QPS_ISSET_ID, value);
}
public double get_max_qps() {
return this.max_qps;
}
public SearcherStats set_max_qps(double max_qps) {
this.max_qps = max_qps;
set_max_qps_isSet(true);
return this;
}
public void unset_max_qps() {
__isset_bit_vector.clear(__MAX_QPS_ISSET_ID);
}
/** Returns true if field max_qps is set (has been asigned a value) and false otherwise */
public boolean is_set_max_qps() {
return __isset_bit_vector.get(__MAX_QPS_ISSET_ID);
}
public void set_max_qps_isSet(boolean value) {
__isset_bit_vector.set(__MAX_QPS_ISSET_ID, value);
}
public int get_top10_size() {
return (this.top10 == null) ? 0 : this.top10.size();
}
public java.util.Iterator<String> get_top10_iterator() {
return (this.top10 == null) ? null : this.top10.iterator();
}
public void add_to_top10(String elem) {
if (this.top10 == null) {
this.top10 = new ArrayList<String>();
}
this.top10.add(elem);
}
public List<String> get_top10() {
return this.top10;
}
public SearcherStats set_top10(List<String> top10) {
this.top10 = top10;
return this;
}
public void unset_top10() {
this.top10 = null;
}
/** Returns true if field top10 is set (has been asigned a value) and false otherwise */
public boolean is_set_top10() {
return this.top10 != null;
}
public void set_top10_isSet(boolean value) {
if (!value) {
this.top10 = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case STATUS:
if (value == null) {
unset_status();
} else {
set_status((String)value);
}
break;
case MEAN_QPS:
if (value == null) {
unset_mean_qps();
} else {
set_mean_qps((Double)value);
}
break;
case MAX_QPS:
if (value == null) {
unset_max_qps();
} else {
set_max_qps((Double)value);
}
break;
case TOP10:
if (value == null) {
unset_top10();
} else {
set_top10((List<String>)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case STATUS:
return get_status();
case MEAN_QPS:
return new Double(get_mean_qps());
case MAX_QPS:
return new Double(get_max_qps());
case TOP10:
return get_top10();
}
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 STATUS:
return is_set_status();
case MEAN_QPS:
return is_set_mean_qps();
case MAX_QPS:
return is_set_max_qps();
case TOP10:
return is_set_top10();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof SearcherStats)
return this.equals((SearcherStats)that);
return false;
}
public boolean equals(SearcherStats that) {
if (that == null)
return false;
boolean this_present_status = true && this.is_set_status();
boolean that_present_status = true && that.is_set_status();
if (this_present_status || that_present_status) {
if (!(this_present_status && that_present_status))
return false;
if (!this.status.equals(that.status))
return false;
}
boolean this_present_mean_qps = true;
boolean that_present_mean_qps = true;
if (this_present_mean_qps || that_present_mean_qps) {
if (!(this_present_mean_qps && that_present_mean_qps))
return false;
if (this.mean_qps != that.mean_qps)
return false;
}
boolean this_present_max_qps = true;
boolean that_present_max_qps = true;
if (this_present_max_qps || that_present_max_qps) {
if (!(this_present_max_qps && that_present_max_qps))
return false;
if (this.max_qps != that.max_qps)
return false;
}
boolean this_present_top10 = true && this.is_set_top10();
boolean that_present_top10 = true && that.is_set_top10();
if (this_present_top10 || that_present_top10) {
if (!(this_present_top10 && that_present_top10))
return false;
if (!this.top10.equals(that.top10))
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(SearcherStats other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
SearcherStats typedOther = (SearcherStats)other;
lastComparison = Boolean.valueOf(is_set_status()).compareTo(typedOther.is_set_status());
if (lastComparison != 0) {
return lastComparison;
}
if (is_set_status()) {
lastComparison = TBaseHelper.compareTo(this.status, typedOther.status);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(is_set_mean_qps()).compareTo(typedOther.is_set_mean_qps());
if (lastComparison != 0) {
return lastComparison;
}
if (is_set_mean_qps()) {
lastComparison = TBaseHelper.compareTo(this.mean_qps, typedOther.mean_qps);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(is_set_max_qps()).compareTo(typedOther.is_set_max_qps());
if (lastComparison != 0) {
return lastComparison;
}
if (is_set_max_qps()) {
lastComparison = TBaseHelper.compareTo(this.max_qps, typedOther.max_qps);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(is_set_top10()).compareTo(typedOther.is_set_top10());
if (lastComparison != 0) {
return lastComparison;
}
if (is_set_top10()) {
lastComparison = TBaseHelper.compareTo(this.top10, typedOther.top10);
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: // STATUS
if (field.type == TType.STRING) {
this.status = iprot.readString();
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case 2: // MEAN_QPS
if (field.type == TType.DOUBLE) {
this.mean_qps = iprot.readDouble();
set_mean_qps_isSet(true);
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case 3: // MAX_QPS
if (field.type == TType.DOUBLE) {
this.max_qps = iprot.readDouble();
set_max_qps_isSet(true);
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case 4: // TOP10
if (field.type == TType.LIST) {
{
TList _list46 = iprot.readListBegin();
this.top10 = new ArrayList<String>(_list46.size);
for (int _i47 = 0; _i47 < _list46.size; ++_i47)
{
String _elem48;
_elem48 = iprot.readString();
this.top10.add(_elem48);
}
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.status != null) {
oprot.writeFieldBegin(STATUS_FIELD_DESC);
oprot.writeString(this.status);
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(MEAN_QPS_FIELD_DESC);
oprot.writeDouble(this.mean_qps);
oprot.writeFieldEnd();
oprot.writeFieldBegin(MAX_QPS_FIELD_DESC);
oprot.writeDouble(this.max_qps);
oprot.writeFieldEnd();
if (this.top10 != null) {
oprot.writeFieldBegin(TOP10_FIELD_DESC);
{
oprot.writeListBegin(new TList(TType.STRING, this.top10.size()));
for (String _iter49 : this.top10)
{
oprot.writeString(_iter49);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("SearcherStats(");
boolean first = true;
sb.append("status:");
if (this.status == null) {
sb.append("null");
} else {
sb.append(this.status);
}
first = false;
if (!first) sb.append(", ");
sb.append("mean_qps:");
sb.append(this.mean_qps);
first = false;
if (!first) sb.append(", ");
sb.append("max_qps:");
sb.append(this.max_qps);
first = false;
if (!first) sb.append(", ");
sb.append("top10:");
if (this.top10 == null) {
sb.append("null");
} else {
sb.append(this.top10);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws TException {
// check for required fields
}
}