Class Clock.FixedTimeExecutor

    • 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 Integer getCycles() amount of times this has executed.
      Boolean getFinished()
      final Integer getRepeats()
      Long tick(Long deltaTimeNanos) Update this Executor, and execute it if the given amount of time has passed.
      • Methods inherited from class org.polyfrost.polyui.utils.Clock.Executor

        getExecuteEveryNanos
      • Methods inherited from class java.lang.Object

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

      • Clock.FixedTimeExecutor

        Clock.FixedTimeExecutor(Long executeEveryNanos, Integer repeats, Function0<Unit> func)
        Parameters:
        repeats - how many times to repeat before stopping.
      • Clock.FixedTimeExecutor

        Clock.FixedTimeExecutor(Long executeEveryNanos, Function0<Unit> func)
    • Method Detail

      • getCycles

         final Integer getCycles()

        amount of times this has executed. Only incremented when repeats is not 0 (i.e. it does not last forever) to prevent numerical overflow and keep method short.

      • tick

         Long tick(Long deltaTimeNanos)

        Update this Executor, and execute it if the given amount of time has passed.

        Returns:

        the amount of time left until the next execution, or `0L if it no longer needs to be executed (has finished)