|
||||||||||
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.
Constructor Summary | |
---|---|
ServerModelController(FreeColServer freeColServer)
Creates a new ServerModelController . |
Method Summary | |
---|---|
void |
clearTaskRegister()
Removes any entries older than 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 |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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 ModelController
taskID
- The taskID
should be a unique identifier.
One method to make a unique taskID
: n
- The specified value.
public void clearTaskRegister()
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 ModelController
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...).
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 ModelController
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.
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 ModelController
unit
- 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 ModelController
unit
- an Unit
valueimprovement
- a TileImprovement
valuepublic void exploreTiles(Player player, java.util.ArrayList<Tile> tiles)
exploreTiles
in interface ModelController
player
- 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 ModelController
first
- 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 ModelController
TradeRoute
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 |