player
Class Command

java.lang.Object
  |
  +--player.Command
Direct Known Subclasses:
MoveCommand, NoopCommand, PkgCommand

public abstract class Command
extends Object

Abstract class that implements robot commmands to send to the game server.

Version:
$Revision: 1.3 $
Author:
Allen D. Ball

Constructor Summary
protected Command()
          Creates a robot command.
 
Method Summary
abstract  String getArguments()
          Method to get the optional arguments for a command
 int getBid()
          Method to get the bid for this command.
 int getCost()
          Method to get the cost of this command.
abstract  String getName()
          Method to get the name of this command.
 void pkgAdd(Pkg pkg)
          Method to add a package to the command package list.
 void pkgRemove(Pkg pkg)
          Method to remove a package to the command package list.
 void setBid(int bid)
          Method to set the bid for this command.
 void setDirection(int direction)
          Method to set the movement direction of this command.
 String toString()
          Method to return the command as a well formatted string suitable for sending to the game server.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Command

protected Command()
Creates a robot command.
Method Detail

getBid

public final int getBid()
Method to get the bid for this command.
Returns:
The bid for this command.

setBid

public final void setBid(int bid)
Method to set the bid for this command.
Parameters:
bid - The bid for the command.

getCost

public final int getCost()
Method to get the cost of this command. The cost is equal to the absolute value of the bid.
Returns:
The cost of this command.

getName

public abstract String getName()
Method to get the name of this command.
Returns:
The name of this command.

setDirection

public void setDirection(int direction)
Method to set the movement direction of this command. (Method defined in Command is a no-op. Subclasses should override this method.)
Parameters:
direction - The direction of the movement.
See Also:
Direction

pkgAdd

public void pkgAdd(Pkg pkg)
Method to add a package to the command package list. (Method defined in Command is a no-op. Subclasses should override this method.)
Parameters:
pkg - The package to add to the command list.

pkgRemove

public void pkgRemove(Pkg pkg)
Method to remove a package to the command package list. (Method defined in Command is a no-op. Subclasses should override this method.)
Parameters:
pkg - The package to remove from the command list.

getArguments

public abstract String getArguments()
Method to get the optional arguments for a command
Returns:
The optional arguments for this commnd.

toString

public final String toString()
Method to return the command as a well formatted string suitable for sending to the game server.
Overrides:
toString in class Object
Returns:
The command string to send to the server.


Copyright 2002 Allen D. Ball. All rights reserved.