/**
* 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 GameInfo implements org.apache.thrift.TBase<GameInfo, GameInfo._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("GameInfo");
private static final org.apache.thrift.protocol.TField MAP_WIDTH_FIELD_DESC = new org.apache.thrift.protocol.TField("mapWidth", org.apache.thrift.protocol.TType.BYTE, (short)1);
private static final org.apache.thrift.protocol.TField MAP_HEIGHT_FIELD_DESC = new org.apache.thrift.protocol.TField("mapHeight", org.apache.thrift.protocol.TType.BYTE, (short)2);
private static final org.apache.thrift.protocol.TField TILES_FIELD_DESC = new org.apache.thrift.protocol.TField("tiles", org.apache.thrift.protocol.TType.LIST, (short)3);
private static final org.apache.thrift.protocol.TField STARTING_POSITIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("startingPositions", org.apache.thrift.protocol.TType.LIST, (short)4);
private static final org.apache.thrift.protocol.TField TICKS_TOTAL_FIELD_DESC = new org.apache.thrift.protocol.TField("ticksTotal", org.apache.thrift.protocol.TType.I32, (short)5);
private static final org.apache.thrift.protocol.TField TICKS_PER_SECOND_FIELD_DESC = new org.apache.thrift.protocol.TField("ticksPerSecond", org.apache.thrift.protocol.TType.I32, (short)6);
private static final org.apache.thrift.protocol.TField GAME_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("gameId", org.apache.thrift.protocol.TType.I32, (short)7);
private static final org.apache.thrift.protocol.TField PLAYER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("playerId", org.apache.thrift.protocol.TType.I32, (short)8);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new GameInfoStandardSchemeFactory());
schemes.put(TupleScheme.class, new GameInfoTupleSchemeFactory());
}
public byte mapWidth; // required
public byte mapHeight; // required
public List<Tile> tiles; // required
public List<Coordinate> startingPositions; // required
public int ticksTotal; // required
public int ticksPerSecond; // required
public int gameId; // required
public int playerId; // 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 {
MAP_WIDTH((short)1, "mapWidth"),
MAP_HEIGHT((short)2, "mapHeight"),
TILES((short)3, "tiles"),
STARTING_POSITIONS((short)4, "startingPositions"),
TICKS_TOTAL((short)5, "ticksTotal"),
TICKS_PER_SECOND((short)6, "ticksPerSecond"),
GAME_ID((short)7, "gameId"),
PLAYER_ID((short)8, "playerId");
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: // MAP_WIDTH
return MAP_WIDTH;
case 2: // MAP_HEIGHT
return MAP_HEIGHT;
case 3: // TILES
return TILES;
case 4: // STARTING_POSITIONS
return STARTING_POSITIONS;
case 5: // TICKS_TOTAL
return TICKS_TOTAL;
case 6: // TICKS_PER_SECOND
return TICKS_PER_SECOND;
case 7: // GAME_ID
return GAME_ID;
case 8: // PLAYER_ID
return PLAYER_ID;
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 __MAPWIDTH_ISSET_ID = 0;
private static final int __MAPHEIGHT_ISSET_ID = 1;
private static final int __TICKSTOTAL_ISSET_ID = 2;
private static final int __TICKSPERSECOND_ISSET_ID = 3;
private static final int __GAMEID_ISSET_ID = 4;
private static final int __PLAYERID_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.MAP_WIDTH, new org.apache.thrift.meta_data.FieldMetaData("mapWidth", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BYTE)));
tmpMap.put(_Fields.MAP_HEIGHT, new org.apache.thrift.meta_data.FieldMetaData("mapHeight", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BYTE)));
tmpMap.put(_Fields.TILES, new org.apache.thrift.meta_data.FieldMetaData("tiles", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, Tile.class))));
tmpMap.put(_Fields.STARTING_POSITIONS, new org.apache.thrift.meta_data.FieldMetaData("startingPositions", 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, Coordinate.class))));
tmpMap.put(_Fields.TICKS_TOTAL, new org.apache.thrift.meta_data.FieldMetaData("ticksTotal", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.TICKS_PER_SECOND, new org.apache.thrift.meta_data.FieldMetaData("ticksPerSecond", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.GAME_ID, new org.apache.thrift.meta_data.FieldMetaData("gameId", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.PLAYER_ID, new org.apache.thrift.meta_data.FieldMetaData("playerId", 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(GameInfo.class, metaDataMap);
}
public GameInfo() {
}
public GameInfo(
byte mapWidth,
byte mapHeight,
List<Tile> tiles,
List<Coordinate> startingPositions,
int ticksTotal,
int ticksPerSecond,
int gameId,
int playerId)
{
this();
this.mapWidth = mapWidth;
setMapWidthIsSet(true);
this.mapHeight = mapHeight;
setMapHeightIsSet(true);
this.tiles = tiles;
this.startingPositions = startingPositions;
this.ticksTotal = ticksTotal;
setTicksTotalIsSet(true);
this.ticksPerSecond = ticksPerSecond;
setTicksPerSecondIsSet(true);
this.gameId = gameId;
setGameIdIsSet(true);
this.playerId = playerId;
setPlayerIdIsSet(true);
}
/**
* Performs a deep copy on <i>other</i>.
*/
public GameInfo(GameInfo other) {
__isset_bit_vector.clear();
__isset_bit_vector.or(other.__isset_bit_vector);
this.mapWidth = other.mapWidth;
this.mapHeight = other.mapHeight;
if (other.isSetTiles()) {
List<Tile> __this__tiles = new ArrayList<Tile>();
for (Tile other_element : other.tiles) {
__this__tiles.add(other_element);
}
this.tiles = __this__tiles;
}
if (other.isSetStartingPositions()) {
List<Coordinate> __this__startingPositions = new ArrayList<Coordinate>();
for (Coordinate other_element : other.startingPositions) {
__this__startingPositions.add(new Coordinate(other_element));
}
this.startingPositions = __this__startingPositions;
}
this.ticksTotal = other.ticksTotal;
this.ticksPerSecond = other.ticksPerSecond;
this.gameId = other.gameId;
this.playerId = other.playerId;
}
public GameInfo deepCopy() {
return new GameInfo(this);
}
@Override
public void clear() {
setMapWidthIsSet(false);
this.mapWidth = 0;
setMapHeightIsSet(false);
this.mapHeight = 0;
this.tiles = null;
this.startingPositions = null;
setTicksTotalIsSet(false);
this.ticksTotal = 0;
setTicksPerSecondIsSet(false);
this.ticksPerSecond = 0;
setGameIdIsSet(false);
this.gameId = 0;
setPlayerIdIsSet(false);
this.playerId = 0;
}
public byte getMapWidth() {
return this.mapWidth;
}
public GameInfo setMapWidth(byte mapWidth) {
this.mapWidth = mapWidth;
setMapWidthIsSet(true);
return this;
}
public void unsetMapWidth() {
__isset_bit_vector.clear(__MAPWIDTH_ISSET_ID);
}
/** Returns true if field mapWidth is set (has been assigned a value) and false otherwise */
public boolean isSetMapWidth() {
return __isset_bit_vector.get(__MAPWIDTH_ISSET_ID);
}
public void setMapWidthIsSet(boolean value) {
__isset_bit_vector.set(__MAPWIDTH_ISSET_ID, value);
}
public byte getMapHeight() {
return this.mapHeight;
}
public GameInfo setMapHeight(byte mapHeight) {
this.mapHeight = mapHeight;
setMapHeightIsSet(true);
return this;
}
public void unsetMapHeight() {
__isset_bit_vector.clear(__MAPHEIGHT_ISSET_ID);
}
/** Returns true if field mapHeight is set (has been assigned a value) and false otherwise */
public boolean isSetMapHeight() {
return __isset_bit_vector.get(__MAPHEIGHT_ISSET_ID);
}
public void setMapHeightIsSet(boolean value) {
__isset_bit_vector.set(__MAPHEIGHT_ISSET_ID, value);
}
public int getTilesSize() {
return (this.tiles == null) ? 0 : this.tiles.size();
}
public java.util.Iterator<Tile> getTilesIterator() {
return (this.tiles == null) ? null : this.tiles.iterator();
}
public void addToTiles(Tile elem) {
if (this.tiles == null) {
this.tiles = new ArrayList<Tile>();
}
this.tiles.add(elem);
}
public List<Tile> getTiles() {
return this.tiles;
}
public GameInfo setTiles(List<Tile> tiles) {
this.tiles = tiles;
return this;
}
public void unsetTiles() {
this.tiles = null;
}
/** Returns true if field tiles is set (has been assigned a value) and false otherwise */
public boolean isSetTiles() {
return this.tiles != null;
}
public void setTilesIsSet(boolean value) {
if (!value) {
this.tiles = null;
}
}
public int getStartingPositionsSize() {
return (this.startingPositions == null) ? 0 : this.startingPositions.size();
}
public java.util.Iterator<Coordinate> getStartingPositionsIterator() {
return (this.startingPositions == null) ? null : this.startingPositions.iterator();
}
public void addToStartingPositions(Coordinate elem) {
if (this.startingPositions == null) {
this.startingPositions = new ArrayList<Coordinate>();
}
this.startingPositions.add(elem);
}
public List<Coordinate> getStartingPositions() {
return this.startingPositions;
}
public GameInfo setStartingPositions(List<Coordinate> startingPositions) {
this.startingPositions = startingPositions;
return this;
}
public void unsetStartingPositions() {
this.startingPositions = null;
}
/** Returns true if field startingPositions is set (has been assigned a value) and false otherwise */
public boolean isSetStartingPositions() {
return this.startingPositions != null;
}
public void setStartingPositionsIsSet(boolean value) {
if (!value) {
this.startingPositions = null;
}
}
public int getTicksTotal() {
return this.ticksTotal;
}
public GameInfo setTicksTotal(int ticksTotal) {
this.ticksTotal = ticksTotal;
setTicksTotalIsSet(true);
return this;
}
public void unsetTicksTotal() {
__isset_bit_vector.clear(__TICKSTOTAL_ISSET_ID);
}
/** Returns true if field ticksTotal is set (has been assigned a value) and false otherwise */
public boolean isSetTicksTotal() {
return __isset_bit_vector.get(__TICKSTOTAL_ISSET_ID);
}
public void setTicksTotalIsSet(boolean value) {
__isset_bit_vector.set(__TICKSTOTAL_ISSET_ID, value);
}
public int getTicksPerSecond() {
return this.ticksPerSecond;
}
public GameInfo setTicksPerSecond(int ticksPerSecond) {
this.ticksPerSecond = ticksPerSecond;
setTicksPerSecondIsSet(true);
return this;
}
public void unsetTicksPerSecond() {
__isset_bit_vector.clear(__TICKSPERSECOND_ISSET_ID);
}
/** Returns true if field ticksPerSecond is set (has been assigned a value) and false otherwise */
public boolean isSetTicksPerSecond() {
return __isset_bit_vector.get(__TICKSPERSECOND_ISSET_ID);
}
public void setTicksPerSecondIsSet(boolean value) {
__isset_bit_vector.set(__TICKSPERSECOND_ISSET_ID, value);
}
public int getGameId() {
return this.gameId;
}
public GameInfo setGameId(int gameId) {
this.gameId = gameId;
setGameIdIsSet(true);
return this;
}
public void unsetGameId() {
__isset_bit_vector.clear(__GAMEID_ISSET_ID);
}
/** Returns true if field gameId is set (has been assigned a value) and false otherwise */
public boolean isSetGameId() {
return __isset_bit_vector.get(__GAMEID_ISSET_ID);
}
public void setGameIdIsSet(boolean value) {
__isset_bit_vector.set(__GAMEID_ISSET_ID, value);
}
public int getPlayerId() {
return this.playerId;
}
public GameInfo setPlayerId(int playerId) {
this.playerId = playerId;
setPlayerIdIsSet(true);
return this;
}
public void unsetPlayerId() {
__isset_bit_vector.clear(__PLAYERID_ISSET_ID);
}
/** Returns true if field playerId is set (has been assigned a value) and false otherwise */
public boolean isSetPlayerId() {
return __isset_bit_vector.get(__PLAYERID_ISSET_ID);
}
public void setPlayerIdIsSet(boolean value) {
__isset_bit_vector.set(__PLAYERID_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case MAP_WIDTH:
if (value == null) {
unsetMapWidth();
} else {
setMapWidth((Byte)value);
}
break;
case MAP_HEIGHT:
if (value == null) {
unsetMapHeight();
} else {
setMapHeight((Byte)value);
}
break;
case TILES:
if (value == null) {
unsetTiles();
} else {
setTiles((List<Tile>)value);
}
break;
case STARTING_POSITIONS:
if (value == null) {
unsetStartingPositions();
} else {
setStartingPositions((List<Coordinate>)value);
}
break;
case TICKS_TOTAL:
if (value == null) {
unsetTicksTotal();
} else {
setTicksTotal((Integer)value);
}
break;
case TICKS_PER_SECOND:
if (value == null) {
unsetTicksPerSecond();
} else {
setTicksPerSecond((Integer)value);
}
break;
case GAME_ID:
if (value == null) {
unsetGameId();
} else {
setGameId((Integer)value);
}
break;
case PLAYER_ID:
if (value == null) {
unsetPlayerId();
} else {
setPlayerId((Integer)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case MAP_WIDTH:
return Byte.valueOf(getMapWidth());
case MAP_HEIGHT:
return Byte.valueOf(getMapHeight());
case TILES:
return getTiles();
case STARTING_POSITIONS:
return getStartingPositions();
case TICKS_TOTAL:
return Integer.valueOf(getTicksTotal());
case TICKS_PER_SECOND:
return Integer.valueOf(getTicksPerSecond());
case GAME_ID:
return Integer.valueOf(getGameId());
case PLAYER_ID:
return Integer.valueOf(getPlayerId());
}
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 MAP_WIDTH:
return isSetMapWidth();
case MAP_HEIGHT:
return isSetMapHeight();
case TILES:
return isSetTiles();
case STARTING_POSITIONS:
return isSetStartingPositions();
case TICKS_TOTAL:
return isSetTicksTotal();
case TICKS_PER_SECOND:
return isSetTicksPerSecond();
case GAME_ID:
return isSetGameId();
case PLAYER_ID:
return isSetPlayerId();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof GameInfo)
return this.equals((GameInfo)that);
return false;
}
public boolean equals(GameInfo that) {
if (that == null)
return false;
boolean this_present_mapWidth = true;
boolean that_present_mapWidth = true;
if (this_present_mapWidth || that_present_mapWidth) {
if (!(this_present_mapWidth && that_present_mapWidth))
return false;
if (this.mapWidth != that.mapWidth)
return false;
}
boolean this_present_mapHeight = true;
boolean that_present_mapHeight = true;
if (this_present_mapHeight || that_present_mapHeight) {
if (!(this_present_mapHeight && that_present_mapHeight))
return false;
if (this.mapHeight != that.mapHeight)
return false;
}
boolean this_present_tiles = true && this.isSetTiles();
boolean that_present_tiles = true && that.isSetTiles();
if (this_present_tiles || that_present_tiles) {
if (!(this_present_tiles && that_present_tiles))
return false;
if (!this.tiles.equals(that.tiles))
return false;
}
boolean this_present_startingPositions = true && this.isSetStartingPositions();
boolean that_present_startingPositions = true && that.isSetStartingPositions();
if (this_present_startingPositions || that_present_startingPositions) {
if (!(this_present_startingPositions && that_present_startingPositions))
return false;
if (!this.startingPositions.equals(that.startingPositions))
return false;
}
boolean this_present_ticksTotal = true;
boolean that_present_ticksTotal = true;
if (this_present_ticksTotal || that_present_ticksTotal) {
if (!(this_present_ticksTotal && that_present_ticksTotal))
return false;
if (this.ticksTotal != that.ticksTotal)
return false;
}
boolean this_present_ticksPerSecond = true;
boolean that_present_ticksPerSecond = true;
if (this_present_ticksPerSecond || that_present_ticksPerSecond) {
if (!(this_present_ticksPerSecond && that_present_ticksPerSecond))
return false;
if (this.ticksPerSecond != that.ticksPerSecond)
return false;
}
boolean this_present_gameId = true;
boolean that_present_gameId = true;
if (this_present_gameId || that_present_gameId) {
if (!(this_present_gameId && that_present_gameId))
return false;
if (this.gameId != that.gameId)
return false;
}
boolean this_present_playerId = true;
boolean that_present_playerId = true;
if (this_present_playerId || that_present_playerId) {
if (!(this_present_playerId && that_present_playerId))
return false;
if (this.playerId != that.playerId)
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(GameInfo other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
GameInfo typedOther = (GameInfo)other;
lastComparison = Boolean.valueOf(isSetMapWidth()).compareTo(typedOther.isSetMapWidth());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetMapWidth()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.mapWidth, typedOther.mapWidth);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetMapHeight()).compareTo(typedOther.isSetMapHeight());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetMapHeight()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.mapHeight, typedOther.mapHeight);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetTiles()).compareTo(typedOther.isSetTiles());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetTiles()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tiles, typedOther.tiles);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetStartingPositions()).compareTo(typedOther.isSetStartingPositions());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetStartingPositions()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.startingPositions, typedOther.startingPositions);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetTicksTotal()).compareTo(typedOther.isSetTicksTotal());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetTicksTotal()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ticksTotal, typedOther.ticksTotal);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetTicksPerSecond()).compareTo(typedOther.isSetTicksPerSecond());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetTicksPerSecond()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ticksPerSecond, typedOther.ticksPerSecond);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetGameId()).compareTo(typedOther.isSetGameId());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetGameId()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gameId, typedOther.gameId);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetPlayerId()).compareTo(typedOther.isSetPlayerId());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetPlayerId()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.playerId, typedOther.playerId);
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("GameInfo(");
boolean first = true;
sb.append("mapWidth:");
sb.append(this.mapWidth);
first = false;
if (!first) sb.append(", ");
sb.append("mapHeight:");
sb.append(this.mapHeight);
first = false;
if (!first) sb.append(", ");
sb.append("tiles:");
if (this.tiles == null) {
sb.append("null");
} else {
sb.append(this.tiles);
}
first = false;
if (!first) sb.append(", ");
sb.append("startingPositions:");
if (this.startingPositions == null) {
sb.append("null");
} else {
sb.append(this.startingPositions);
}
first = false;
if (!first) sb.append(", ");
sb.append("ticksTotal:");
sb.append(this.ticksTotal);
first = false;
if (!first) sb.append(", ");
sb.append("ticksPerSecond:");
sb.append(this.ticksPerSecond);
first = false;
if (!first) sb.append(", ");
sb.append("gameId:");
sb.append(this.gameId);
first = false;
if (!first) sb.append(", ");
sb.append("playerId:");
sb.append(this.playerId);
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 GameInfoStandardSchemeFactory implements SchemeFactory {
public GameInfoStandardScheme getScheme() {
return new GameInfoStandardScheme();
}
}
private static class GameInfoStandardScheme extends StandardScheme<GameInfo> {
public void read(org.apache.thrift.protocol.TProtocol iprot, GameInfo 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: // MAP_WIDTH
if (schemeField.type == org.apache.thrift.protocol.TType.BYTE) {
struct.mapWidth = iprot.readByte();
struct.setMapWidthIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // MAP_HEIGHT
if (schemeField.type == org.apache.thrift.protocol.TType.BYTE) {
struct.mapHeight = iprot.readByte();
struct.setMapHeightIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // TILES
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list32 = iprot.readListBegin();
struct.tiles = new ArrayList<Tile>(_list32.size);
for (int _i33 = 0; _i33 < _list32.size; ++_i33)
{
Tile _elem34; // required
_elem34 = Tile.findByValue(iprot.readI32());
struct.tiles.add(_elem34);
}
iprot.readListEnd();
}
struct.setTilesIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 4: // STARTING_POSITIONS
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list35 = iprot.readListBegin();
struct.startingPositions = new ArrayList<Coordinate>(_list35.size);
for (int _i36 = 0; _i36 < _list35.size; ++_i36)
{
Coordinate _elem37; // required
_elem37 = new Coordinate();
_elem37.read(iprot);
struct.startingPositions.add(_elem37);
}
iprot.readListEnd();
}
struct.setStartingPositionsIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 5: // TICKS_TOTAL
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.ticksTotal = iprot.readI32();
struct.setTicksTotalIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 6: // TICKS_PER_SECOND
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.ticksPerSecond = iprot.readI32();
struct.setTicksPerSecondIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 7: // GAME_ID
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.gameId = iprot.readI32();
struct.setGameIdIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 8: // PLAYER_ID
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.playerId = iprot.readI32();
struct.setPlayerIdIsSet(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, GameInfo struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
oprot.writeFieldBegin(MAP_WIDTH_FIELD_DESC);
oprot.writeByte(struct.mapWidth);
oprot.writeFieldEnd();
oprot.writeFieldBegin(MAP_HEIGHT_FIELD_DESC);
oprot.writeByte(struct.mapHeight);
oprot.writeFieldEnd();
if (struct.tiles != null) {
oprot.writeFieldBegin(TILES_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I32, struct.tiles.size()));
for (Tile _iter38 : struct.tiles)
{
oprot.writeI32(_iter38.getValue());
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
if (struct.startingPositions != null) {
oprot.writeFieldBegin(STARTING_POSITIONS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.startingPositions.size()));
for (Coordinate _iter39 : struct.startingPositions)
{
_iter39.write(oprot);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(TICKS_TOTAL_FIELD_DESC);
oprot.writeI32(struct.ticksTotal);
oprot.writeFieldEnd();
oprot.writeFieldBegin(TICKS_PER_SECOND_FIELD_DESC);
oprot.writeI32(struct.ticksPerSecond);
oprot.writeFieldEnd();
oprot.writeFieldBegin(GAME_ID_FIELD_DESC);
oprot.writeI32(struct.gameId);
oprot.writeFieldEnd();
oprot.writeFieldBegin(PLAYER_ID_FIELD_DESC);
oprot.writeI32(struct.playerId);
oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class GameInfoTupleSchemeFactory implements SchemeFactory {
public GameInfoTupleScheme getScheme() {
return new GameInfoTupleScheme();
}
}
private static class GameInfoTupleScheme extends TupleScheme<GameInfo> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, GameInfo struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetMapWidth()) {
optionals.set(0);
}
if (struct.isSetMapHeight()) {
optionals.set(1);
}
if (struct.isSetTiles()) {
optionals.set(2);
}
if (struct.isSetStartingPositions()) {
optionals.set(3);
}
if (struct.isSetTicksTotal()) {
optionals.set(4);
}
if (struct.isSetTicksPerSecond()) {
optionals.set(5);
}
if (struct.isSetGameId()) {
optionals.set(6);
}
if (struct.isSetPlayerId()) {
optionals.set(7);
}
oprot.writeBitSet(optionals, 8);
if (struct.isSetMapWidth()) {
oprot.writeByte(struct.mapWidth);
}
if (struct.isSetMapHeight()) {
oprot.writeByte(struct.mapHeight);
}
if (struct.isSetTiles()) {
{
oprot.writeI32(struct.tiles.size());
for (Tile _iter40 : struct.tiles)
{
oprot.writeI32(_iter40.getValue());
}
}
}
if (struct.isSetStartingPositions()) {
{
oprot.writeI32(struct.startingPositions.size());
for (Coordinate _iter41 : struct.startingPositions)
{
_iter41.write(oprot);
}
}
}
if (struct.isSetTicksTotal()) {
oprot.writeI32(struct.ticksTotal);
}
if (struct.isSetTicksPerSecond()) {
oprot.writeI32(struct.ticksPerSecond);
}
if (struct.isSetGameId()) {
oprot.writeI32(struct.gameId);
}
if (struct.isSetPlayerId()) {
oprot.writeI32(struct.playerId);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, GameInfo struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(8);
if (incoming.get(0)) {
struct.mapWidth = iprot.readByte();
struct.setMapWidthIsSet(true);
}
if (incoming.get(1)) {
struct.mapHeight = iprot.readByte();
struct.setMapHeightIsSet(true);
}
if (incoming.get(2)) {
{
org.apache.thrift.protocol.TList _list42 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I32, iprot.readI32());
struct.tiles = new ArrayList<Tile>(_list42.size);
for (int _i43 = 0; _i43 < _list42.size; ++_i43)
{
Tile _elem44; // required
_elem44 = Tile.findByValue(iprot.readI32());
struct.tiles.add(_elem44);
}
}
struct.setTilesIsSet(true);
}
if (incoming.get(3)) {
{
org.apache.thrift.protocol.TList _list45 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
struct.startingPositions = new ArrayList<Coordinate>(_list45.size);
for (int _i46 = 0; _i46 < _list45.size; ++_i46)
{
Coordinate _elem47; // required
_elem47 = new Coordinate();
_elem47.read(iprot);
struct.startingPositions.add(_elem47);
}
}
struct.setStartingPositionsIsSet(true);
}
if (incoming.get(4)) {
struct.ticksTotal = iprot.readI32();
struct.setTicksTotalIsSet(true);
}
if (incoming.get(5)) {
struct.ticksPerSecond = iprot.readI32();
struct.setTicksPerSecondIsSet(true);
}
if (incoming.get(6)) {
struct.gameId = iprot.readI32();
struct.setGameIdIsSet(true);
}
if (incoming.get(7)) {
struct.playerId = iprot.readI32();
struct.setPlayerIdIsSet(true);
}
}
}
}