Class BlockOptimizedHistory

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

public class BlockOptimizedHistory extends ArrayListHistory
An extension of ArrayListHistory that stores BlockChanges separately in two ArrayLists.

Whether this is a good idea or not is highly questionable, but this class exists because this is how history was implemented in WorldEdit for many years.

  • Constructor Details

    • BlockOptimizedHistory

      public BlockOptimizedHistory()
  • 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
      Overrides:
      add in class ArrayListHistory
      Parameters:
      change - the change
    • 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
      Overrides:
      forwardIterator in class ArrayListHistory
      Returns:
      a forward directed iterator
    • 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
      Overrides:
      backwardIterator in class ArrayListHistory
      Returns:
      a undo directed iterator
    • size

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