Interface ChangeSet
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Implementing Classes:
AbstractChangeSet
,AbstractDelegateChangeSet
,ArrayListHistory
,BlockBagChangeSet
,BlockOptimizedHistory
,DiskStorageHistory
,FaweStreamChangeSet
,MemoryOptimizedHistory
,NullChangeSet
,ResizableClipboardBuilder
,RollbackOptimizedHistory
Tracks a set of undoable operations and allows their undo and redo. The
entirety of a change set should be undone and redone at once.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add the given change to the history.Get a backward directed iterator that can be used for undo.default void
close()
Close the changeset.default void
delete()
Delete the changeset (e.g.Get a forward directed iterator that can be used for redo.default boolean
isEmpty()
Get if the changeset is empty (i.e.boolean
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.default ChangeSetSummary
Get a summary of this changeset.
-
Method Details
-
add
Add the given change to the history.- Parameters:
change
- the change
-
isRecordingChanges
boolean isRecordingChanges()Whether or not the ChangeSet is recording changes.- Returns:
- whether or not the ChangeSet is set to record changes
-
setRecordChanges
void setRecordChanges(boolean recordChanges) Tell the change set whether to record changes or not.- Parameters:
recordChanges
- whether to record changes or not
-
backwardIterator
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.
- Returns:
- a undo directed iterator
-
forwardIterator
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.
- Returns:
- a forward directed iterator
-
size
int size()Get the number of stored changes.- Returns:
- the change count
-
close
Close the changeset.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
delete
default void delete()Delete the changeset (e.g. files on disk, or in a database) -
summarize
Get a summary of this changeset. -
isEmpty
default boolean isEmpty()Get if the changeset is empty (i.e. size == 0)- Returns:
- is empty
-