|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.vizzini.game.action.AbstractAction
public abstract class AbstractAction
Provides base functionality for actions in the game framework. An 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.
Constructor Summary | |
---|---|
AbstractAction()
Construct this object. |
Method Summary | |
---|---|
void |
clear()
Clear the properties of this object. |
int |
compareTo(Object object)
Compare this to the given 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. |
String |
toString()
Return a string representation of this object. |
boolean |
undoIt()
Undo the last invocation of doIt. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AbstractAction()
Method Detail |
---|
public void clear()
clear
in interface IAction
public int compareTo(Object object)
compareTo
in interface Comparable
ClassCastException
- if another is not an instance of
AbstractAction
.public boolean doIt()
doIt
in interface IAction
public boolean equals(Object object)
equals
in interface IAction
equals
in class Object
object
- The object to compare.public IAgent getAgent()
getAgent
in interface IAction
public int getRating()
getRating
in interface IAction
public int hashCode()
hashCode
in interface IAction
hashCode
in class Object
public String prettyPrint()
prettyPrint
in interface IAction
public void release()
release
in interface IAction
public void setAgent(IAgent agent)
setAgent
in interface IAction
agent
- The agent who originated this action.public void setRating(int rating)
setRating
in interface IAction
public String toString()
toString
in class Object
public boolean undoIt()
undoIt
in interface IAction
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2007 Vizzini.org. All Rights Reserved. | 2007.12.25.03.00.02 |