Class TunableDouble

java.lang.Object
org.wpilib.tunable.TunableBase
org.wpilib.tunable.TunableDouble
All Implemented Interfaces:
DoubleConsumer, DoubleSupplier

public abstract class TunableDouble extends TunableBase implements DoubleSupplier, DoubleConsumer
A tunable double.
  • Constructor Details

    • TunableDouble

      protected TunableDouble(TunableConfig config)
      Constructs a tunable double.
      Parameters:
      config - tunable config
    • TunableDouble

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

    • create

      public static TunableDouble create()
      Creates a tunable double with the initial value of 0.0.
      Returns:
      a tunable double
    • create

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

      public static TunableDouble create(DoubleSupplier getter, DoubleConsumer setter)
      Creates a tunable double 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 double
    • createConfig

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

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

      public static TunableDouble createConfig(DoubleSupplier getter, DoubleConsumer setter, TunableConfig config)
      Creates a tunable double 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 double
    • set

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

      Implementations must not throw.

      Parameters:
      value - value
    • get

      public abstract double get()
      Gets the value.

      Implementations must not throw.

      Returns:
      value
    • getAsDouble

      public double getAsDouble()
      Specified by:
      getAsDouble in interface DoubleSupplier
    • accept

      public void accept(double value)
      Specified by:
      accept in interface DoubleConsumer