Class ArrayListHistory

java.lang.Object
com.sk89q.worldedit.history.changeset.ArrayListHistory
All Implemented Interfaces:
ChangeSet
Direct Known Subclasses:
BlockOptimizedHistory

public class ArrayListHistory extends Object implements ChangeSet
Stores all Changes in an ArrayList.
  • Constructor Details

    • ArrayListHistory

      public ArrayListHistory()
  • Method Details

    • add

      public void add(Change change)
      Description copied from interface: ChangeSet
      Add the given change to the history.
      Specified by:
      add in interface ChangeSet
      Parameters:
      change - the change
    • isRecordingChanges

      public boolean isRecordingChanges()
      Description copied from interface: ChangeSet
      Whether or not the ChangeSet is recording changes.
      Specified by:
      isRecordingChanges in interface ChangeSet
      Returns:
      whether or not the ChangeSet is set to record changes
    • setRecordChanges

      public void setRecordChanges(boolean recordChanges)
      Description copied from interface: ChangeSet
      Tell the change set whether to record changes or not.
      Specified by:
      setRecordChanges in interface ChangeSet
      Parameters:
      recordChanges - whether to record changes or not
    • backwardIterator

      public Iterator<Change> 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 interface ChangeSet
      Returns:
      a undo directed iterator
    • forwardIterator

      public Iterator<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 interface ChangeSet
      Returns:
      a forward directed iterator
    • size

      public int size()
      Description copied from interface: ChangeSet
      Get the number of stored changes.
      Specified by:
      size in interface ChangeSet
      Returns:
      the change count