/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package edu.usc.pgroup.floe.thriftgen;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import java.util.BitSet;
import java.util.Collections;
import java.util.EnumMap;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
public class TFloeApp implements org.apache.thrift.TBase<TFloeApp, TFloeApp._Fields>, java.io.Serializable, Cloneable, Comparable<TFloeApp> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TFloeApp");
private static final org.apache.thrift.protocol.TField PELLETS_FIELD_DESC = new org.apache.thrift.protocol.TField("pellets", org.apache.thrift.protocol.TType.MAP, (short)1);
private static final org.apache.thrift.protocol.TField JAR_PATH_FIELD_DESC = new org.apache.thrift.protocol.TField("jarPath", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new TFloeAppStandardSchemeFactory());
schemes.put(TupleScheme.class, new TFloeAppTupleSchemeFactory());
}
private Map<String,TPellet> pellets; // required
private String jarPath; // optional
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
PELLETS((short)1, "pellets"),
JAR_PATH((short)2, "jarPath");
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: // PELLETS
return PELLETS;
case 2: // JAR_PATH
return JAR_PATH;
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 _Fields optionals[] = {_Fields.JAR_PATH};
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.PELLETS, new org.apache.thrift.meta_data.FieldMetaData("pellets", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING),
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TPellet.class))));
tmpMap.put(_Fields.JAR_PATH, new org.apache.thrift.meta_data.FieldMetaData("jarPath", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TFloeApp.class, metaDataMap);
}
public TFloeApp() {
}
public TFloeApp(
Map<String,TPellet> pellets)
{
this();
this.pellets = pellets;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public TFloeApp(TFloeApp other) {
if (other.is_set_pellets()) {
Map<String,TPellet> __this__pellets = new HashMap<String,TPellet>(other.pellets.size());
for (Map.Entry<String, TPellet> other_element : other.pellets.entrySet()) {
String other_element_key = other_element.getKey();
TPellet other_element_value = other_element.getValue();
String __this__pellets_copy_key = other_element_key;
TPellet __this__pellets_copy_value = new TPellet(other_element_value);
__this__pellets.put(__this__pellets_copy_key, __this__pellets_copy_value);
}
this.pellets = __this__pellets;
}
if (other.is_set_jarPath()) {
this.jarPath = other.jarPath;
}
}
public TFloeApp deepCopy() {
return new TFloeApp(this);
}
@Override
public void clear() {
this.pellets = null;
this.jarPath = null;
}
public int get_pellets_size() {
return (this.pellets == null) ? 0 : this.pellets.size();
}
public void put_to_pellets(String key, TPellet val) {
if (this.pellets == null) {
this.pellets = new HashMap<String,TPellet>();
}
this.pellets.put(key, val);
}
public Map<String,TPellet> get_pellets() {
return this.pellets;
}
public void set_pellets(Map<String,TPellet> pellets) {
this.pellets = pellets;
}
public void unset_pellets() {
this.pellets = null;
}
/** Returns true if field pellets is set (has been assigned a value) and false otherwise */
public boolean is_set_pellets() {
return this.pellets != null;
}
public void set_pellets_isSet(boolean value) {
if (!value) {
this.pellets = null;
}
}
public String get_jarPath() {
return this.jarPath;
}
public void set_jarPath(String jarPath) {
this.jarPath = jarPath;
}
public void unset_jarPath() {
this.jarPath = null;
}
/** Returns true if field jarPath is set (has been assigned a value) and false otherwise */
public boolean is_set_jarPath() {
return this.jarPath != null;
}
public void set_jarPath_isSet(boolean value) {
if (!value) {
this.jarPath = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case PELLETS:
if (value == null) {
unset_pellets();
} else {
set_pellets((Map<String,TPellet>)value);
}
break;
case JAR_PATH:
if (value == null) {
unset_jarPath();
} else {
set_jarPath((String)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case PELLETS:
return get_pellets();
case JAR_PATH:
return get_jarPath();
}
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 PELLETS:
return is_set_pellets();
case JAR_PATH:
return is_set_jarPath();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof TFloeApp)
return this.equals((TFloeApp)that);
return false;
}
public boolean equals(TFloeApp that) {
if (that == null)
return false;
boolean this_present_pellets = true && this.is_set_pellets();
boolean that_present_pellets = true && that.is_set_pellets();
if (this_present_pellets || that_present_pellets) {
if (!(this_present_pellets && that_present_pellets))
return false;
if (!this.pellets.equals(that.pellets))
return false;
}
boolean this_present_jarPath = true && this.is_set_jarPath();
boolean that_present_jarPath = true && that.is_set_jarPath();
if (this_present_jarPath || that_present_jarPath) {
if (!(this_present_jarPath && that_present_jarPath))
return false;
if (!this.jarPath.equals(that.jarPath))
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_pellets = true && (is_set_pellets());
builder.append(present_pellets);
if (present_pellets)
builder.append(pellets);
boolean present_jarPath = true && (is_set_jarPath());
builder.append(present_jarPath);
if (present_jarPath)
builder.append(jarPath);
return builder.toHashCode();
}
@Override
public int compareTo(TFloeApp other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(is_set_pellets()).compareTo(other.is_set_pellets());
if (lastComparison != 0) {
return lastComparison;
}
if (is_set_pellets()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pellets, other.pellets);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(is_set_jarPath()).compareTo(other.is_set_jarPath());
if (lastComparison != 0) {
return lastComparison;
}
if (is_set_jarPath()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.jarPath, other.jarPath);
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 {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("TFloeApp(");
boolean first = true;
sb.append("pellets:");
if (this.pellets == null) {
sb.append("null");
} else {
sb.append(this.pellets);
}
first = false;
if (is_set_jarPath()) {
if (!first) sb.append(", ");
sb.append("jarPath:");
if (this.jarPath == null) {
sb.append("null");
} else {
sb.append(this.jarPath);
}
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (!is_set_pellets()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'pellets' is unset! Struct:" + toString());
}
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class TFloeAppStandardSchemeFactory implements SchemeFactory {
public TFloeAppStandardScheme getScheme() {
return new TFloeAppStandardScheme();
}
}
private static class TFloeAppStandardScheme extends StandardScheme<TFloeApp> {
public void read(org.apache.thrift.protocol.TProtocol iprot, TFloeApp struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // PELLETS
if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
{
org.apache.thrift.protocol.TMap _map44 = iprot.readMapBegin();
struct.pellets = new HashMap<String,TPellet>(2*_map44.size);
for (int _i45 = 0; _i45 < _map44.size; ++_i45)
{
String _key46;
TPellet _val47;
_key46 = iprot.readString();
_val47 = new TPellet();
_val47.read(iprot);
struct.pellets.put(_key46, _val47);
}
iprot.readMapEnd();
}
struct.set_pellets_isSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // JAR_PATH
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.jarPath = iprot.readString();
struct.set_jarPath_isSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, TFloeApp struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.pellets != null) {
oprot.writeFieldBegin(PELLETS_FIELD_DESC);
{
oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRUCT, struct.pellets.size()));
for (Map.Entry<String, TPellet> _iter48 : struct.pellets.entrySet())
{
oprot.writeString(_iter48.getKey());
_iter48.getValue().write(oprot);
}
oprot.writeMapEnd();
}
oprot.writeFieldEnd();
}
if (struct.jarPath != null) {
if (struct.is_set_jarPath()) {
oprot.writeFieldBegin(JAR_PATH_FIELD_DESC);
oprot.writeString(struct.jarPath);
oprot.writeFieldEnd();
}
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class TFloeAppTupleSchemeFactory implements SchemeFactory {
public TFloeAppTupleScheme getScheme() {
return new TFloeAppTupleScheme();
}
}
private static class TFloeAppTupleScheme extends TupleScheme<TFloeApp> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, TFloeApp struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
{
oprot.writeI32(struct.pellets.size());
for (Map.Entry<String, TPellet> _iter49 : struct.pellets.entrySet())
{
oprot.writeString(_iter49.getKey());
_iter49.getValue().write(oprot);
}
}
BitSet optionals = new BitSet();
if (struct.is_set_jarPath()) {
optionals.set(0);
}
oprot.writeBitSet(optionals, 1);
if (struct.is_set_jarPath()) {
oprot.writeString(struct.jarPath);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, TFloeApp struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
{
org.apache.thrift.protocol.TMap _map50 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
struct.pellets = new HashMap<String,TPellet>(2*_map50.size);
for (int _i51 = 0; _i51 < _map50.size; ++_i51)
{
String _key52;
TPellet _val53;
_key52 = iprot.readString();
_val53 = new TPellet();
_val53.read(iprot);
struct.pellets.put(_key52, _val53);
}
}
struct.set_pellets_isSet(true);
BitSet incoming = iprot.readBitSet(1);
if (incoming.get(0)) {
struct.jarPath = iprot.readString();
struct.set_jarPath_isSet(true);
}
}
}
}