While

open class While

Perform non-blocking loops using an evaluator callback to run the loop. This should be paired with an update(), activeLoop() or onInitLoop(), and this runs synchronously with the main loop.


  public void activeLoop() {
      whileLoop.run();
      // Your other active loop code
      // You can choose to block the entire loop until the while loop is done by using a guard clause
      // as the run method will return a boolean indicating if the loop was run.
  }

Author

Lucas Bubner, 2023

Since

1.0.0-pre

See also

Constructors

Link copied to clipboard
constructor(condition: BooleanSupplier, runThis: Runnable, callback: Runnable, timeout: Measure<Time>)

Functions

Link copied to clipboard
open fun engage()
Notify the loop that it should run.
Link copied to clipboard
open fun run(): Boolean
Run the evaluator loop if required.
Link copied to clipboard
open fun running(): Boolean
Get the last status of the evaluator without running it.
Link copied to clipboard
open fun setTimeout(timeout: Measure<Time>)
Set a new timeout for the loop dynamically.
Link copied to clipboard
open fun terminate()
Notify the loop that it should stop now.