Class FixedSizeChangeQueue<C>

java.lang.Object
org.fxmisc.undo.impl.FixedSizeChangeQueue<C>
All Implemented Interfaces:
ChangeQueue<C>

public class FixedSizeChangeQueue<C> extends Object implements ChangeQueue<C>
  • Field Details

    • changes

      private final RevisionedChange<C>[] changes
    • capacity

      private final int capacity
    • start

      private int start
    • size

      private int size
    • currentPosition

      private int currentPosition
    • revision

      private long revision
    • zeroPositionRevision

      private long zeroPositionRevision
  • Constructor Details

    • FixedSizeChangeQueue

      public FixedSizeChangeQueue(int capacity)
  • Method Details

    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface ChangeQueue<C>
    • hasPrev

      public boolean hasPrev()
      Specified by:
      hasPrev in interface ChangeQueue<C>
    • peekNext

      public C peekNext()
      Description copied from interface: ChangeQueue
      Returns the next item. Current position stays unchanged.
      Specified by:
      peekNext in interface ChangeQueue<C>
    • next

      public C next()
      Description copied from interface: ChangeQueue
      Returns the next item and increases the current position by 1.
      Specified by:
      next in interface ChangeQueue<C>
    • peekPrev

      public C peekPrev()
      Description copied from interface: ChangeQueue
      Returns the previous item. Current position stays unchanged.
      Specified by:
      peekPrev in interface ChangeQueue<C>
    • prev

      public C prev()
      Description copied from interface: ChangeQueue
      Returns the previous item and decreases the current position by 1.
      Specified by:
      prev in interface ChangeQueue<C>
    • forgetHistory

      public void forgetHistory()
      Specified by:
      forgetHistory in interface ChangeQueue<C>
    • push

      @SafeVarargs public final void push(C... changes)
      Specified by:
      push in interface ChangeQueue<C>
    • getCurrentPosition

      public ChangeQueue.QueuePosition getCurrentPosition()
      Specified by:
      getCurrentPosition in interface ChangeQueue<C>
    • fetchRevisionForPosition

      private long fetchRevisionForPosition(int position)
    • fetch

      private RevisionedChange<C> fetch(int position)
    • put

      private RevisionedChange<C> put(int position, RevisionedChange<C> c)
    • arrayIndex

      private int arrayIndex(int queuePosition)
    • relativize

      private int relativize(int arrayPos)