Class BlockOptimizedHistory
java.lang.Object
com.sk89q.worldedit.history.changeset.ArrayListHistory
com.sk89q.worldedit.history.changeset.BlockOptimizedHistory
- All Implemented Interfaces:
ChangeSet
An extension of
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add the given change to the history.Get a backward directed iterator that can be used for undo.Get a forward directed iterator that can be used for redo.int
size()
Get the number of stored changes.Methods inherited from class com.sk89q.worldedit.history.changeset.ArrayListHistory
isRecordingChanges, setRecordChanges
-
Constructor Details
-
BlockOptimizedHistory
public BlockOptimizedHistory()
-
-
Method Details
-
add
Description copied from interface:ChangeSet
Add the given change to the history.- Specified by:
add
in interfaceChangeSet
- Overrides:
add
in classArrayListHistory
- Parameters:
change
- the change
-
forwardIterator
Description copied from interface:ChangeSet
Get a forward directed iterator that can be used for redo.The iterator may return the changes out of order, as long as the final result after all changes have been applied is correct.
- Specified by:
forwardIterator
in interfaceChangeSet
- Overrides:
forwardIterator
in classArrayListHistory
- Returns:
- a forward directed iterator
-
backwardIterator
Description copied from interface:ChangeSet
Get a backward directed iterator that can be used for undo.The iterator may return the changes out of order, as long as the final result after all changes have been applied is correct.
- Specified by:
backwardIterator
in interfaceChangeSet
- Overrides:
backwardIterator
in classArrayListHistory
- Returns:
- a undo directed iterator
-
size
public int size()Description copied from interface:ChangeSet
Get the number of stored changes.- Specified by:
size
in interfaceChangeSet
- Overrides:
size
in classArrayListHistory
- Returns:
- the change count
-