rcssjava.comm
Class TrainerCommandHandler

java.lang.Object
  extended by rcssjava.comm.CoachCommandHandler
      extended by rcssjava.comm.TrainerCommandHandler

public class TrainerCommandHandler
extends CoachCommandHandler

Handles contruction of outgoing commands to the server for offline trainers. This class contains all of the commands that a trainer can send but a coach cannot. A trainer always uses the left team's coordinate system.

See Also:
CoachCommandHandler

Field Summary
 
Fields inherited from class rcssjava.comm.CoachCommandHandler
C, WS
 
Constructor Summary
TrainerCommandHandler(Connection c)
          Constructs a command handler with a null world state
TrainerCommandHandler(Connection c, WorldState ws)
          Constructs a command handler with the given world state
 
Method Summary
 void changeMode(int playMode)
          Change the current play mode
 void changePlayerType(int id, int playerType)
          Change the heterogenous player type of a given player.
 void checkBall()
          Request message from server to determine what part of the field the ball is in.
 void ear(boolean mode)
          Turn "hear" messages on or off
 void init(double version)
          Send init message to server without specifying a team.
 void move(int id, VecPosition pos)
          Move object to a given position with zero velocity
 void move(int id, VecPosition pos, double vDir)
          Move object to a given position and set the direction in which it's facing.
 void move(int id, VecPosition pos, double vDir, VecPosition vel)
          Move object to a given position, set its velocity and set the direction in which it's facing.
 void move(int id, VecPosition pos, VecPosition vel)
          Move object to a given position and set its velocity
 void recover()
          Restore players' stamina
 void start()
          Send start message to server
 
Methods inherited from class rcssjava.comm.CoachCommandHandler
done, eye, init, say, setWorldState, teamNames
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrainerCommandHandler

public TrainerCommandHandler(Connection c)
Constructs a command handler with a null world state

Parameters:
c - connection
See Also:
CoachCommandHandler.setWorldState(WorldState)

TrainerCommandHandler

public TrainerCommandHandler(Connection c,
                             WorldState ws)
Constructs a command handler with the given world state

Parameters:
c - connection
ws - world state to connect to this parser
Method Detail

changeMode

public void changeMode(int playMode)
Change the current play mode

Parameters:
playMode - play mode to change to

move

public void move(int id,
                 VecPosition pos)
Move object to a given position with zero velocity

Parameters:
id - object ID
pos - new position

move

public void move(int id,
                 VecPosition pos,
                 VecPosition vel)
Move object to a given position and set its velocity

Parameters:
id - object ID
pos - new position
vel - new velocity

move

public void move(int id,
                 VecPosition pos,
                 double vDir)
Move object to a given position and set the direction in which it's facing. Used only for players.

Parameters:
id - object ID
pos - new position
vDir - new angle in degrees

move

public void move(int id,
                 VecPosition pos,
                 double vDir,
                 VecPosition vel)
Move object to a given position, set its velocity and set the direction in which it's facing. Used only for players.

Parameters:
id - object ID
pos - new position
vDir - new angle in degrees
vel - new velocity

checkBall

public void checkBall()
Request message from server to determine what part of the field the ball is in.


start

public void start()
Send start message to server


recover

public void recover()
Restore players' stamina


ear

public void ear(boolean mode)
Turn "hear" messages on or off

Parameters:
mode - set to true to turn "hear" messages on

init

public void init(double version)
Send init message to server without specifying a team. The trainer must use this version of "init".

Parameters:
version - protocol version number supported

changePlayerType

public void changePlayerType(int id,
                             int playerType)
Change the heterogenous player type of a given player.

Overrides:
changePlayerType in class CoachCommandHandler
Parameters:
id - player ID of player to change
playerType - new heterogenous type for player