| Modifier and Type | Class and Description |
|---|---|
class |
ComplexHistory.CommandNode
Represents a node in the history tree
|
History.Listener| Constructor and Description |
|---|
ComplexHistory() |
ComplexHistory(int capacity) |
ComplexHistory(int capacity,
boolean gcOnInsert) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addAndExecute(Command command)
Appends the given command after the last executed one and execute it.
|
void |
addListener(History.Listener listener)
Appends a new listener to this history.
|
boolean |
contains(Command command)
Returns
true if this list contains the specified element. |
boolean |
executeNext()
Executes the next (most recently rolled back) command.
|
void |
gc()
Runs a clean on this history.
|
Command |
getNext()
Returns the next (most recently rolled back) command.
|
Command |
getPrevious()
Returns the previous (most recently executed) command.
|
ComplexHistory.CommandNode |
getPreviousCommandNode()
Returns node of the most recently executed command.
|
ComplexHistory.CommandNode |
getRootCommandNode()
Returns the absolute root node of this history.
|
boolean |
hasNext()
Returns
true if there is a next (most recently rolled back) command. |
boolean |
hasPrevious()
Returns
true if there is a previous (most recently executed) command. |
boolean |
isEmpty()
Returns
true if this history contains no commands. |
java.util.Iterator<Command> |
iterator()
Returns an iterator which iterates through the last executed path's commands.
|
boolean |
moveAfter(Command command)
Moves the internal pointer after the given command.
|
boolean |
moveBefore(Command command)
Moves the internal pointer before the given command.
|
boolean |
removeListener(History.Listener listener)
Removes a listener from this history.
|
boolean |
rollBackPrevious()
Rolls back the previous (most recently executed) command.
|
void |
setCapacity(int capacity)
Changes the capacity of this history.
|
void |
setCapacity(int capacity,
boolean forceGc)
Changes the capacity of this history.
|
void |
setGcOnInsert(boolean gcOnInsert)
Changes the value of
gcOnInsert. |
public ComplexHistory()
public ComplexHistory(int capacity)
capacity - maximum number of commands in this historypublic ComplexHistory(int capacity,
boolean gcOnInsert)
capacity - maximum number of commands in this historygcOnInsert - if true then a clean will be run after every insertpublic java.util.Iterator<Command> iterator()
Historypublic ComplexHistory.CommandNode getRootCommandNode()
public ComplexHistory.CommandNode getPreviousCommandNode()
public boolean isEmpty()
Historytrue if this history contains no commands.public boolean contains(Command command)
Historytrue if this list contains the specified element.public boolean addAndExecute(Command command)
HistoryaddAndExecute in interface Historytrue if the command successfully executed and insertedpublic boolean hasNext()
Historytrue if there is a next (most recently rolled back) command.public Command getNext()
Historypublic boolean executeNext()
HistoryexecuteNext in interface Historytrue if a next command is successfully executedpublic boolean hasPrevious()
Historytrue if there is a previous (most recently executed) command.hasPrevious in interface Historytrue if there is a previous commandpublic Command getPrevious()
HistorygetPrevious in interface Historypublic boolean rollBackPrevious()
HistoryrollBackPrevious in interface Historytrue if a previous command is successfully rolled backpublic boolean moveBefore(Command command)
HistorymoveBefore in interface Historytrue if the command found and pointer successfully movedpublic boolean moveAfter(Command command)
Historypublic void addListener(History.Listener listener)
HistoryaddListener in interface Historylistener - the new listenerpublic boolean removeListener(History.Listener listener)
HistoryremoveListener in interface Historytrue if the listener found and removedpublic void setCapacity(int capacity)
gcOnInsert was set to true,
then a clean will be run immediately.capacity - public void setCapacity(int capacity,
boolean forceGc)
forceGc is true,
then a clean will be run immediately regardless of
the set value of gcOnInsert.capacity - the new capacityforceGc - if true then a clean can be run immediatelypublic void setGcOnInsert(boolean gcOnInsert)
gcOnInsert.
If gcOnInsert is true, then overall size of this history
will be keeping strictly under capacity.gcOnInsert - new value of gcOnInsertpublic void gc()