Public methods
Method new()
create the history object
Usage
historyStack$new(items = NULL, limit = 25, verbose = TRUE)
Arguments
items
list, initial history step items to store on start
limit
int, how many history steps can be stored in the stack,
default 25 steps
verbose
bool, print some verbose message?
Method clear()
clear all history steps in the stack
Usage
historyStack$clear()
Method get()
retrieve the history from a certain position in the stack
Usage
historyStack$get(pos = private$pos)
Arguments
pos
int, which position to get the history from, default is current
step.
Method getPos()
get current step position in the history stack
Usage
historyStack$getPos()
Method status()
print out some status of the stack
Usage
historyStack$status()
Returns
returns a list of pos
: current position (int); len
: current
length of the history stack (int); limit
: history stack storing limit (int);
first
: is current step position the first of the stack (bool);
last
: is current step position the last of the stack (bool)
Method forward()
move one step forward in the history stack and return item
in that position
Usage
historyStack$forward()
Method backward()
move one step backward in the history stack and return item
in that position
Usage
historyStack$backward()
Method add()
Add an item to the history and move one step forward
Usage
historyStack$add(item)
Arguments
item
any object you want to add to the stack. Everything store
in the item will be moved into a list, so even if item may be something
length > 1, it will still be treated as a single item and single history
step.
Details
If current position is not the last position, and when a new
step item is added to the stack, all history records (items) after current
position will be removed before adding the new history item.
Method clone()
The objects of this class are cloneable with this method.
Usage
historyStack$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.