org.vizzini.game.action
Class ActionManager

java.lang.Object
  extended by org.vizzini.game.action.ActionManager

public class ActionManager
extends Object

Provides a manager for game actions. Instances of this class are responsible for managing the execution of actions, and maintaining an action history for undo and redo.

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

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

Constructor Summary
ActionManager()
           
 
Method Summary
protected  void addToHistory(IAction action)
          Add an action to the action history.
protected  IStack createStack()
          Return a new IStack object.
protected  IAction getHistoryAction(int index)
          Return the history action at the given index.
protected  int getHistorySize()
          Return the number of items in the history list.
protected  int getRedoSize()
          Return the number of items in the redo list.
 void invokeAction(IAction action)
          Invoke an action and add it to the history.
 boolean isHistoryEmpty()
          Return true if the history list is empty.
 boolean isRedoEmpty()
          Return true if the redo list is empty.
protected  void redo()
          Redo the previous action, if any.
protected  void undo()
          Undo the previous action, if any.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActionManager

public ActionManager()
Method Detail

invokeAction

public void invokeAction(IAction action)
Invoke an action and add it to the history.

Since:
v0.2

isHistoryEmpty

public boolean isHistoryEmpty()
Return true if the history list is empty.

Since:
v0.2

isRedoEmpty

public boolean isRedoEmpty()
Return true if the redo list is empty.

Since:
v0.2

addToHistory

protected void addToHistory(IAction action)
Add an action to the action history.

Since:
v0.2

createStack

protected IStack createStack()
Return a new IStack object.

Since:
v0.3

getHistoryAction

protected IAction getHistoryAction(int index)
Return the history action at the given index.

Since:
v0.2

getHistorySize

protected int getHistorySize()
Return the number of items in the history list.

Since:
v0.2

getRedoSize

protected int getRedoSize()
Return the number of items in the redo list.

Since:
v0.2

redo

protected void redo()
Redo the previous action, if any.

Since:
v0.2

undo

protected void undo()
Undo the previous action, if any.

Since:
v0.2


Copyright 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02