|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbr.usp.ime.klava.segmentit.util.UndoRedo<T>
T
- type of the statespublic class UndoRedo<T>
Stores states from which is possible to undo/redo actions.
Constructor Summary | |
---|---|
UndoRedo(int capacity)
Creates a Undo/Redo structure that can store capacity
states. |
Method Summary | |
---|---|
void |
addNewState(T state)
Adds a new state to the structure. |
T |
getCurrentState()
Returns the current state. |
boolean |
isRedoAvailable()
Returns if it is possible to go to a later state. |
boolean |
isUndoAvailable()
Returns if it is possible to go to a previous state. |
static void |
main(java.lang.String[] args)
|
T |
redo()
Returns the state after the current state. |
java.lang.String |
toString()
|
T |
undo()
Returns the state before the current state. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public UndoRedo(int capacity)
capacity
states.
capacity
- the maximum number of states storedMethod Detail |
---|
public boolean isUndoAvailable()
public boolean isRedoAvailable()
public T undo()
null
if there
isn't any previous accessible state.public T redo()
null
if there
isn't any later accessible state.public void addNewState(T state)
state
- the state to be added to the structurepublic T getCurrentState()
null
if there isn't any state
availablepublic java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |