|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectsimulator.model.debug.SMfacade
public class SMfacade
A trivial implementation of the required simulator model interfaces for debugging purposes. In most cases this simply logs the calls to a log file.
| Field Summary |
|---|
| Fields inherited from interface simulator.model.ISimulatorView |
|---|
BALL_RADIUS, FIELD_LENGTH, FIELD_WIDTH, GOAL_WIDTH, NUMBER_OF_PLAYERS, PLAYER_RADIUS |
| Constructor Summary | |
|---|---|
SMfacade()
|
|
| Method Summary | |
|---|---|
void |
accelerate(Side side,
int p,
double a)
Sets the acceleration for the player |
void |
endGame()
Indicates game should end due to a request from one or more teams. |
CartesianVect |
getBallPosition()
|
PolarVect |
getBallVelocity()
|
Student |
getFieldName()
Which simulator is the host. |
ISimulatorNet |
getISimulatorNet()
Get the object that implements the ISimulatorNet interface. |
CartesianVect |
getPlayerPosition(Side t,
int p)
The position of a particular player. |
PolarVect |
getPlayerVelocity(Side t,
int p)
The orientation of a particular player. |
java.lang.String |
getStatusMessage()
The last status message. |
Student |
getTeamName(Side t)
The name of each team. |
int |
getTeamScore(Side t)
The number of goals scored by each team. |
int |
getTime()
The number of milliseconds played. |
boolean |
isGameInProgress()
|
boolean |
isPlayerInGame(Side t,
int p)
Is the player in play |
void |
kick(Side side,
int p,
double v,
double alpha)
Updates field data in response to a kick request |
void |
placeBall(CartesianVect l)
placeBall places ball at given coordinates |
void |
placePlayer(Side side,
int p,
CartesianVect l)
places player at given coordinates |
void |
setNet(INetSimulator n)
Set the network layer. |
void |
setStatusMessage(java.lang.String msg)
|
void |
setTeams(Student west,
Student east)
Indicates which team is on each side. |
void |
setTestMode(boolean m)
Set the model into 'test mode' or not. |
void |
setTime(int t)
setTime sets game time |
void |
spin(Side side,
int p,
double av)
Sets angular velocity for the player |
void |
startGame()
Indicates that game should start (time == 0). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SMfacade()
| Method Detail |
|---|
public void setNet(INetSimulator n)
ISimulatorNet
setNet in interface ISimulatorNetpublic void startGame()
ISimulatorNetPrecondidtion: setTeams and setNet have been called and
isGameInProgress() is false.
Postcondition: isGameInProgress()
startGame in interface ISimulatorNetpublic void endGame()
ISimulatorNetPrecondition: true
Postcondition: !isGameInProgress()
endGame in interface ISimulatorNet
public void accelerate(Side side,
int p,
double a)
ISimulatorNetPrecondition: isGameInProgress()
accelerate in interface ISimulatorNetp - Player number, in {0, 1, 2, 3, 4}a - rate of acceleration, -5 <= a <= 1
public void kick(Side side,
int p,
double v,
double alpha)
ISimulatorNetPrecondition: isGameInProgress()
kick in interface ISimulatorNetside - the team sidep - Player number, in {0, 1, 2, 3, 4}v - Change in the ball's velocity. 0 <= v <= 10alpha - Offset in degrees from a line connecting the player's
centre to the ball's centre. -45 <= alpha <= 45
public void placePlayer(Side side,
int p,
CartesianVect l)
ISimulatorNetPrecondition: game is in test mode
placePlayer in interface ISimulatorNetside - Player teamp - Player number. In {0, 1, 2, 3, 4}l - new location for player
public void setTeams(Student west,
Student east)
ISimulatorNet
setTeams in interface ISimulatorNetwest - team on WEST side.east - team on EAST side.
public void spin(Side side,
int p,
double av)
ISimulatorNetPrecondition: isGameInProgress()
spin in interface ISimulatorNetp - Player number in {0, 1, 2, 3, 4}av - double Angular velocity in degrees per second. -90 <= av <= 90public ISimulatorNet getISimulatorNet()
ISimulatorView
getISimulatorNet in interface ISimulatorViewpublic void setTestMode(boolean m)
ISimulatorView
setTestMode in interface ISimulatorViewm - true to set the model in test mode, false for normal play modepublic Student getFieldName()
ISimulatorView
getFieldName in interface ISimulatorViewpublic java.lang.String getStatusMessage()
ISimulatorView
getStatusMessage in interface ISimulatorViewpublic void setStatusMessage(java.lang.String msg)
public boolean isGameInProgress()
isGameInProgress in interface ISimulatorViewpublic Student getTeamName(Side t)
ISimulatorViewPrecondition: isGameInProgress()
getTeamName in interface ISimulatorViewt - The team, 0 or 1.public int getTeamScore(Side t)
ISimulatorViewPrecondition: isGameInProgress()
getTeamScore in interface ISimulatorViewt - The team, 0 or 1.public int getTime()
ISimulatorViewPrecondition: isGameInProgress()
getTime in interface ISimulatorView
public CartesianVect getPlayerPosition(Side t,
int p)
ISimulatorViewPrecondition: isGameInProgress()
getPlayerPosition in interface ISimulatorViewt - The team, 0 or 1.p - The player: 0 less than or equal p, p less than number_of_players()
public boolean isPlayerInGame(Side t,
int p)
ISimulatorView
isPlayerInGame in interface ISimulatorViewt - team sidep - player. 0 less than or equal p, p less than number_of_players()
public PolarVect getPlayerVelocity(Side t,
int p)
ISimulatorViewPrecondition: isGameInProgress()
getPlayerVelocity in interface ISimulatorViewt - The team, 0 or 1.p - The player: 0 less than or equal p, p less than NUMBER_OF_PLAYERS()public CartesianVect getBallPosition()
getBallPosition in interface ISimulatorViewpublic PolarVect getBallVelocity()
getBallVelocity in interface ISimulatorViewpublic void placeBall(CartesianVect l)
ISimulatorNetPrecondition: game is in test mode
placeBall in interface ISimulatorNetl - location to place the ballpublic void setTime(int t)
ISimulatorNetPrecondition: game is in test mode
setTime in interface ISimulatorNett - int Game time is set to t (in miliseconds)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||