Class DeltaQueue
java.lang.Object
org.pushingpixels.lafwidget.utils.DeltaQueue
Delta queue. Follows a standard approach from OS world for effeciently
keeping tracks of scheduled events.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Base class for entries in aDeltaQueue
.static interface
Interface for comparing two delta instances. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondequeue
(int delay) Returns all deltables that have at most specified delay left.void
dump()
Dumps the contents of the delta queue.static void
For testing.void
queue
(DeltaQueue.Deltable deltable) Queues the specified deltable.void
removeMatching
(DeltaQueue.DeltaMatcher matcher) Removes all deltas matching the specified matcher.
-
Field Details
-
queue
List of entries. ContainsDeltaQueue.Deltable
s.
-
-
Constructor Details
-
DeltaQueue
public DeltaQueue()Constructs a new empty non-blocking synchronized delta queue.
-
-
Method Details
-
queue
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 aDeltaQueue.Deltable.getDelta()
may have changed. Do not reuse or change the passed deltable after this method returns.- Parameters:
deltable
- Deltable.
-
dequeue
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
Removes all deltas matching the specified matcher.- Parameters:
matcher
- Delta matcher.
-
dump
public void dump()Dumps the contents of the delta queue. -
main
For testing.- Parameters:
args
- Ignored.
-