Class FixedSizeChangeQueue<C>

  • All Implemented Interfaces:
    ChangeQueue<C>

    public class FixedSizeChangeQueue<C>
    extends java.lang.Object
    implements ChangeQueue<C>
    • Field Detail

      • 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 Detail

      • FixedSizeChangeQueue

        public FixedSizeChangeQueue​(int capacity)
    • Method Detail

      • 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>
      • push

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

        private long fetchRevisionForPosition​(int position)
      • arrayIndex

        private int arrayIndex​(int queuePosition)
      • relativize

        private int relativize​(int arrayPos)