Class DeltaQueue


  • public class DeltaQueue
    extends Object
    Delta queue. Follows a standard approach from OS world for effeciently keeping tracks of scheduled events.
    • Constructor Detail

      • DeltaQueue

        public DeltaQueue()
        Constructs a new empty non-blocking synchronized delta queue.
    • Method Detail

      • queue

        public void queue​(DeltaQueue.Deltable deltable)
        Queues the specified deltable. The specified deltable is placed somewhere in the queue based on the initial value of its delta. Note that when this method returns, the value of a DeltaQueue.Deltable.getDelta() may have changed. Do not reuse or change the passed deltable after this method returns.
        Parameters:
        deltable - Deltable.
      • dequeue

        public List<DeltaQueue.Deltable> dequeue​(int delay)
        Returns all deltables that have at most specified delay left. The returned list may be empty.
        Parameters:
        delay - Delay.
        Returns:
        The possibly empty list of all deltables that have at most specified delay left.
      • removeMatching

        public void removeMatching​(DeltaQueue.DeltaMatcher matcher)
        Removes all deltas matching the specified matcher.
        Parameters:
        matcher - Delta matcher.
      • dump

        public void dump()
        Dumps the contents of the delta queue.
      • main

        public static void main​(String[] args)
        For testing.
        Parameters:
        args - Ignored.