sg.edu.nus.comp.cs3243.pipedream
Class Action

java.lang.Object
  |
  +--sg.edu.nus.comp.cs3243.pipedream.Action

public class Action
extends java.lang.Object

Action is the class that completely specifies what an agent does for a specific turn instance. It encapsulates the action information needed by the pipedream.Driver class to perform the agent's action for a turn.

N.B. the mutator methods in Action don't validate the arguments of the action. Programmers using these methods will have to validate them on their own.

$Log: Action.java,v $ Revision 1.3 2004/01/15 05:29:46 rpnlpir Added RCS tags to file.

Since:
1.0

Constructor Summary
Action()
          Initializes the Action to have a WAIT_ACTION and x and y coordinates set to -1.
Action(char action, int x, int y)
          Constructor that takes all three parameters of an Action as input.
 
Method Summary
 char getAction()
          An accessor method to return an Action's type of action.
 int getX()
          An accessor method to get the x coordinate of the action.
 int getY()
          An accessor method to get the Y coordinate of the action.
 void setAction(char action)
          A mutator method to set the type of action.
 void setX(int x)
          A mutator method to set the X coordinate of the action.
 void setY(int y)
          A mutator method to set the Y coordinate of the action.
 java.lang.String toString()
          A method that creates a printable version of this Action.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Action

public Action()
Initializes the Action to have a WAIT_ACTION and x and y coordinates set to -1.
See Also:
Constants.WAIT_ACTION

Action

public Action(char action,
              int x,
              int y)
Constructor that takes all three parameters of an Action as input.
Parameters:
action - the action type of this object. x the x coordinate for this action. y the y coordinate for this action.
Method Detail

setAction

public void setAction(char action)
A mutator method to set the type of action.
Parameters:
action - a char that specifies the type of action embodied by this object.
See Also:
getAction()

getAction

public char getAction()
An accessor method to return an Action's type of action.
Returns:
a char that specifies the type of action embodied by this object.
See Also:
setAction(char)

setX

public void setX(int x)
A mutator method to set the X coordinate of the action.
Parameters:
x - an int that specifies the x coordination of this action.
See Also:
getX()

getX

public int getX()
An accessor method to get the x coordinate of the action.
Returns:
an int that specifies the x coordination of this action.
See Also:
setX(int)

setY

public void setY(int y)
A mutator method to set the Y coordinate of the action.
Parameters:
y - an int that specifies the y coordination of this action.
See Also:
getY()

getY

public int getY()
An accessor method to get the Y coordinate of the action.
Returns:
an int that specifies the Y coordination of this action.
See Also:
setY(int)

toString

public java.lang.String toString()
A method that creates a printable version of this Action.
Overrides:
toString in class java.lang.Object
Returns:
a human-readable String that unique specifies this Action. It can be printed.