simulator.model
Interface ISimulatorView

All Known Subinterfaces:
ISimulatorNet
All Known Implementing Classes:
SMfacade

public interface ISimulatorView

An interface used to represent the game state to the simulator view object(s).

An acceptable simulator model implementation must contain a class called SMfacade that

  1. implements this interface and
  2. has a no-argument constructor public SMfacade().

Version:
5.0

Field Summary
static double BALL_RADIUS
          The radius of the ball in metres.
static double FIELD_LENGTH
          The length (x-axis) of the field in metres.
static double FIELD_WIDTH
          The width (y-axis) of the field in metres.
static double GOAL_WIDTH
          The width of the goal.
static int NUMBER_OF_PLAYERS
          The number of players per team
static double PLAYER_RADIUS
          The radius of each player in metres.
 
Method Summary
 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 setTestMode(boolean m)
          Set the model into 'test mode' or not.
 

Field Detail

FIELD_LENGTH

static final double FIELD_LENGTH
The length (x-axis) of the field in metres.

See Also:
Constant Field Values

FIELD_WIDTH

static final double FIELD_WIDTH
The width (y-axis) of the field in metres.

See Also:
Constant Field Values

NUMBER_OF_PLAYERS

static final int NUMBER_OF_PLAYERS
The number of players per team

See Also:
Constant Field Values

GOAL_WIDTH

static final double GOAL_WIDTH
The width of the goal. The goals are centred at either end of the field

See Also:
Constant Field Values

BALL_RADIUS

static final double BALL_RADIUS
The radius of the ball in metres.

See Also:
Constant Field Values

PLAYER_RADIUS

static final double PLAYER_RADIUS
The radius of each player in metres.

See Also:
Constant Field Values
Method Detail

getISimulatorNet

ISimulatorNet getISimulatorNet()
Get the object that implements the ISimulatorNet interface. This isn't needed by the view so strictly it should be somewhere else. It is needed by simulator.MainUI to set up the game.

Returns:
an object that is instanceof ISimulatorNet

setTestMode

void setTestMode(boolean m)
Set the model into 'test mode' or not.

Parameters:
m - true to set the model in test mode, false for normal play mode

getFieldName

Student getFieldName()
Which simulator is the host.


getStatusMessage

java.lang.String getStatusMessage()
The last status message. This could be any string at all.


isGameInProgress

boolean isGameInProgress()
Returns:
true if the game is in progress, false otherwise.

getTeamName

Student getTeamName(Side t)
The name of each team.

Precondition: isGameInProgress()

Parameters:
t - The team, 0 or 1.

getTeamScore

int getTeamScore(Side t)
The number of goals scored by each team.

Precondition: isGameInProgress()

Parameters:
t - The team, 0 or 1.

getTime

int getTime()
The number of milliseconds played.

Precondition: isGameInProgress()


getPlayerPosition

CartesianVect getPlayerPosition(Side t,
                                int p)
The position of a particular player.

Precondition: isGameInProgress()

Parameters:
t - The team, 0 or 1.
p - The player: 0 less than or equal p, p less than number_of_players()

getPlayerVelocity

PolarVect getPlayerVelocity(Side t,
                            int p)
The orientation of a particular player. The orientation is reported in degrees from the x-axis.

Precondition: isGameInProgress()

Parameters:
t - The team, 0 or 1.
p - The player: 0 less than or equal p, p less than NUMBER_OF_PLAYERS()

isPlayerInGame

boolean isPlayerInGame(Side t,
                       int p)
Is the player in play

Parameters:
t - team side
p - player. 0 less than or equal p, p less than number_of_players()
Returns:
true if the player is in play, false otherwise (i.e., red-carded).

getBallPosition

CartesianVect getBallPosition()
Returns:
The position of the ball.

getBallVelocity

PolarVect getBallVelocity()
Returns:
The velocity of the ball.