Interface ChangeSet

All Known Implementing Classes:
ArrayListHistory, BlockOptimizedHistory

public interface ChangeSet
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.
    Get a forward directed iterator that can be used for redo.
    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.
  • 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