/**
* 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 RawLogInfo implements TBase<RawLogInfo, RawLogInfo._Fields>, java.io.Serializable, Cloneable {
private static final TStruct STRUCT_DESC = new TStruct("RawLogInfo");
private static final TField UNDEALT_SEGMENTS_FIELD_DESC = new TField("undealt_segments", TType.LIST, (short)1);
private static final TField DEALER_NEXT_TIMESTAMP_FIELD_DESC = new TField("dealer_next_timestamp", TType.I64, (short)2);
private List<SegmentInfo> undealt_segments;
private long dealer_next_timestamp;
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements TFieldIdEnum {
UNDEALT_SEGMENTS((short)1, "undealt_segments"),
DEALER_NEXT_TIMESTAMP((short)2, "dealer_next_timestamp");
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: // UNDEALT_SEGMENTS
return UNDEALT_SEGMENTS;
case 2: // DEALER_NEXT_TIMESTAMP
return DEALER_NEXT_TIMESTAMP;
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 __DEALER_NEXT_TIMESTAMP_ISSET_ID = 0;
private BitSet __isset_bit_vector = new BitSet(1);
public static final Map<_Fields, FieldMetaData> metaDataMap;
static {
Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.UNDEALT_SEGMENTS, new FieldMetaData("undealt_segments", TFieldRequirementType.DEFAULT,
new ListMetaData(TType.LIST,
new StructMetaData(TType.STRUCT, SegmentInfo.class))));
tmpMap.put(_Fields.DEALER_NEXT_TIMESTAMP, new FieldMetaData("dealer_next_timestamp", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.I64)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
FieldMetaData.addStructMetaDataMap(RawLogInfo.class, metaDataMap);
}
public RawLogInfo() {
}
public RawLogInfo(
List<SegmentInfo> undealt_segments,
long dealer_next_timestamp)
{
this();
this.undealt_segments = undealt_segments;
this.dealer_next_timestamp = dealer_next_timestamp;
set_dealer_next_timestamp_isSet(true);
}
/**
* Performs a deep copy on <i>other</i>.
*/
public RawLogInfo(RawLogInfo other) {
__isset_bit_vector.clear();
__isset_bit_vector.or(other.__isset_bit_vector);
if (other.is_set_undealt_segments()) {
List<SegmentInfo> __this__undealt_segments = new ArrayList<SegmentInfo>();
for (SegmentInfo other_element : other.undealt_segments) {
__this__undealt_segments.add(new SegmentInfo(other_element));
}
this.undealt_segments = __this__undealt_segments;
}
this.dealer_next_timestamp = other.dealer_next_timestamp;
}
public RawLogInfo deepCopy() {
return new RawLogInfo(this);
}
@Override
public void clear() {
this.undealt_segments = null;
set_dealer_next_timestamp_isSet(false);
this.dealer_next_timestamp = 0;
}
public int get_undealt_segments_size() {
return (this.undealt_segments == null) ? 0 : this.undealt_segments.size();
}
public java.util.Iterator<SegmentInfo> get_undealt_segments_iterator() {
return (this.undealt_segments == null) ? null : this.undealt_segments.iterator();
}
public void add_to_undealt_segments(SegmentInfo elem) {
if (this.undealt_segments == null) {
this.undealt_segments = new ArrayList<SegmentInfo>();
}
this.undealt_segments.add(elem);
}
public List<SegmentInfo> get_undealt_segments() {
return this.undealt_segments;
}
public RawLogInfo set_undealt_segments(List<SegmentInfo> undealt_segments) {
this.undealt_segments = undealt_segments;
return this;
}
public void unset_undealt_segments() {
this.undealt_segments = null;
}
/** Returns true if field undealt_segments is set (has been asigned a value) and false otherwise */
public boolean is_set_undealt_segments() {
return this.undealt_segments != null;
}
public void set_undealt_segments_isSet(boolean value) {
if (!value) {
this.undealt_segments = null;
}
}
public long get_dealer_next_timestamp() {
return this.dealer_next_timestamp;
}
public RawLogInfo set_dealer_next_timestamp(long dealer_next_timestamp) {
this.dealer_next_timestamp = dealer_next_timestamp;
set_dealer_next_timestamp_isSet(true);
return this;
}
public void unset_dealer_next_timestamp() {
__isset_bit_vector.clear(__DEALER_NEXT_TIMESTAMP_ISSET_ID);
}
/** Returns true if field dealer_next_timestamp is set (has been asigned a value) and false otherwise */
public boolean is_set_dealer_next_timestamp() {
return __isset_bit_vector.get(__DEALER_NEXT_TIMESTAMP_ISSET_ID);
}
public void set_dealer_next_timestamp_isSet(boolean value) {
__isset_bit_vector.set(__DEALER_NEXT_TIMESTAMP_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case UNDEALT_SEGMENTS:
if (value == null) {
unset_undealt_segments();
} else {
set_undealt_segments((List<SegmentInfo>)value);
}
break;
case DEALER_NEXT_TIMESTAMP:
if (value == null) {
unset_dealer_next_timestamp();
} else {
set_dealer_next_timestamp((Long)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case UNDEALT_SEGMENTS:
return get_undealt_segments();
case DEALER_NEXT_TIMESTAMP:
return new Long(get_dealer_next_timestamp());
}
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 UNDEALT_SEGMENTS:
return is_set_undealt_segments();
case DEALER_NEXT_TIMESTAMP:
return is_set_dealer_next_timestamp();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof RawLogInfo)
return this.equals((RawLogInfo)that);
return false;
}
public boolean equals(RawLogInfo that) {
if (that == null)
return false;
boolean this_present_undealt_segments = true && this.is_set_undealt_segments();
boolean that_present_undealt_segments = true && that.is_set_undealt_segments();
if (this_present_undealt_segments || that_present_undealt_segments) {
if (!(this_present_undealt_segments && that_present_undealt_segments))
return false;
if (!this.undealt_segments.equals(that.undealt_segments))
return false;
}
boolean this_present_dealer_next_timestamp = true;
boolean that_present_dealer_next_timestamp = true;
if (this_present_dealer_next_timestamp || that_present_dealer_next_timestamp) {
if (!(this_present_dealer_next_timestamp && that_present_dealer_next_timestamp))
return false;
if (this.dealer_next_timestamp != that.dealer_next_timestamp)
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(RawLogInfo other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
RawLogInfo typedOther = (RawLogInfo)other;
lastComparison = Boolean.valueOf(is_set_undealt_segments()).compareTo(typedOther.is_set_undealt_segments());
if (lastComparison != 0) {
return lastComparison;
}
if (is_set_undealt_segments()) {
lastComparison = TBaseHelper.compareTo(this.undealt_segments, typedOther.undealt_segments);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(is_set_dealer_next_timestamp()).compareTo(typedOther.is_set_dealer_next_timestamp());
if (lastComparison != 0) {
return lastComparison;
}
if (is_set_dealer_next_timestamp()) {
lastComparison = TBaseHelper.compareTo(this.dealer_next_timestamp, typedOther.dealer_next_timestamp);
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: // UNDEALT_SEGMENTS
if (field.type == TType.LIST) {
{
TList _list78 = iprot.readListBegin();
this.undealt_segments = new ArrayList<SegmentInfo>(_list78.size);
for (int _i79 = 0; _i79 < _list78.size; ++_i79)
{
SegmentInfo _elem80;
_elem80 = new SegmentInfo();
_elem80.read(iprot);
this.undealt_segments.add(_elem80);
}
iprot.readListEnd();
}
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case 2: // DEALER_NEXT_TIMESTAMP
if (field.type == TType.I64) {
this.dealer_next_timestamp = iprot.readI64();
set_dealer_next_timestamp_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.undealt_segments != null) {
oprot.writeFieldBegin(UNDEALT_SEGMENTS_FIELD_DESC);
{
oprot.writeListBegin(new TList(TType.STRUCT, this.undealt_segments.size()));
for (SegmentInfo _iter81 : this.undealt_segments)
{
_iter81.write(oprot);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(DEALER_NEXT_TIMESTAMP_FIELD_DESC);
oprot.writeI64(this.dealer_next_timestamp);
oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("RawLogInfo(");
boolean first = true;
sb.append("undealt_segments:");
if (this.undealt_segments == null) {
sb.append("null");
} else {
sb.append(this.undealt_segments);
}
first = false;
if (!first) sb.append(", ");
sb.append("dealer_next_timestamp:");
sb.append(this.dealer_next_timestamp);
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws TException {
// check for required fields
}
}