/**
* Autogenerated by Thrift Compiler (0.8.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.opentripplanner.api.thrift.definition;
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 org.apache.thrift.protocol.TTupleProtocol;
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;
public class TripPaths implements org.apache.thrift.TBase<TripPaths, TripPaths._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TripPaths");
private static final org.apache.thrift.protocol.TField TRIP_FIELD_DESC = new org.apache.thrift.protocol.TField("trip", org.apache.thrift.protocol.TType.STRUCT, (short)1);
private static final org.apache.thrift.protocol.TField PATHS_FIELD_DESC = new org.apache.thrift.protocol.TField("paths", org.apache.thrift.protocol.TType.LIST, (short)2);
private static final org.apache.thrift.protocol.TField NO_PATHS_FOUND_FIELD_DESC = new org.apache.thrift.protocol.TField("no_paths_found", org.apache.thrift.protocol.TType.BOOL, (short)3);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new TripPathsStandardSchemeFactory());
schemes.put(TupleScheme.class, new TripPathsTupleSchemeFactory());
}
private TripParameters trip; // required
private List<Path> paths; // optional
private boolean no_paths_found; // 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 {
TRIP((short)1, "trip"),
PATHS((short)2, "paths"),
NO_PATHS_FOUND((short)3, "no_paths_found");
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: // TRIP
return TRIP;
case 2: // PATHS
return PATHS;
case 3: // NO_PATHS_FOUND
return NO_PATHS_FOUND;
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 __NO_PATHS_FOUND_ISSET_ID = 0;
private BitSet __isset_bit_vector = new BitSet(1);
private _Fields optionals[] = {_Fields.PATHS,_Fields.NO_PATHS_FOUND};
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.TRIP, new org.apache.thrift.meta_data.FieldMetaData("trip", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TripParameters.class)));
tmpMap.put(_Fields.PATHS, new org.apache.thrift.meta_data.FieldMetaData("paths", org.apache.thrift.TFieldRequirementType.OPTIONAL,
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, Path.class))));
tmpMap.put(_Fields.NO_PATHS_FOUND, new org.apache.thrift.meta_data.FieldMetaData("no_paths_found", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TripPaths.class, metaDataMap);
}
public TripPaths() {
this.no_paths_found = false;
}
public TripPaths(
TripParameters trip)
{
this();
this.trip = trip;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public TripPaths(TripPaths other) {
__isset_bit_vector.clear();
__isset_bit_vector.or(other.__isset_bit_vector);
if (other.isSetTrip()) {
this.trip = new TripParameters(other.trip);
}
if (other.isSetPaths()) {
List<Path> __this__paths = new ArrayList<Path>();
for (Path other_element : other.paths) {
__this__paths.add(new Path(other_element));
}
this.paths = __this__paths;
}
this.no_paths_found = other.no_paths_found;
}
public TripPaths deepCopy() {
return new TripPaths(this);
}
@Override
public void clear() {
this.trip = null;
this.paths = null;
this.no_paths_found = false;
}
public TripParameters getTrip() {
return this.trip;
}
public void setTrip(TripParameters trip) {
this.trip = trip;
}
public void unsetTrip() {
this.trip = null;
}
/** Returns true if field trip is set (has been assigned a value) and false otherwise */
public boolean isSetTrip() {
return this.trip != null;
}
public void setTripIsSet(boolean value) {
if (!value) {
this.trip = null;
}
}
public int getPathsSize() {
return (this.paths == null) ? 0 : this.paths.size();
}
public java.util.Iterator<Path> getPathsIterator() {
return (this.paths == null) ? null : this.paths.iterator();
}
public void addToPaths(Path elem) {
if (this.paths == null) {
this.paths = new ArrayList<Path>();
}
this.paths.add(elem);
}
public List<Path> getPaths() {
return this.paths;
}
public void setPaths(List<Path> paths) {
this.paths = paths;
}
public void unsetPaths() {
this.paths = null;
}
/** Returns true if field paths is set (has been assigned a value) and false otherwise */
public boolean isSetPaths() {
return this.paths != null;
}
public void setPathsIsSet(boolean value) {
if (!value) {
this.paths = null;
}
}
public boolean isNo_paths_found() {
return this.no_paths_found;
}
public void setNo_paths_found(boolean no_paths_found) {
this.no_paths_found = no_paths_found;
setNo_paths_foundIsSet(true);
}
public void unsetNo_paths_found() {
__isset_bit_vector.clear(__NO_PATHS_FOUND_ISSET_ID);
}
/** Returns true if field no_paths_found is set (has been assigned a value) and false otherwise */
public boolean isSetNo_paths_found() {
return __isset_bit_vector.get(__NO_PATHS_FOUND_ISSET_ID);
}
public void setNo_paths_foundIsSet(boolean value) {
__isset_bit_vector.set(__NO_PATHS_FOUND_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case TRIP:
if (value == null) {
unsetTrip();
} else {
setTrip((TripParameters)value);
}
break;
case PATHS:
if (value == null) {
unsetPaths();
} else {
setPaths((List<Path>)value);
}
break;
case NO_PATHS_FOUND:
if (value == null) {
unsetNo_paths_found();
} else {
setNo_paths_found((Boolean)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case TRIP:
return getTrip();
case PATHS:
return getPaths();
case NO_PATHS_FOUND:
return Boolean.valueOf(isNo_paths_found());
}
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 TRIP:
return isSetTrip();
case PATHS:
return isSetPaths();
case NO_PATHS_FOUND:
return isSetNo_paths_found();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof TripPaths)
return this.equals((TripPaths)that);
return false;
}
public boolean equals(TripPaths that) {
if (that == null)
return false;
boolean this_present_trip = true && this.isSetTrip();
boolean that_present_trip = true && that.isSetTrip();
if (this_present_trip || that_present_trip) {
if (!(this_present_trip && that_present_trip))
return false;
if (!this.trip.equals(that.trip))
return false;
}
boolean this_present_paths = true && this.isSetPaths();
boolean that_present_paths = true && that.isSetPaths();
if (this_present_paths || that_present_paths) {
if (!(this_present_paths && that_present_paths))
return false;
if (!this.paths.equals(that.paths))
return false;
}
boolean this_present_no_paths_found = true && this.isSetNo_paths_found();
boolean that_present_no_paths_found = true && that.isSetNo_paths_found();
if (this_present_no_paths_found || that_present_no_paths_found) {
if (!(this_present_no_paths_found && that_present_no_paths_found))
return false;
if (this.no_paths_found != that.no_paths_found)
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(TripPaths other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
TripPaths typedOther = (TripPaths)other;
lastComparison = Boolean.valueOf(isSetTrip()).compareTo(typedOther.isSetTrip());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetTrip()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.trip, typedOther.trip);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetPaths()).compareTo(typedOther.isSetPaths());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetPaths()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.paths, typedOther.paths);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetNo_paths_found()).compareTo(typedOther.isSetNo_paths_found());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetNo_paths_found()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.no_paths_found, typedOther.no_paths_found);
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("TripPaths(");
boolean first = true;
sb.append("trip:");
if (this.trip == null) {
sb.append("null");
} else {
sb.append(this.trip);
}
first = false;
if (isSetPaths()) {
if (!first) sb.append(", ");
sb.append("paths:");
if (this.paths == null) {
sb.append("null");
} else {
sb.append(this.paths);
}
first = false;
}
if (isSetNo_paths_found()) {
if (!first) sb.append(", ");
sb.append("no_paths_found:");
sb.append(this.no_paths_found);
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (!isSetTrip()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'trip' is unset! Struct:" + toString());
}
}
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 {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
__isset_bit_vector = new BitSet(1);
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 TripPathsStandardSchemeFactory implements SchemeFactory {
public TripPathsStandardScheme getScheme() {
return new TripPathsStandardScheme();
}
}
private static class TripPathsStandardScheme extends StandardScheme<TripPaths> {
public void read(org.apache.thrift.protocol.TProtocol iprot, TripPaths 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: // TRIP
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
struct.trip = new TripParameters();
struct.trip.read(iprot);
struct.setTripIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // PATHS
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list24 = iprot.readListBegin();
struct.paths = new ArrayList<Path>(_list24.size);
for (int _i25 = 0; _i25 < _list24.size; ++_i25)
{
Path _elem26; // required
_elem26 = new Path();
_elem26.read(iprot);
struct.paths.add(_elem26);
}
iprot.readListEnd();
}
struct.setPathsIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // NO_PATHS_FOUND
if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
struct.no_paths_found = iprot.readBool();
struct.setNo_paths_foundIsSet(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, TripPaths struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.trip != null) {
oprot.writeFieldBegin(TRIP_FIELD_DESC);
struct.trip.write(oprot);
oprot.writeFieldEnd();
}
if (struct.paths != null) {
if (struct.isSetPaths()) {
oprot.writeFieldBegin(PATHS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.paths.size()));
for (Path _iter27 : struct.paths)
{
_iter27.write(oprot);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
}
if (struct.isSetNo_paths_found()) {
oprot.writeFieldBegin(NO_PATHS_FOUND_FIELD_DESC);
oprot.writeBool(struct.no_paths_found);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class TripPathsTupleSchemeFactory implements SchemeFactory {
public TripPathsTupleScheme getScheme() {
return new TripPathsTupleScheme();
}
}
private static class TripPathsTupleScheme extends TupleScheme<TripPaths> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, TripPaths struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
struct.trip.write(oprot);
BitSet optionals = new BitSet();
if (struct.isSetPaths()) {
optionals.set(0);
}
if (struct.isSetNo_paths_found()) {
optionals.set(1);
}
oprot.writeBitSet(optionals, 2);
if (struct.isSetPaths()) {
{
oprot.writeI32(struct.paths.size());
for (Path _iter28 : struct.paths)
{
_iter28.write(oprot);
}
}
}
if (struct.isSetNo_paths_found()) {
oprot.writeBool(struct.no_paths_found);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, TripPaths struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
struct.trip = new TripParameters();
struct.trip.read(iprot);
struct.setTripIsSet(true);
BitSet incoming = iprot.readBitSet(2);
if (incoming.get(0)) {
{
org.apache.thrift.protocol.TList _list29 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
struct.paths = new ArrayList<Path>(_list29.size);
for (int _i30 = 0; _i30 < _list29.size; ++_i30)
{
Path _elem31; // required
_elem31 = new Path();
_elem31.read(iprot);
struct.paths.add(_elem31);
}
}
struct.setPathsIsSet(true);
}
if (incoming.get(1)) {
struct.no_paths_found = iprot.readBool();
struct.setNo_paths_foundIsSet(true);
}
}
}
}