public class ArrayListHistory extends java.lang.Object implements ChangeSet
Change
s in an ArrayList
.Constructor and Description |
---|
ArrayListHistory() |
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.
|
boolean |
isRecordingChanges()
Whether or not the ChangeSet is recording changes.
|
void |
setRecordChanges(boolean recordChanges)
Tell the change set whether to record changes or not.
|
int |
size()
Get the number of stored changes.
|
public void add(Change change)
ChangeSet
public boolean isRecordingChanges()
ChangeSet
isRecordingChanges
in interface ChangeSet
public void setRecordChanges(boolean recordChanges)
ChangeSet
setRecordChanges
in interface ChangeSet
recordChanges
- whether to record changes or notpublic 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
public 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