Class OneTimeControl

java.lang.Object
com.pocolifo.robobase.control.OneTimeControl

public class OneTimeControl extends Object
  • Constructor Details

    • OneTimeControl

      public OneTimeControl(BoolSupplier currentState)
      Creates a Toggleable.
      Parameters:
      currentState - A method to get the current state of something (like whether a gamepad button is pressed)
  • Method Details

    • get

      public boolean get()
      Get the current toggled state.
      Returns:
      The toggled state of this OneTimeControl
    • processUpdates

      public OneTimeControl processUpdates()
      Updates this Toggleable. Should be called ONCE as frequent as possible or in the main loop!
      Returns:
      This OneTimeControl instance.
    • onToggleOn

      public OneTimeControl onToggleOn(Runnable runnable)
      Run code when this OneTimeControl is toggled ON.
      Parameters:
      runnable - A Runnable that is executed when this toggleable is toggled ON.
      Returns:
      This OneTimeControl instance.