Class Clock.Bomb

  • All Implemented Interfaces:
    org.polyfrost.polyui.utils.Clock.Executor

    
    public final class Clock.Bomb
     implements Clock.Executor
                        

    An executor that will execute a function after a certain amount of time.

    Since:

    1.5.0

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private final Long timerNanos
      private final Function0<Unit> func
    • Constructor Summary

      Constructors 
      Constructor Description
      Clock.Bomb(Long timerNanos, Function0<Unit> func)
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final Long getTimerNanos()
      final Function0<Unit> getFunc()
      Long tick(Long deltaTimeNanos) Update this Executor.
      final Unit refuse() Re-fuse the bomb, resetting the timer.
      • Methods inherited from class java.lang.Object

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

      • Clock.Bomb

        Clock.Bomb(Long timerNanos, Function0<Unit> func)
    • Method Detail

      • tick

         Long tick(Long deltaTimeNanos)

        Update this Executor.

        Returns:

        the time remaining until the next execution, or a negative number if it no longer needs to be executed and can be removed.

      • refuse

         final Unit refuse()

        Re-fuse the bomb, resetting the timer.