game.protocol
Class AllReply

java.lang.Object
  extended by game.protocol.Reply
      extended by game.protocol.AllReply

public class AllReply
extends Reply

Normal reply from simulator to "all?" request. Gives pretty much the whole game state.

Invariant: mType == ALL


Nested Class Summary
 
Nested classes/interfaces inherited from class game.protocol.Reply
Reply.ReplyType
 
Field Summary
 
Fields inherited from class game.protocol.Reply
log, mServerLog, mType
 
Constructor Summary
AllReply(ISimulatorView sim)
          A bit different in that this constructor will extract the required info from the given sim.
AllReply(java.lang.String msg)
          Parse a normal reply
 
Method Summary
 CartesianVect getBallPosition()
           
 PolarVect getBallVelocity()
           
 CartesianVect getPlayerPosition(Side t, int p)
           
 PolarVect getPlayerVelocity(Side t, int p)
           
 int getTime()
           
 boolean isPlayerInGame(Side t, int p)
           
 java.lang.String toString()
           
 
Methods inherited from class game.protocol.Reply
factory, getType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AllReply

public AllReply(java.lang.String msg)
         throws ParseException
Parse a normal reply

Parameters:
msg - the message text
Throws:
ParseException - ill formatted message

AllReply

public AllReply(ISimulatorView sim)
A bit different in that this constructor will extract the required info from the given sim.

Parameters:
sim - model to draw data from.
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getTime

public int getTime()
Returns:
time in milliseconds from message

getBallPosition

public CartesianVect getBallPosition()
Returns:
Ball's current position in meters

getBallVelocity

public PolarVect getBallVelocity()
Returns:
Ball's current velocity in polar coordinates

getPlayerPosition

public CartesianVect getPlayerPosition(Side t,
                                       int p)
Parameters:
t - Team
p - Player number in {0, 1, 2, 3, 4}
Returns:
Player's current position in meters

getPlayerVelocity

public PolarVect getPlayerVelocity(Side t,
                                   int p)
Parameters:
t - Team
p - Player number in {0, 1, 2, 3, 4}
Returns:
Player's current velocity in polar coordinates

isPlayerInGame

public boolean isPlayerInGame(Side t,
                              int p)
Parameters:
t - Team
p - Player number in {0, 1, 2, 3, 4}
Returns:
False if player is red-carded and true otherwise