gecco.client
Class Action

java.lang.Object
  |
  +--gecco.client.Action
All Implemented Interfaces:
Cloneable, Comparable

public class Action
extends Object
implements Cloneable, Comparable

An Action is a thing that a Piece can do. The Action has a name that is presented to the user and a type. The type is a String.

Note that Actions are assumed to be used only with one Piece, that is if two pieces have the same action, they should have two different instances with the same properties, use method clone(). The type indentifies uniquely the type of action and not the instance.

An Action is performed by a Piece and it can be done toward an object. An action therefore has a property called parameter type that represents the type of the thing the actions is perfomed to. The parameter types are void (nothing), position and piece. For information purposes every action can be given a parameter, but no checking that it is of the correct type is done. The parameter is initilized to null.

Every action has instantaneous flag that indicates whether the action is an action that is performed immediately and that has no time span. Other actions are normally put in a queue and executed in order.

Two actions are considered equals if their types are equal.

Author:
Andreas Enblom

Field Summary
static int PIECE
          The parameter type piece.
static int POSITION
          The parameter type position.
static int VOID
          The parameter type void.
 
Constructor Summary
Action(Action a)
          Constructor for the Action object
Action(Action a, Object parameter)
          Constructor for the Action object
Action(String type, String name, int parameterType, boolean instantaneous)
          Constructor for the Action object
Action(String type, String name, int parameterType, boolean instantaneous, Object parameter)
          Constructor for the Action object
 
Method Summary
 Object clone()
          Description of the Method
 int compareTo(Object o)
           
 boolean equals(Object o)
          Description of the Method
 String getName()
          Gets the Name attribute of the Action object
 Object getParameter()
          Gets the Parameter attribute of the Action object
 int getParameterType()
          Gets the ParameterType attribute of the Action object
 String getType()
          Gets the Type attribute of the Action object
 int hashCode()
          Description of the Method
 boolean isInstantaneous()
          Gets the Instantaneous attribute of the Action object
 void setParameter(Object o)
          Sets the Parameter attribute of the Action object
 String toString()
          Description of the Method
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

VOID

public static final int VOID
The parameter type void.

See Also:
Constant Field Values

POSITION

public static final int POSITION
The parameter type position.

See Also:
Constant Field Values

PIECE

public static final int PIECE
The parameter type piece.

See Also:
Constant Field Values
Constructor Detail

Action

public Action(String type,
              String name,
              int parameterType,
              boolean instantaneous)
Constructor for the Action object

Parameters:
type - Description of Parameter
name - Description of Parameter
parameterType - Description of Parameter
instantaneous - Description of Parameter

Action

public Action(String type,
              String name,
              int parameterType,
              boolean instantaneous,
              Object parameter)
Constructor for the Action object

Parameters:
type - Description of Parameter
name - Description of Parameter
parameterType - Description of Parameter
instantaneous - Description of Parameter
parameter - Description of Parameter

Action

public Action(Action a)
Constructor for the Action object

Parameters:
a - Description of Parameter

Action

public Action(Action a,
              Object parameter)
Constructor for the Action object

Parameters:
a - Description of Parameter
parameter - Description of Parameter
Method Detail

setParameter

public void setParameter(Object o)
Sets the Parameter attribute of the Action object

Parameters:
o - The new Parameter value

getType

public String getType()
Gets the Type attribute of the Action object

Returns:
The Type value

getName

public String getName()
Gets the Name attribute of the Action object

Returns:
The Name value

getParameterType

public int getParameterType()
Gets the ParameterType attribute of the Action object

Returns:
The ParameterType value

isInstantaneous

public boolean isInstantaneous()
Gets the Instantaneous attribute of the Action object

Returns:
The Instantaneous value

getParameter

public Object getParameter()
Gets the Parameter attribute of the Action object

Returns:
The Parameter value

clone

public Object clone()
Description of the Method

Overrides:
clone in class Object
Returns:
Description of the Returned Value

equals

public boolean equals(Object o)
Description of the Method

Overrides:
equals in class Object
Parameters:
o - Description of Parameter
Returns:
Description of the Returned Value

hashCode

public int hashCode()
Description of the Method

Overrides:
hashCode in class Object
Returns:
Description of the Returned Value

toString

public String toString()
Description of the Method

Overrides:
toString in class Object
Returns:
Description of the Returned Value

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable