rails.game.move
Class MoveStack

java.lang.Object
  extended by rails.game.move.MoveStack

public class MoveStack
extends java.lang.Object

This class represent one game's complete "move stack", which is a list of MoveSets. Each MoveSet contains the (low-level) changes caused by one particular player action.

The only purpose of the move stack is to enable Undo and Redo.

Author:
Erik Vos

Field Summary
protected static org.apache.log4j.Logger log
           
 
Constructor Summary
MoveStack()
           
 
Method Summary
 boolean addMove(Move move)
           
 boolean cancel()
           
 void enable()
          Start making moves undoable.
 boolean finish()
           
 int getCurrentIndex()
          the current index is the one of either the open moveset or if none is open of the latest added
 int getIndex()
           
 boolean gotoIndex(int index)
          undo/redo to a given moveStack index
 boolean isOpen()
           
 boolean isRedoable()
           
 boolean isUndoableByManager()
           
 boolean isUndoableByPlayer()
           
 void linkToPreviousMoveSet()
           
 boolean redoMoveSet()
           
 int size()
           
 MoveSet start(boolean undoableByPlayer)
           
 boolean undoMoveSet(boolean forced)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.log4j.Logger log
Constructor Detail

MoveStack

public MoveStack()
Method Detail

enable

public void enable()
Start making moves undoable. Will be called once, after all initialisations are complete.


start

public MoveSet start(boolean undoableByPlayer)

finish

public boolean finish()

cancel

public boolean cancel()

addMove

public boolean addMove(Move move)

linkToPreviousMoveSet

public void linkToPreviousMoveSet()

undoMoveSet

public boolean undoMoveSet(boolean forced)

redoMoveSet

public boolean redoMoveSet()

isUndoableByPlayer

public boolean isUndoableByPlayer()

isRedoable

public boolean isRedoable()

isUndoableByManager

public boolean isUndoableByManager()

isOpen

public boolean isOpen()

getIndex

public int getIndex()

getCurrentIndex

public int getCurrentIndex()
the current index is the one of either the open moveset or if none is open of the latest added


size

public int size()

gotoIndex

public boolean gotoIndex(int index)
undo/redo to a given moveStack index