public class BlockOptimizedHistory extends ArrayListHistory
ArrayListHistory
that stores BlockChange
s
separately in two ArrayList
s.
Whether this is a good idea or not is highly questionable, but this class exists because this is how history was implemented in WorldEdit for many years.
Constructor and Description |
---|
BlockOptimizedHistory() |
Modifier and Type | Method and Description |
---|---|
void |
add(Change change)
Add the given change to the history.
|
java.util.Iterator<Change> |
backwardIterator()
Get a backward directed iterator that can be used for undo.
|
java.util.Iterator<Change> |
forwardIterator()
Get a forward directed iterator that can be used for redo.
|
int |
size()
Get the number of stored changes.
|
isRecordingChanges, setRecordChanges
public void add(Change change)
ChangeSet
add
in interface ChangeSet
add
in class ArrayListHistory
change
- the changepublic java.util.Iterator<Change> forwardIterator()
ChangeSet
The iterator may return the changes out of order, as long as the final result after all changes have been applied is correct.
forwardIterator
in interface ChangeSet
forwardIterator
in class ArrayListHistory
public java.util.Iterator<Change> backwardIterator()
ChangeSet
The iterator may return the changes out of order, as long as the final result after all changes have been applied is correct.
backwardIterator
in interface ChangeSet
backwardIterator
in class ArrayListHistory
public int size()
ChangeSet
size
in interface ChangeSet
size
in class ArrayListHistory