simulator.model
Interface ISimulatorNet

All Superinterfaces:
ISimulatorView
All Known Implementing Classes:
SMfacade

public interface ISimulatorNet
extends ISimulatorView

The interface of a simulator as seen by the network layer

Version:
1.0
Author:
pouria

Field Summary
 
Fields inherited from interface simulator.model.ISimulatorView
BALL_RADIUS, FIELD_LENGTH, FIELD_WIDTH, GOAL_WIDTH, NUMBER_OF_PLAYERS, PLAYER_RADIUS
 
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.
 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 setTeams(Student west, Student east)
          Indicates which team is on each side.
 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 interface simulator.model.ISimulatorView
getBallPosition, getBallVelocity, getFieldName, getISimulatorNet, getPlayerPosition, getPlayerVelocity, getStatusMessage, getTeamName, getTeamScore, getTime, isGameInProgress, isPlayerInGame, setTestMode
 

Method Detail

setTeams

void setTeams(Student west,
              Student east)
Indicates which team is on each side.

Parameters:
west - team on WEST side.
east - team on EAST side.

startGame

void startGame()
Indicates that game should start (time == 0).

Precondidtion: setTeams and setNet have been called and isGameInProgress() is false.
Postcondition: isGameInProgress()


endGame

void endGame()
Indicates game should end due to a request from one or more teams. Note that the protocol says that this should only occur due to abnormal situations.

Precondition: true
Postcondition: !isGameInProgress()


setNet

void setNet(INetSimulator n)
Set the network layer. To be used to call goalScored(), gameReset() and gameOver() when these events occur.

Parameters:
n -

spin

void spin(Side side,
          int p,
          double av)
Sets angular velocity for the player

Precondition: isGameInProgress()

Parameters:
p - Player number in {0, 1, 2, 3, 4}
av - double Angular velocity in degrees per second. -90 <= av <= 90

accelerate

void accelerate(Side side,
                int p,
                double a)
Sets the acceleration for the player

Precondition: isGameInProgress()

Parameters:
p - Player number, in {0, 1, 2, 3, 4}
a - rate of acceleration, -5 <= a <= 1

kick

void kick(Side side,
          int p,
          double v,
          double alpha)
Updates field data in response to a kick request

Precondition: isGameInProgress()

Parameters:
side - the team side
p - Player number, in {0, 1, 2, 3, 4}
v - Change in the ball's velocity. 0 <= v <= 10
alpha - Offset in degrees from a line connecting the player's centre to the ball's centre. -45 <= alpha <= 45

placePlayer

void placePlayer(Side side,
                 int p,
                 CartesianVect l)
places player at given coordinates

Precondition: game is in test mode

Parameters:
side - Player team
p - Player number. In {0, 1, 2, 3, 4}
l - new location for player

placeBall

void placeBall(CartesianVect l)
placeBall places ball at given coordinates

Precondition: game is in test mode

Parameters:
l - location to place the ball

setTime

void setTime(int t)
setTime sets game time

Precondition: game is in test mode

Parameters:
t - int Game time is set to t (in miliseconds)