Class TunableBoolean

java.lang.Object
org.wpilib.tunable.TunableBase
org.wpilib.tunable.TunableBoolean
All Implemented Interfaces:
BooleanSupplier, BooleanConsumer

public abstract class TunableBoolean extends TunableBase implements BooleanSupplier, BooleanConsumer
A tunable boolean.
  • Constructor Details

    • TunableBoolean

      protected TunableBoolean(TunableConfig config)
      Constructs a tunable boolean.
      Parameters:
      config - tunable config
    • TunableBoolean

      protected TunableBoolean(TunableConfig config, boolean supportsChangeNotification)
      Constructs a tunable boolean.
      Parameters:
      config - tunable config
      supportsChangeNotification - whether the tunable notifies backends when it changes
  • Method Details

    • create

      public static TunableBoolean create()
      Creates a tunable boolean with the initial value of false.
      Returns:
      a tunable boolean
    • create

      public static TunableBoolean create(boolean initialValue)
      Creates a tunable boolean with the given initial value.
      Parameters:
      initialValue - initial value
      Returns:
      a tunable boolean
    • create

      public static TunableBoolean create(BooleanSupplier getter, BooleanConsumer setter)
      Creates a tunable boolean with the given getter and setter.

      The getter and setter must not throw.

      Parameters:
      getter - getter for the tunable value
      setter - setter for the tunable value
      Returns:
      a tunable boolean
    • createConfig

      public static TunableBoolean createConfig(TunableConfig config)
      Creates a tunable boolean with the given config and an initial value of false.
      Parameters:
      config - tunable config
      Returns:
      a tunable boolean
    • createConfig

      public static TunableBoolean createConfig(boolean initialValue, TunableConfig config)
      Creates a tunable boolean with the given initial value and config.
      Parameters:
      initialValue - initial value
      config - tunable config
      Returns:
      a tunable boolean
    • createConfig

      public static TunableBoolean createConfig(BooleanSupplier getter, BooleanConsumer setter, TunableConfig config)
      Creates a tunable boolean with the given getter, setter, and config.

      The getter and setter must not throw.

      Parameters:
      getter - getter for the tunable value
      setter - setter for the tunable value
      config - tunable config
      Returns:
      a tunable boolean
    • set

      public abstract void set(boolean value)
      Sets the value.

      Implementations must not throw.

      Parameters:
      value - value
    • get

      public abstract boolean get()
      Gets the value.

      Implementations must not throw.

      Returns:
      value
    • getAsBoolean

      public boolean getAsBoolean()
      Specified by:
      getAsBoolean in interface BooleanSupplier
    • accept

      public void accept(boolean value)
      Description copied from interface: BooleanConsumer
      Performs this operation on the given argument.
      Specified by:
      accept in interface BooleanConsumer
      Parameters:
      value - the input argument