/** * Autogenerated by Thrift Compiler (0.8.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package org.riksa.bombah.thrift; 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 BombState implements org.apache.thrift.TBase<BombState, BombState._Fields>, java.io.Serializable, Cloneable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("BombState"); private static final org.apache.thrift.protocol.TField BLAST_SIZE_FIELD_DESC = new org.apache.thrift.protocol.TField("blastSize", org.apache.thrift.protocol.TType.BYTE, (short)1); private static final org.apache.thrift.protocol.TField X_COORDINATE_FIELD_DESC = new org.apache.thrift.protocol.TField("xCoordinate", org.apache.thrift.protocol.TType.DOUBLE, (short)2); private static final org.apache.thrift.protocol.TField Y_COORDINATE_FIELD_DESC = new org.apache.thrift.protocol.TField("yCoordinate", org.apache.thrift.protocol.TType.DOUBLE, (short)3); private static final org.apache.thrift.protocol.TField TICKS_REMAINING_FIELD_DESC = new org.apache.thrift.protocol.TField("ticksRemaining", org.apache.thrift.protocol.TType.I32, (short)4); private static final org.apache.thrift.protocol.TField MOVING_FIELD_DESC = new org.apache.thrift.protocol.TField("moving", org.apache.thrift.protocol.TType.BOOL, (short)5); private static final org.apache.thrift.protocol.TField DIRECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("direction", org.apache.thrift.protocol.TType.I32, (short)6); private static final org.apache.thrift.protocol.TField OWNER_FIELD_DESC = new org.apache.thrift.protocol.TField("owner", org.apache.thrift.protocol.TType.I32, (short)7); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { schemes.put(StandardScheme.class, new BombStateStandardSchemeFactory()); schemes.put(TupleScheme.class, new BombStateTupleSchemeFactory()); } public byte blastSize; // required public double xCoordinate; // required public double yCoordinate; // required public int ticksRemaining; // required public boolean moving; // required /** * * @see Direction */ public Direction direction; // required public int owner; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { BLAST_SIZE((short)1, "blastSize"), X_COORDINATE((short)2, "xCoordinate"), Y_COORDINATE((short)3, "yCoordinate"), TICKS_REMAINING((short)4, "ticksRemaining"), MOVING((short)5, "moving"), /** * * @see Direction */ DIRECTION((short)6, "direction"), OWNER((short)7, "owner"); 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: // BLAST_SIZE return BLAST_SIZE; case 2: // X_COORDINATE return X_COORDINATE; case 3: // Y_COORDINATE return Y_COORDINATE; case 4: // TICKS_REMAINING return TICKS_REMAINING; case 5: // MOVING return MOVING; case 6: // DIRECTION return DIRECTION; case 7: // OWNER return OWNER; 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 __BLASTSIZE_ISSET_ID = 0; private static final int __XCOORDINATE_ISSET_ID = 1; private static final int __YCOORDINATE_ISSET_ID = 2; private static final int __TICKSREMAINING_ISSET_ID = 3; private static final int __MOVING_ISSET_ID = 4; private static final int __OWNER_ISSET_ID = 5; private BitSet __isset_bit_vector = new BitSet(6); 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.BLAST_SIZE, new org.apache.thrift.meta_data.FieldMetaData("blastSize", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BYTE))); tmpMap.put(_Fields.X_COORDINATE, new org.apache.thrift.meta_data.FieldMetaData("xCoordinate", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE))); tmpMap.put(_Fields.Y_COORDINATE, new org.apache.thrift.meta_data.FieldMetaData("yCoordinate", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE))); tmpMap.put(_Fields.TICKS_REMAINING, new org.apache.thrift.meta_data.FieldMetaData("ticksRemaining", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); tmpMap.put(_Fields.MOVING, new org.apache.thrift.meta_data.FieldMetaData("moving", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); tmpMap.put(_Fields.DIRECTION, new org.apache.thrift.meta_data.FieldMetaData("direction", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, Direction.class))); tmpMap.put(_Fields.OWNER, new org.apache.thrift.meta_data.FieldMetaData("owner", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(BombState.class, metaDataMap); } public BombState() { } public BombState( byte blastSize, double xCoordinate, double yCoordinate, int ticksRemaining, boolean moving, Direction direction, int owner) { this(); this.blastSize = blastSize; setBlastSizeIsSet(true); this.xCoordinate = xCoordinate; setXCoordinateIsSet(true); this.yCoordinate = yCoordinate; setYCoordinateIsSet(true); this.ticksRemaining = ticksRemaining; setTicksRemainingIsSet(true); this.moving = moving; setMovingIsSet(true); this.direction = direction; this.owner = owner; setOwnerIsSet(true); } /** * Performs a deep copy on <i>other</i>. */ public BombState(BombState other) { __isset_bit_vector.clear(); __isset_bit_vector.or(other.__isset_bit_vector); this.blastSize = other.blastSize; this.xCoordinate = other.xCoordinate; this.yCoordinate = other.yCoordinate; this.ticksRemaining = other.ticksRemaining; this.moving = other.moving; if (other.isSetDirection()) { this.direction = other.direction; } this.owner = other.owner; } public BombState deepCopy() { return new BombState(this); } @Override public void clear() { setBlastSizeIsSet(false); this.blastSize = 0; setXCoordinateIsSet(false); this.xCoordinate = 0.0; setYCoordinateIsSet(false); this.yCoordinate = 0.0; setTicksRemainingIsSet(false); this.ticksRemaining = 0; setMovingIsSet(false); this.moving = false; this.direction = null; setOwnerIsSet(false); this.owner = 0; } public byte getBlastSize() { return this.blastSize; } public BombState setBlastSize(byte blastSize) { this.blastSize = blastSize; setBlastSizeIsSet(true); return this; } public void unsetBlastSize() { __isset_bit_vector.clear(__BLASTSIZE_ISSET_ID); } /** Returns true if field blastSize is set (has been assigned a value) and false otherwise */ public boolean isSetBlastSize() { return __isset_bit_vector.get(__BLASTSIZE_ISSET_ID); } public void setBlastSizeIsSet(boolean value) { __isset_bit_vector.set(__BLASTSIZE_ISSET_ID, value); } public double getXCoordinate() { return this.xCoordinate; } public BombState setXCoordinate(double xCoordinate) { this.xCoordinate = xCoordinate; setXCoordinateIsSet(true); return this; } public void unsetXCoordinate() { __isset_bit_vector.clear(__XCOORDINATE_ISSET_ID); } /** Returns true if field xCoordinate is set (has been assigned a value) and false otherwise */ public boolean isSetXCoordinate() { return __isset_bit_vector.get(__XCOORDINATE_ISSET_ID); } public void setXCoordinateIsSet(boolean value) { __isset_bit_vector.set(__XCOORDINATE_ISSET_ID, value); } public double getYCoordinate() { return this.yCoordinate; } public BombState setYCoordinate(double yCoordinate) { this.yCoordinate = yCoordinate; setYCoordinateIsSet(true); return this; } public void unsetYCoordinate() { __isset_bit_vector.clear(__YCOORDINATE_ISSET_ID); } /** Returns true if field yCoordinate is set (has been assigned a value) and false otherwise */ public boolean isSetYCoordinate() { return __isset_bit_vector.get(__YCOORDINATE_ISSET_ID); } public void setYCoordinateIsSet(boolean value) { __isset_bit_vector.set(__YCOORDINATE_ISSET_ID, value); } public int getTicksRemaining() { return this.ticksRemaining; } public BombState setTicksRemaining(int ticksRemaining) { this.ticksRemaining = ticksRemaining; setTicksRemainingIsSet(true); return this; } public void unsetTicksRemaining() { __isset_bit_vector.clear(__TICKSREMAINING_ISSET_ID); } /** Returns true if field ticksRemaining is set (has been assigned a value) and false otherwise */ public boolean isSetTicksRemaining() { return __isset_bit_vector.get(__TICKSREMAINING_ISSET_ID); } public void setTicksRemainingIsSet(boolean value) { __isset_bit_vector.set(__TICKSREMAINING_ISSET_ID, value); } public boolean isMoving() { return this.moving; } public BombState setMoving(boolean moving) { this.moving = moving; setMovingIsSet(true); return this; } public void unsetMoving() { __isset_bit_vector.clear(__MOVING_ISSET_ID); } /** Returns true if field moving is set (has been assigned a value) and false otherwise */ public boolean isSetMoving() { return __isset_bit_vector.get(__MOVING_ISSET_ID); } public void setMovingIsSet(boolean value) { __isset_bit_vector.set(__MOVING_ISSET_ID, value); } /** * * @see Direction */ public Direction getDirection() { return this.direction; } /** * * @see Direction */ public BombState setDirection(Direction direction) { this.direction = direction; return this; } public void unsetDirection() { this.direction = null; } /** Returns true if field direction is set (has been assigned a value) and false otherwise */ public boolean isSetDirection() { return this.direction != null; } public void setDirectionIsSet(boolean value) { if (!value) { this.direction = null; } } public int getOwner() { return this.owner; } public BombState setOwner(int owner) { this.owner = owner; setOwnerIsSet(true); return this; } public void unsetOwner() { __isset_bit_vector.clear(__OWNER_ISSET_ID); } /** Returns true if field owner is set (has been assigned a value) and false otherwise */ public boolean isSetOwner() { return __isset_bit_vector.get(__OWNER_ISSET_ID); } public void setOwnerIsSet(boolean value) { __isset_bit_vector.set(__OWNER_ISSET_ID, value); } public void setFieldValue(_Fields field, Object value) { switch (field) { case BLAST_SIZE: if (value == null) { unsetBlastSize(); } else { setBlastSize((Byte)value); } break; case X_COORDINATE: if (value == null) { unsetXCoordinate(); } else { setXCoordinate((Double)value); } break; case Y_COORDINATE: if (value == null) { unsetYCoordinate(); } else { setYCoordinate((Double)value); } break; case TICKS_REMAINING: if (value == null) { unsetTicksRemaining(); } else { setTicksRemaining((Integer)value); } break; case MOVING: if (value == null) { unsetMoving(); } else { setMoving((Boolean)value); } break; case DIRECTION: if (value == null) { unsetDirection(); } else { setDirection((Direction)value); } break; case OWNER: if (value == null) { unsetOwner(); } else { setOwner((Integer)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case BLAST_SIZE: return Byte.valueOf(getBlastSize()); case X_COORDINATE: return Double.valueOf(getXCoordinate()); case Y_COORDINATE: return Double.valueOf(getYCoordinate()); case TICKS_REMAINING: return Integer.valueOf(getTicksRemaining()); case MOVING: return Boolean.valueOf(isMoving()); case DIRECTION: return getDirection(); case OWNER: return Integer.valueOf(getOwner()); } 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 BLAST_SIZE: return isSetBlastSize(); case X_COORDINATE: return isSetXCoordinate(); case Y_COORDINATE: return isSetYCoordinate(); case TICKS_REMAINING: return isSetTicksRemaining(); case MOVING: return isSetMoving(); case DIRECTION: return isSetDirection(); case OWNER: return isSetOwner(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof BombState) return this.equals((BombState)that); return false; } public boolean equals(BombState that) { if (that == null) return false; boolean this_present_blastSize = true; boolean that_present_blastSize = true; if (this_present_blastSize || that_present_blastSize) { if (!(this_present_blastSize && that_present_blastSize)) return false; if (this.blastSize != that.blastSize) return false; } boolean this_present_xCoordinate = true; boolean that_present_xCoordinate = true; if (this_present_xCoordinate || that_present_xCoordinate) { if (!(this_present_xCoordinate && that_present_xCoordinate)) return false; if (this.xCoordinate != that.xCoordinate) return false; } boolean this_present_yCoordinate = true; boolean that_present_yCoordinate = true; if (this_present_yCoordinate || that_present_yCoordinate) { if (!(this_present_yCoordinate && that_present_yCoordinate)) return false; if (this.yCoordinate != that.yCoordinate) return false; } boolean this_present_ticksRemaining = true; boolean that_present_ticksRemaining = true; if (this_present_ticksRemaining || that_present_ticksRemaining) { if (!(this_present_ticksRemaining && that_present_ticksRemaining)) return false; if (this.ticksRemaining != that.ticksRemaining) return false; } boolean this_present_moving = true; boolean that_present_moving = true; if (this_present_moving || that_present_moving) { if (!(this_present_moving && that_present_moving)) return false; if (this.moving != that.moving) return false; } boolean this_present_direction = true && this.isSetDirection(); boolean that_present_direction = true && that.isSetDirection(); if (this_present_direction || that_present_direction) { if (!(this_present_direction && that_present_direction)) return false; if (!this.direction.equals(that.direction)) return false; } boolean this_present_owner = true; boolean that_present_owner = true; if (this_present_owner || that_present_owner) { if (!(this_present_owner && that_present_owner)) return false; if (this.owner != that.owner) return false; } return true; } @Override public int hashCode() { return 0; } public int compareTo(BombState other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; BombState typedOther = (BombState)other; lastComparison = Boolean.valueOf(isSetBlastSize()).compareTo(typedOther.isSetBlastSize()); if (lastComparison != 0) { return lastComparison; } if (isSetBlastSize()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.blastSize, typedOther.blastSize); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetXCoordinate()).compareTo(typedOther.isSetXCoordinate()); if (lastComparison != 0) { return lastComparison; } if (isSetXCoordinate()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.xCoordinate, typedOther.xCoordinate); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetYCoordinate()).compareTo(typedOther.isSetYCoordinate()); if (lastComparison != 0) { return lastComparison; } if (isSetYCoordinate()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.yCoordinate, typedOther.yCoordinate); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetTicksRemaining()).compareTo(typedOther.isSetTicksRemaining()); if (lastComparison != 0) { return lastComparison; } if (isSetTicksRemaining()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ticksRemaining, typedOther.ticksRemaining); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetMoving()).compareTo(typedOther.isSetMoving()); if (lastComparison != 0) { return lastComparison; } if (isSetMoving()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.moving, typedOther.moving); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetDirection()).compareTo(typedOther.isSetDirection()); if (lastComparison != 0) { return lastComparison; } if (isSetDirection()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.direction, typedOther.direction); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetOwner()).compareTo(typedOther.isSetOwner()); if (lastComparison != 0) { return lastComparison; } if (isSetOwner()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.owner, typedOther.owner); 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("BombState("); boolean first = true; sb.append("blastSize:"); sb.append(this.blastSize); first = false; if (!first) sb.append(", "); sb.append("xCoordinate:"); sb.append(this.xCoordinate); first = false; if (!first) sb.append(", "); sb.append("yCoordinate:"); sb.append(this.yCoordinate); first = false; if (!first) sb.append(", "); sb.append("ticksRemaining:"); sb.append(this.ticksRemaining); first = false; if (!first) sb.append(", "); sb.append("moving:"); sb.append(this.moving); first = false; if (!first) sb.append(", "); sb.append("direction:"); if (this.direction == null) { sb.append("null"); } else { sb.append(this.direction); } first = false; if (!first) sb.append(", "); sb.append("owner:"); sb.append(this.owner); first = false; sb.append(")"); return sb.toString(); } public void validate() throws org.apache.thrift.TException { // check for required fields } 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 BombStateStandardSchemeFactory implements SchemeFactory { public BombStateStandardScheme getScheme() { return new BombStateStandardScheme(); } } private static class BombStateStandardScheme extends StandardScheme<BombState> { public void read(org.apache.thrift.protocol.TProtocol iprot, BombState 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: // BLAST_SIZE if (schemeField.type == org.apache.thrift.protocol.TType.BYTE) { struct.blastSize = iprot.readByte(); struct.setBlastSizeIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // X_COORDINATE if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) { struct.xCoordinate = iprot.readDouble(); struct.setXCoordinateIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 3: // Y_COORDINATE if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) { struct.yCoordinate = iprot.readDouble(); struct.setYCoordinateIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 4: // TICKS_REMAINING if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.ticksRemaining = iprot.readI32(); struct.setTicksRemainingIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 5: // MOVING if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { struct.moving = iprot.readBool(); struct.setMovingIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 6: // DIRECTION if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.direction = Direction.findByValue(iprot.readI32()); struct.setDirectionIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 7: // OWNER if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.owner = iprot.readI32(); struct.setOwnerIsSet(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(); // check for required fields of primitive type, which can't be checked in the validate method struct.validate(); } public void write(org.apache.thrift.protocol.TProtocol oprot, BombState struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); oprot.writeFieldBegin(BLAST_SIZE_FIELD_DESC); oprot.writeByte(struct.blastSize); oprot.writeFieldEnd(); oprot.writeFieldBegin(X_COORDINATE_FIELD_DESC); oprot.writeDouble(struct.xCoordinate); oprot.writeFieldEnd(); oprot.writeFieldBegin(Y_COORDINATE_FIELD_DESC); oprot.writeDouble(struct.yCoordinate); oprot.writeFieldEnd(); oprot.writeFieldBegin(TICKS_REMAINING_FIELD_DESC); oprot.writeI32(struct.ticksRemaining); oprot.writeFieldEnd(); oprot.writeFieldBegin(MOVING_FIELD_DESC); oprot.writeBool(struct.moving); oprot.writeFieldEnd(); if (struct.direction != null) { oprot.writeFieldBegin(DIRECTION_FIELD_DESC); oprot.writeI32(struct.direction.getValue()); oprot.writeFieldEnd(); } oprot.writeFieldBegin(OWNER_FIELD_DESC); oprot.writeI32(struct.owner); oprot.writeFieldEnd(); oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class BombStateTupleSchemeFactory implements SchemeFactory { public BombStateTupleScheme getScheme() { return new BombStateTupleScheme(); } } private static class BombStateTupleScheme extends TupleScheme<BombState> { @Override public void write(org.apache.thrift.protocol.TProtocol prot, BombState struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetBlastSize()) { optionals.set(0); } if (struct.isSetXCoordinate()) { optionals.set(1); } if (struct.isSetYCoordinate()) { optionals.set(2); } if (struct.isSetTicksRemaining()) { optionals.set(3); } if (struct.isSetMoving()) { optionals.set(4); } if (struct.isSetDirection()) { optionals.set(5); } if (struct.isSetOwner()) { optionals.set(6); } oprot.writeBitSet(optionals, 7); if (struct.isSetBlastSize()) { oprot.writeByte(struct.blastSize); } if (struct.isSetXCoordinate()) { oprot.writeDouble(struct.xCoordinate); } if (struct.isSetYCoordinate()) { oprot.writeDouble(struct.yCoordinate); } if (struct.isSetTicksRemaining()) { oprot.writeI32(struct.ticksRemaining); } if (struct.isSetMoving()) { oprot.writeBool(struct.moving); } if (struct.isSetDirection()) { oprot.writeI32(struct.direction.getValue()); } if (struct.isSetOwner()) { oprot.writeI32(struct.owner); } } @Override public void read(org.apache.thrift.protocol.TProtocol prot, BombState struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(7); if (incoming.get(0)) { struct.blastSize = iprot.readByte(); struct.setBlastSizeIsSet(true); } if (incoming.get(1)) { struct.xCoordinate = iprot.readDouble(); struct.setXCoordinateIsSet(true); } if (incoming.get(2)) { struct.yCoordinate = iprot.readDouble(); struct.setYCoordinateIsSet(true); } if (incoming.get(3)) { struct.ticksRemaining = iprot.readI32(); struct.setTicksRemainingIsSet(true); } if (incoming.get(4)) { struct.moving = iprot.readBool(); struct.setMovingIsSet(true); } if (incoming.get(5)) { struct.direction = Direction.findByValue(iprot.readI32()); struct.setDirectionIsSet(true); } if (incoming.get(6)) { struct.owner = iprot.readI32(); struct.setOwnerIsSet(true); } } } }