|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.freecol.server.control.ServerModelController
public class ServerModelController
A server-side implementation of the ModelController interface.
| Nested Class Summary | |
|---|---|
private static class |
ServerModelController.TaskEntry
A single entry in the task register. |
| Field Summary | |
|---|---|
private FreeColServer |
freeColServer
|
private static java.util.logging.Logger |
logger
|
private java.util.HashMap<java.lang.String,ServerModelController.TaskEntry> |
taskRegister
|
| Constructor Summary | |
|---|---|
ServerModelController(FreeColServer freeColServer)
Creates a new ServerModelController. |
|
| Method Summary | |
|---|---|
void |
clearTaskRegister()
Removes any entries older than ServerModelController.TaskEntry.TASK_ENTRY_TIME_OUT. |
Building |
createBuilding(java.lang.String taskID,
Colony colony,
BuildingType type)
Creates a new building. |
Building |
createBuilding(java.lang.String taskID,
Colony colony,
BuildingType type,
boolean secure,
Connection connection)
Creates a new building. |
Unit |
createUnit(java.lang.String taskID,
Location location,
Player owner,
UnitType type)
Creates a new unit. |
Unit |
createUnit(java.lang.String taskID,
Location location,
Player owner,
UnitType type,
boolean secure,
Connection connection)
Creates a new unit. |
void |
exploreTiles(Player player,
java.util.ArrayList<Tile> tiles)
Explores the given tiles for the given player. |
TradeRoute |
getNewTradeRoute(Player player)
Returns a new TradeRoute object. |
int |
getRandom(java.lang.String taskID,
int n)
Returns a pseudo-random int, uniformly distributed between 0 (inclusive) and the specified value (exclusive). |
void |
propertyChange(java.beans.PropertyChangeEvent e)
|
void |
setStance(Player first,
Player second,
Player.Stance stance)
Updates stances. |
Location |
setToVacantEntryLocation(Unit unit)
Puts the specified Unit in America. |
void |
tileImprovementFinished(Unit unit,
TileImprovement improvement)
Tells the ModelController that a tile improvement was finished |
void |
update(Tile tile)
Sends an update of the given Tile to all the players. |
void |
update(Tile newTile,
Player p)
Sends an update of the given Tile to the other players. |
void |
update(Unit unit,
Player p)
Sends an update of the unit to the other players. |
void |
updateModelListening()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final java.util.logging.Logger logger
private final FreeColServer freeColServer
private final java.util.HashMap<java.lang.String,ServerModelController.TaskEntry> taskRegister
| Constructor Detail |
|---|
public ServerModelController(FreeColServer freeColServer)
ServerModelController.
freeColServer - The main controller.| Method Detail |
|---|
public int getRandom(java.lang.String taskID,
int n)
getRandom in interface ModelControllertaskID - The taskID should be a unique identifier.
One method to make a unique taskID: n - The specified value.
public void clearTaskRegister()
ServerModelController.TaskEntry.TASK_ENTRY_TIME_OUT.
public Unit createUnit(java.lang.String taskID,
Location location,
Player owner,
UnitType type)
createUnit(String, Location, Player, UnitType, boolean, Connection)
with secure = true and connection = null.
createUnit in interface ModelControllertaskID - The taskID should be a unique identifier.
One method to make a unique taskID: location - The Location where the Unit
will be created.owner - The Player owning the Unit.type - The type of unit (Unit.FREE_COLONIST...).
Unit which has been created.
public Unit createUnit(java.lang.String taskID,
Location location,
Player owner,
UnitType type,
boolean secure,
Connection connection)
taskID - The taskID should be a unique identifier.
One method to make a unique taskID: location - The Location where the Unit
will be created.owner - The Player owning the Unit.type - The type of unit (Unit.FREE_COLONIST...).secure - This variable should be set to false in case
this method is called when serving a client. Setting this
variable to false signals that the request
might be illegal.connection - The connection that has requested to create the unit,
or null if this request is internal to the server.
Unit which has been created.
public Building createBuilding(java.lang.String taskID,
Colony colony,
BuildingType type)
createBuilding(String, Colony, BuildingType, boolean, Connection)
with secure = true and connection = null.
createBuilding in interface ModelControllertaskID - The taskID should be a unique identifier.
One method to make a unique taskID: colony - The Colony where the Building
will be created.type - The type of building.
Building which has been created.
public Building createBuilding(java.lang.String taskID,
Colony colony,
BuildingType type,
boolean secure,
Connection connection)
taskID - The taskID should be a unique identifier.
One method to make a unique taskID: colony - The Colony where the Building
will be created.type - The type of building.secure - This variable should be set to false in case
this method is called when serving a client. Setting this
variable to false signals that the request
might be illegal.connection - The connection that has requested to create the building,
or null if this request is internal to the server.
Building which has been created.public Location setToVacantEntryLocation(Unit unit)
Unit in America.
setToVacantEntryLocation in interface ModelControllerunit - The Unit.
Location where the Unit
appears.public void update(Tile tile)
Tile to all the players.
tile - The Tile to be updated.
public void tileImprovementFinished(Unit unit,
TileImprovement improvement)
ModelController that a tile improvement was finished
tileImprovementFinished in interface ModelControllerunit - an Unit valueimprovement - a TileImprovement value
public void exploreTiles(Player player,
java.util.ArrayList<Tile> tiles)
exploreTiles in interface ModelControllerplayer - The Player that should see more tiles.tiles - The tiles to explore.
public void setStance(Player first,
Player second,
Player.Stance stance)
setStance in interface ModelControllerfirst - The first Player.second - The second Player.stance - The new stance.
public void update(Tile newTile,
Player p)
Tile to the other players.
newTile - The Tile to be updated.p - The player which should not receive an update (the source of the
change).
public void update(Unit unit,
Player p)
unit - The Unit to be updated.p - The player which should not receive an update (the source of the
change).public TradeRoute getNewTradeRoute(Player player)
TradeRoute object.
getNewTradeRoute in interface ModelControllerTradeRoute object.public void updateModelListening()
public void propertyChange(java.beans.PropertyChangeEvent e)
propertyChange in interface java.beans.PropertyChangeListener
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||