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.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DelayedWorkQueue

        DelayedWorkQueue()
    • 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.

      • pop

         final Pair<Function1<T, Unit>, Integer> pop()

        Remove the last element from the queue, if it exists.

      • start

         final Unit start(T cx)

        Start the queue with the given context.

      • next

         final Boolean next(T cx)

        Execute the next handler in the queue, returning whether there are more elements after it.