Class TunableDouble
java.lang.Object
org.wpilib.tunable.TunableBase
org.wpilib.tunable.TunableDouble
- All Implemented Interfaces:
DoubleConsumer, DoubleSupplier
A tunable double.
-
Field Summary
Fields inherited from class TunableBase
m_changed -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTunableDouble(TunableConfig config) Constructs a tunable double.protectedTunableDouble(TunableConfig config, boolean supportsChangeNotification) Constructs a tunable double. -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(double value) static TunableDoublecreate()Creates a tunable double with the initial value of 0.0.static TunableDoublecreate(double initialValue) Creates a tunable double with the given initial value.static TunableDoublecreate(DoubleSupplier getter, DoubleConsumer setter) Creates a tunable double with the given getter and setter.static TunableDoublecreateConfig(double initialValue, TunableConfig config) Creates a tunable double with the given initial value and config.static TunableDoublecreateConfig(DoubleSupplier getter, DoubleConsumer setter, TunableConfig config) Creates a tunable double with the given getter, setter, and config.static TunableDoublecreateConfig(TunableConfig config) Creates a tunable double with the given config and an initial value of 0.0.abstract doubleget()Gets the value.doubleabstract voidset(double value) Sets the value.Methods inherited from class TunableBase
getConfig, getProperties, hasChanged, isRobust, markChanged, resetChanged, supportsChangeNotificationMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface DoubleConsumer
andThen
-
Constructor Details
-
TunableDouble
Constructs a tunable double.- Parameters:
config- tunable config
-
TunableDouble
Constructs a tunable double.- Parameters:
config- tunable configsupportsChangeNotification- whether the tunable notifies backends when it changes
-
-
Method Details
-
create
Creates a tunable double with the initial value of 0.0.- Returns:
- a tunable double
-
create
Creates a tunable double with the given initial value.- Parameters:
initialValue- initial value- Returns:
- a tunable double
-
create
Creates a tunable double with the given getter and setter.The getter and setter must not throw.
- Parameters:
getter- getter for the tunable valuesetter- setter for the tunable value- Returns:
- a tunable double
-
createConfig
Creates a tunable double with the given config and an initial value of 0.0.- Parameters:
config- tunable config- Returns:
- a tunable double
-
createConfig
Creates a tunable double with the given initial value and config.- Parameters:
initialValue- initial valueconfig- 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 valuesetter- setter for the tunable valueconfig- 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:
getAsDoublein interfaceDoubleSupplier
-
accept
public void accept(double value) - Specified by:
acceptin interfaceDoubleConsumer
-