org.vizzini.game.action
Interface IAction

All Superinterfaces:
Comparable, Serializable
All Known Subinterfaces:
IGridBoardAction, IMoveAction
All Known Implementing Classes:
AbstractAction, AbstractGridBoardAction, AbstractMoveAction, Action, CastleAction, DefaultAction, DiscardAction, DrawAction, EnPassantCaptureAction, MoveAction, MoveCaptureAction, PawnPromotionAction, PawnPromotionCaptureAction, PlaceAction, RedoAction, RemoveAction, TakeDiscardAction, UndoAction

public interface IAction
extends Serializable, Comparable

Defines methods required by actions in the game framework. A action instance encapsulates the information necessary for the environment to process the action. Examples are moving a chess piece, moving a paddle to hit a ball, or playing a card.

This class participates in the Command pattern as described in Patterns In Java Volume 1, Mark Grand, 1998.

Since:
v0.1
Version:
v0.3
Author:
Jeffrey M. Thompson

Method Summary
 void clear()
          Clear the properties of this object.
 boolean doIt()
          Perform the command encapsulated by this object.
 boolean equals(Object object)
          Return true if the given object is equal to this.
 IAgent getAgent()
          Return the agent who originated this action.
 int getRating()
          Return the rating of this action.
 int hashCode()
          Returns a hash code value for the object.
 String prettyPrint()
          Provide a nicely formatted string representation of this object.
 void release()
          Return this instance to the reusable object pool, if one is used.
 void setAgent(IAgent agent)
          Set the agent who originated this action.
 void setRating(int rating)
          Set the rating of this action.
 boolean undoIt()
          Undo the last invocation of doIt.
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

clear

void clear()
Clear the properties of this object.

Since:
v0.3

doIt

boolean doIt()
Perform the command encapsulated by this object.

Returns:
true if successful and can be undone.
Since:
v0.2

equals

boolean equals(Object object)
Return true if the given object is equal to this.

Overrides:
equals in class Object
Parameters:
object - The object to compare.
Since:
v0.2

getAgent

IAgent getAgent()
Return the agent who originated this action.

Since:
v0.1

getRating

int getRating()
Return the rating of this action.

Since:
v0.2

hashCode

int hashCode()
Returns a hash code value for the object.

Overrides:
hashCode in class Object
Since:
v0.2

prettyPrint

String prettyPrint()
Provide a nicely formatted string representation of this object.

Since:
v0.3

release

void release()
Return this instance to the reusable object pool, if one is used.

Since:
v0.3

setAgent

void setAgent(IAgent agent)
Set the agent who originated this action.

Parameters:
agent - The agent who originated this action.
Since:
v0.1

setRating

void setRating(int rating)
Set the rating of this action.

Since:
v0.2

undoIt

boolean undoIt()
Undo the last invocation of doIt.

Returns:
true if the undo was successful.
Since:
v0.2


Copyright 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02