public class Translate
extends java.lang.Object
Constructor and Description |
---|
Translate() |
Modifier and Type | Method and Description |
---|---|
Bank |
fromNetBank(NetBank netBank)
Translates NetBank into Bank
|
ChatBox |
fromNetChat(NetChat netChat,
java.util.List<NetPlayer> players)
Translates NetChat into ChatBox
|
GameModel |
fromNetGameModel(NetGameModel netGameModel)
Main function -- this translates a netGameModel (from server) into a GameModel (for model)
All of the other functions in this class are sub-functions of this main function
|
GameActionLog |
fromNetLog(NetLog netLog,
java.util.List<NetPlayer> players)
Translates NetLog into GameActionLog
|
MapModel |
fromNetMap(NetMap netMap,
java.util.List<NetPlayer> players)
Translates a NetMap into a MapModel
|
Player |
fromNetPlayer(NetPlayer netPlayer)
Translates NetPlayer into Player
|
java.util.List<Player> |
fromNetPlayers(java.util.List<NetPlayer> netPlayers)
Translates list of NetPlayer into list of Player
|
GameState |
fromNetTurnTracker(NetTurnTracker netTurnTracker)
Translates NetTurnTracker into GameState
|
VictoryPointManager |
fromNetVPManager(NetTurnTracker netTurnTracker,
java.util.List<NetPlayer> netPlayers)
Translates NetTurnTracker into VictoryPointManager
|
private CatanColor |
GetColorFromOwnerInt(int owner,
java.util.List<NetPlayer> players)
Helper function for fromNetMap function
|
private java.util.List<Coordinate> |
GetEdgeCoordinates(Coordinate hex,
Direction direction)
Helper function for fromNetMap function
|
private static EdgeDirection |
GetEdgeDirection(Coordinate hex,
Coordinate p1,
Coordinate p2) |
static EdgeLocation |
GetEdgeLocation(Coordinate p1,
Coordinate p2) |
private static Coordinate |
GetHexCoordinate(int x,
int y)
Helper function for fromNetMap function
|
static HexLocation |
GetHexLocation(Coordinate point) |
private static HexLocation |
GetHexLocation(Coordinate p1,
Coordinate p2) |
private PortType |
GetPortType(int ratio,
ResourceType type)
Helper function for fromNetMap function
|
private Coordinate |
GetVertexCoordinate(Coordinate hex,
Direction direction)
Helper function for fromNetMap function
|
static VertexLocation |
GetVertexLocation(Coordinate point) |
private void |
SetCities(MapModel model,
java.util.List<NetCity> cities,
java.util.List<NetPlayer> players)
Helper function for fromNetMap function
|
private void |
SetHexes(MapModel model,
java.util.List<NetHex> hexes)
Helper function for fromNetMap function
|
private void |
SetPorts(MapModel model,
java.util.List<NetPort> ports)
Helper function for fromNetMap function
|
private void |
SetRoads(MapModel model,
java.util.List<NetRoad> roads,
java.util.List<NetPlayer> players)
Helper function for fromNetMap function
|
private void |
SetRobber(MapModel model,
NetHexLocation robberLocation)
Helper function for fromNetMap function
|
private void |
SetSettlements(MapModel model,
java.util.List<NetSettlement> settlements,
java.util.List<NetPlayer> players)
Helper function for fromNetMap function
|
public GameModel fromNetGameModel(NetGameModel netGameModel)
netGameModel
- public GameState fromNetTurnTracker(NetTurnTracker netTurnTracker)
netTurnTracker
- public Bank fromNetBank(NetBank netBank)
netBank
- public java.util.List<Player> fromNetPlayers(java.util.List<NetPlayer> netPlayers)
netPlayers
- public Player fromNetPlayer(NetPlayer netPlayer)
netPlayer
- public VictoryPointManager fromNetVPManager(NetTurnTracker netTurnTracker, java.util.List<NetPlayer> netPlayers)
netTurnTracker
- netPlayers
- public ChatBox fromNetChat(NetChat netChat, java.util.List<NetPlayer> players)
netChat
- public GameActionLog fromNetLog(NetLog netLog, java.util.List<NetPlayer> players)
netLog
- public MapModel fromNetMap(NetMap netMap, java.util.List<NetPlayer> players)
netMap
- the map returned by the serverplayers
- the list of players returned by the serverprivate void SetHexes(MapModel model, java.util.List<NetHex> hexes)
model
- hexes
- private void SetSettlements(MapModel model, java.util.List<NetSettlement> settlements, java.util.List<NetPlayer> players)
model
- settlements
- players
- private void SetCities(MapModel model, java.util.List<NetCity> cities, java.util.List<NetPlayer> players)
model
- cities
- players
- private void SetRoads(MapModel model, java.util.List<NetRoad> roads, java.util.List<NetPlayer> players)
model
- roads
- players
- private void SetPorts(MapModel model, java.util.List<NetPort> ports)
model
- ports
- private void SetRobber(MapModel model, NetHexLocation robberLocation)
model
- robberLocation
- private static Coordinate GetHexCoordinate(int x, int y)
x
- y
- private CatanColor GetColorFromOwnerInt(int owner, java.util.List<NetPlayer> players)
owner
- players
- private Coordinate GetVertexCoordinate(Coordinate hex, Direction direction)
hex
- direction
- private java.util.List<Coordinate> GetEdgeCoordinates(Coordinate hex, Direction direction)
hex
- direction
- private PortType GetPortType(int ratio, ResourceType type)
ratio
- type
- public static EdgeLocation GetEdgeLocation(Coordinate p1, Coordinate p2)
public static VertexLocation GetVertexLocation(Coordinate point)
public static HexLocation GetHexLocation(Coordinate point)
private static HexLocation GetHexLocation(Coordinate p1, Coordinate p2)
private static EdgeDirection GetEdgeDirection(Coordinate hex, Coordinate p1, Coordinate p2)