/**
* 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 IndexerStats implements TBase<IndexerStats, IndexerStats._Fields>, java.io.Serializable, Cloneable {
private static final TStruct STRUCT_DESC = new TStruct("IndexerStats");
private static final TField STATUS_FIELD_DESC = new TField("status", TType.STRING, (short)1);
private static final TField DOCUMENTS_FIELD_DESC = new TField("documents", TType.I32, (short)2);
private static final TField SIZE_FIELD_DESC = new TField("size", TType.I32, (short)3);
private static final TField DIPM_FIELD_DESC = new TField("dipm", TType.DOUBLE, (short)4);
private String status;
private int documents;
private int size;
private double dipm;
/** 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"),
DOCUMENTS((short)2, "documents"),
SIZE((short)3, "size"),
DIPM((short)4, "dipm");
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: // DOCUMENTS
return DOCUMENTS;
case 3: // SIZE
return SIZE;
case 4: // DIPM
return DIPM;
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 __DOCUMENTS_ISSET_ID = 0;
private static final int __SIZE_ISSET_ID = 1;
private static final int __DIPM_ISSET_ID = 2;
private BitSet __isset_bit_vector = new BitSet(3);
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.DOCUMENTS, new FieldMetaData("documents", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.I32)));
tmpMap.put(_Fields.SIZE, new FieldMetaData("size", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.I32)));
tmpMap.put(_Fields.DIPM, new FieldMetaData("dipm", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.DOUBLE)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
FieldMetaData.addStructMetaDataMap(IndexerStats.class, metaDataMap);
}
public IndexerStats() {
}
public IndexerStats(
String status,
int documents,
int size,
double dipm)
{
this();
this.status = status;
this.documents = documents;
set_documents_isSet(true);
this.size = size;
set_size_isSet(true);
this.dipm = dipm;
set_dipm_isSet(true);
}
/**
* Performs a deep copy on <i>other</i>.
*/
public IndexerStats(IndexerStats other) {
__isset_bit_vector.clear();
__isset_bit_vector.or(other.__isset_bit_vector);
if (other.is_set_status()) {
this.status = other.status;
}
this.documents = other.documents;
this.size = other.size;
this.dipm = other.dipm;
}
public IndexerStats deepCopy() {
return new IndexerStats(this);
}
@Override
public void clear() {
this.status = null;
set_documents_isSet(false);
this.documents = 0;
set_size_isSet(false);
this.size = 0;
set_dipm_isSet(false);
this.dipm = 0.0;
}
public String get_status() {
return this.status;
}
public IndexerStats 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 int get_documents() {
return this.documents;
}
public IndexerStats set_documents(int documents) {
this.documents = documents;
set_documents_isSet(true);
return this;
}
public void unset_documents() {
__isset_bit_vector.clear(__DOCUMENTS_ISSET_ID);
}
/** Returns true if field documents is set (has been asigned a value) and false otherwise */
public boolean is_set_documents() {
return __isset_bit_vector.get(__DOCUMENTS_ISSET_ID);
}
public void set_documents_isSet(boolean value) {
__isset_bit_vector.set(__DOCUMENTS_ISSET_ID, value);
}
public int get_size() {
return this.size;
}
public IndexerStats set_size(int size) {
this.size = size;
set_size_isSet(true);
return this;
}
public void unset_size() {
__isset_bit_vector.clear(__SIZE_ISSET_ID);
}
/** Returns true if field size is set (has been asigned a value) and false otherwise */
public boolean is_set_size() {
return __isset_bit_vector.get(__SIZE_ISSET_ID);
}
public void set_size_isSet(boolean value) {
__isset_bit_vector.set(__SIZE_ISSET_ID, value);
}
public double get_dipm() {
return this.dipm;
}
public IndexerStats set_dipm(double dipm) {
this.dipm = dipm;
set_dipm_isSet(true);
return this;
}
public void unset_dipm() {
__isset_bit_vector.clear(__DIPM_ISSET_ID);
}
/** Returns true if field dipm is set (has been asigned a value) and false otherwise */
public boolean is_set_dipm() {
return __isset_bit_vector.get(__DIPM_ISSET_ID);
}
public void set_dipm_isSet(boolean value) {
__isset_bit_vector.set(__DIPM_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case STATUS:
if (value == null) {
unset_status();
} else {
set_status((String)value);
}
break;
case DOCUMENTS:
if (value == null) {
unset_documents();
} else {
set_documents((Integer)value);
}
break;
case SIZE:
if (value == null) {
unset_size();
} else {
set_size((Integer)value);
}
break;
case DIPM:
if (value == null) {
unset_dipm();
} else {
set_dipm((Double)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case STATUS:
return get_status();
case DOCUMENTS:
return new Integer(get_documents());
case SIZE:
return new Integer(get_size());
case DIPM:
return new Double(get_dipm());
}
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 DOCUMENTS:
return is_set_documents();
case SIZE:
return is_set_size();
case DIPM:
return is_set_dipm();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof IndexerStats)
return this.equals((IndexerStats)that);
return false;
}
public boolean equals(IndexerStats 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_documents = true;
boolean that_present_documents = true;
if (this_present_documents || that_present_documents) {
if (!(this_present_documents && that_present_documents))
return false;
if (this.documents != that.documents)
return false;
}
boolean this_present_size = true;
boolean that_present_size = true;
if (this_present_size || that_present_size) {
if (!(this_present_size && that_present_size))
return false;
if (this.size != that.size)
return false;
}
boolean this_present_dipm = true;
boolean that_present_dipm = true;
if (this_present_dipm || that_present_dipm) {
if (!(this_present_dipm && that_present_dipm))
return false;
if (this.dipm != that.dipm)
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(IndexerStats other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
IndexerStats typedOther = (IndexerStats)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_documents()).compareTo(typedOther.is_set_documents());
if (lastComparison != 0) {
return lastComparison;
}
if (is_set_documents()) {
lastComparison = TBaseHelper.compareTo(this.documents, typedOther.documents);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(is_set_size()).compareTo(typedOther.is_set_size());
if (lastComparison != 0) {
return lastComparison;
}
if (is_set_size()) {
lastComparison = TBaseHelper.compareTo(this.size, typedOther.size);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(is_set_dipm()).compareTo(typedOther.is_set_dipm());
if (lastComparison != 0) {
return lastComparison;
}
if (is_set_dipm()) {
lastComparison = TBaseHelper.compareTo(this.dipm, typedOther.dipm);
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: // DOCUMENTS
if (field.type == TType.I32) {
this.documents = iprot.readI32();
set_documents_isSet(true);
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case 3: // SIZE
if (field.type == TType.I32) {
this.size = iprot.readI32();
set_size_isSet(true);
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case 4: // DIPM
if (field.type == TType.DOUBLE) {
this.dipm = iprot.readDouble();
set_dipm_isSet(true);
} 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(DOCUMENTS_FIELD_DESC);
oprot.writeI32(this.documents);
oprot.writeFieldEnd();
oprot.writeFieldBegin(SIZE_FIELD_DESC);
oprot.writeI32(this.size);
oprot.writeFieldEnd();
oprot.writeFieldBegin(DIPM_FIELD_DESC);
oprot.writeDouble(this.dipm);
oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("IndexerStats(");
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("documents:");
sb.append(this.documents);
first = false;
if (!first) sb.append(", ");
sb.append("size:");
sb.append(this.size);
first = false;
if (!first) sb.append(", ");
sb.append("dipm:");
sb.append(this.dipm);
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws TException {
// check for required fields
}
}