Class DelayedWorkQueue
-
- All Implemented Interfaces:
public class DelayedWorkQueue<T extends Object>
A queue for work that's delayed. No way. This allows you to attach a context to be used in handlers.
-
-
Constructor Summary
Constructors Constructor Description DelayedWorkQueue()
-
Method Summary
Modifier and Type Method Description final List<Pair<Function1<T, Unit>, Integer>>
getQueue()
The queue. final Boolean
add(Integer delay, Function1<T, Unit> handler)
Add work to be done after a delay in ticks. final Pair<Function1<T, Unit>, Integer>
removeFirst()
Remove the first element in the queue, if it exists. final Pair<Function1<T, Unit>, Integer>
pop()
Remove the last element from the queue, if it exists. final Unit
start(T cx)
Start the queue with the given context. final Boolean
next(T cx)
Execute the next handler in the queue, returning whether there are more elements after it. -
-
Method Detail
-
getQueue
final List<Pair<Function1<T, Unit>, Integer>> getQueue()
The queue.
This is a list of pairs of handlers to the number of ticks to wait before executing it.
-
add
final Boolean add(Integer delay, Function1<T, Unit> handler)
Add work to be done after a delay in ticks.
-
removeFirst
final Pair<Function1<T, Unit>, Integer> removeFirst()
Remove the first element in the queue, if it exists.
-
pop
final Pair<Function1<T, Unit>, Integer> pop()
Remove the last element from the queue, if it exists.
-
-
-
-