/**
* Autogenerated by Thrift
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
package com.datastax.demo.portfolio;
import java.util.*;
import org.apache.commons.lang.builder.HashCodeBuilder;
public class LeaderBoard implements org.apache.thrift.TBase<LeaderBoard, LeaderBoard._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("LeaderBoard");
private static final org.apache.thrift.protocol.TField LOW_VAR_FIELD_DESC = new org.apache.thrift.protocol.TField("low_var", org.apache.thrift.protocol.TType.LIST, (short)1);
private static final org.apache.thrift.protocol.TField HIGH_VAR_FIELD_DESC = new org.apache.thrift.protocol.TField("high_var", org.apache.thrift.protocol.TType.LIST, (short)2);
public List<Portfolio> low_var;
public List<Portfolio> high_var;
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
LOW_VAR((short)1, "low_var"),
HIGH_VAR((short)2, "high_var");
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: // LOW_VAR
return LOW_VAR;
case 2: // HIGH_VAR
return HIGH_VAR;
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, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.LOW_VAR, new org.apache.thrift.meta_data.FieldMetaData("low_var", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Portfolio.class))));
tmpMap.put(_Fields.HIGH_VAR, new org.apache.thrift.meta_data.FieldMetaData("high_var", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Portfolio.class))));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(LeaderBoard.class, metaDataMap);
}
public LeaderBoard() {
}
public LeaderBoard(
List<Portfolio> low_var,
List<Portfolio> high_var)
{
this();
this.low_var = low_var;
this.high_var = high_var;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public LeaderBoard(LeaderBoard other) {
if (other.isSetLow_var()) {
List<Portfolio> __this__low_var = new ArrayList<Portfolio>();
for (Portfolio other_element : other.low_var) {
__this__low_var.add(new Portfolio(other_element));
}
this.low_var = __this__low_var;
}
if (other.isSetHigh_var()) {
List<Portfolio> __this__high_var = new ArrayList<Portfolio>();
for (Portfolio other_element : other.high_var) {
__this__high_var.add(new Portfolio(other_element));
}
this.high_var = __this__high_var;
}
}
public LeaderBoard deepCopy() {
return new LeaderBoard(this);
}
@Override
public void clear() {
this.low_var = null;
this.high_var = null;
}
public int getLow_varSize() {
return (this.low_var == null) ? 0 : this.low_var.size();
}
public java.util.Iterator<Portfolio> getLow_varIterator() {
return (this.low_var == null) ? null : this.low_var.iterator();
}
public void addToLow_var(Portfolio elem) {
if (this.low_var == null) {
this.low_var = new ArrayList<Portfolio>();
}
this.low_var.add(elem);
}
public List<Portfolio> getLow_var() {
return this.low_var;
}
public LeaderBoard setLow_var(List<Portfolio> low_var) {
this.low_var = low_var;
return this;
}
public void unsetLow_var() {
this.low_var = null;
}
/** Returns true if field low_var is set (has been assigned a value) and false otherwise */
public boolean isSetLow_var() {
return this.low_var != null;
}
public void setLow_varIsSet(boolean value) {
if (!value) {
this.low_var = null;
}
}
public int getHigh_varSize() {
return (this.high_var == null) ? 0 : this.high_var.size();
}
public java.util.Iterator<Portfolio> getHigh_varIterator() {
return (this.high_var == null) ? null : this.high_var.iterator();
}
public void addToHigh_var(Portfolio elem) {
if (this.high_var == null) {
this.high_var = new ArrayList<Portfolio>();
}
this.high_var.add(elem);
}
public List<Portfolio> getHigh_var() {
return this.high_var;
}
public LeaderBoard setHigh_var(List<Portfolio> high_var) {
this.high_var = high_var;
return this;
}
public void unsetHigh_var() {
this.high_var = null;
}
/** Returns true if field high_var is set (has been assigned a value) and false otherwise */
public boolean isSetHigh_var() {
return this.high_var != null;
}
public void setHigh_varIsSet(boolean value) {
if (!value) {
this.high_var = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case LOW_VAR:
if (value == null) {
unsetLow_var();
} else {
setLow_var((List<Portfolio>)value);
}
break;
case HIGH_VAR:
if (value == null) {
unsetHigh_var();
} else {
setHigh_var((List<Portfolio>)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case LOW_VAR:
return getLow_var();
case HIGH_VAR:
return getHigh_var();
}
throw new 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 IllegalArgumentException();
}
switch (field) {
case LOW_VAR:
return isSetLow_var();
case HIGH_VAR:
return isSetHigh_var();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof LeaderBoard)
return this.equals((LeaderBoard)that);
return false;
}
public boolean equals(LeaderBoard that) {
if (that == null)
return false;
boolean this_present_low_var = true && this.isSetLow_var();
boolean that_present_low_var = true && that.isSetLow_var();
if (this_present_low_var || that_present_low_var) {
if (!(this_present_low_var && that_present_low_var))
return false;
if (!this.low_var.equals(that.low_var))
return false;
}
boolean this_present_high_var = true && this.isSetHigh_var();
boolean that_present_high_var = true && that.isSetHigh_var();
if (this_present_high_var || that_present_high_var) {
if (!(this_present_high_var && that_present_high_var))
return false;
if (!this.high_var.equals(that.high_var))
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_low_var = true && (isSetLow_var());
builder.append(present_low_var);
if (present_low_var)
builder.append(low_var);
boolean present_high_var = true && (isSetHigh_var());
builder.append(present_high_var);
if (present_high_var)
builder.append(high_var);
return builder.toHashCode();
}
public int compareTo(LeaderBoard other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
LeaderBoard typedOther = (LeaderBoard)other;
lastComparison = Boolean.valueOf(isSetLow_var()).compareTo(typedOther.isSetLow_var());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetLow_var()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.low_var, typedOther.low_var);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetHigh_var()).compareTo(typedOther.isSetHigh_var());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetHigh_var()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.high_var, typedOther.high_var);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField field;
iprot.readStructBegin();
while (true)
{
field = iprot.readFieldBegin();
if (field.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (field.id) {
case 1: // LOW_VAR
if (field.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list4 = iprot.readListBegin();
this.low_var = new ArrayList<Portfolio>(_list4.size);
for (int _i5 = 0; _i5 < _list4.size; ++_i5)
{
Portfolio _elem6;
_elem6 = new Portfolio();
_elem6.read(iprot);
this.low_var.add(_elem6);
}
iprot.readListEnd();
}
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
case 2: // HIGH_VAR
if (field.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list7 = iprot.readListBegin();
this.high_var = new ArrayList<Portfolio>(_list7.size);
for (int _i8 = 0; _i8 < _list7.size; ++_i8)
{
Portfolio _elem9;
_elem9 = new Portfolio();
_elem9.read(iprot);
this.high_var.add(_elem9);
}
iprot.readListEnd();
}
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
default:
org.apache.thrift.protocol.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(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
validate();
oprot.writeStructBegin(STRUCT_DESC);
if (this.low_var != null) {
oprot.writeFieldBegin(LOW_VAR_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.low_var.size()));
for (Portfolio _iter10 : this.low_var)
{
_iter10.write(oprot);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
if (this.high_var != null) {
oprot.writeFieldBegin(HIGH_VAR_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.high_var.size()));
for (Portfolio _iter11 : this.high_var)
{
_iter11.write(oprot);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("LeaderBoard(");
boolean first = true;
sb.append("low_var:");
if (this.low_var == null) {
sb.append("null");
} else {
sb.append(this.low_var);
}
first = false;
if (!first) sb.append(", ");
sb.append("high_var:");
if (this.high_var == null) {
sb.append("null");
} else {
sb.append(this.high_var);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
}
}