Interface ChangeSet

All Superinterfaces:
AutoCloseable, Closeable
All Known Implementing Classes:
AbstractChangeSet, AbstractDelegateChangeSet, ArrayListHistory, BlockBagChangeSet, BlockOptimizedHistory, DiskStorageHistory, FaweStreamChangeSet, MemoryOptimizedHistory, NullChangeSet, ResizableClipboardBuilder, RollbackOptimizedHistory

public interface ChangeSet extends Closeable
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 Type
    Method
    Description
    void
    add(Change change)
    Add the given change to the history.
    Get a backward directed iterator that can be used for undo.
    default void
    Close the changeset.
    default void
    Delete the changeset (e.g.
    Get a forward directed iterator that can be used for redo.
    default boolean
    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
    Get the number of stored changes.
    summarize(Region region, boolean shallow)
    Get a summary of this changeset.
  • Method Details

    • add

      void add(Change change)
      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

      Iterator<Change> 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

      Iterator<Change> 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

      default void close() throws IOException
      Close the changeset.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • delete

      default void delete()
      Delete the changeset (e.g. files on disk, or in a database)
    • summarize

      @Nullable default ChangeSetSummary summarize(Region region, boolean shallow)
      Get a summary of this changeset.
    • isEmpty

      default boolean isEmpty()
      Get if the changeset is empty (i.e. size == 0)
      Returns:
      is empty