Class TunableFloat
java.lang.Object
org.wpilib.tunable.TunableBase
org.wpilib.tunable.TunableFloat
- All Implemented Interfaces:
FloatConsumer, FloatSupplier
A tunable float.
-
Field Summary
Fields inherited from class TunableBase
m_changed -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTunableFloat(TunableConfig config) Constructs a tunable float.protectedTunableFloat(TunableConfig config, boolean supportsChangeNotification) Constructs a tunable float. -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(float value) Performs this operation on the given argument.static TunableFloatcreate()Creates a tunable float with the initial value of 0.0.static TunableFloatcreate(float initialValue) Creates a tunable float with the given initial value.static TunableFloatcreate(FloatSupplier getter, FloatConsumer setter) Creates a tunable float with the given getter and setter.static TunableFloatcreateConfig(float initialValue, TunableConfig config) Creates a tunable float with the given initial value and config.static TunableFloatcreateConfig(TunableConfig config) Creates a tunable float with the given config and an initial value of 0.0.static TunableFloatcreateConfig(FloatSupplier getter, FloatConsumer setter, TunableConfig config) Creates a tunable float with the given getter, setter, and config.abstract floatget()Gets the value.floatGets a result.abstract voidset(float value) Sets the value.Methods inherited from class TunableBase
getConfig, getProperties, hasChanged, isRobust, markChanged, resetChanged, supportsChangeNotification
-
Constructor Details
-
TunableFloat
Constructs a tunable float.- Parameters:
config- tunable config
-
TunableFloat
Constructs a tunable float.- Parameters:
config- tunable configsupportsChangeNotification- whether the tunable notifies backends when it changes
-
-
Method Details
-
create
Creates a tunable float with the initial value of 0.0.- Returns:
- a tunable float
-
create
Creates a tunable float with the given initial value.- Parameters:
initialValue- initial value- Returns:
- a tunable float
-
create
Creates a tunable float 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 float
-
createConfig
Creates a tunable float with the given config and an initial value of 0.0.- Parameters:
config- tunable config- Returns:
- a tunable float
-
createConfig
Creates a tunable float with the given initial value and config.- Parameters:
initialValue- initial valueconfig- tunable config- Returns:
- a tunable float
-
createConfig
public static TunableFloat createConfig(FloatSupplier getter, FloatConsumer setter, TunableConfig config) Creates a tunable float 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 float
-
set
public abstract void set(float value) Sets the value.Implementations must not throw.
- Parameters:
value- value
-
get
public abstract float get()Gets the value.Implementations must not throw.
- Returns:
- value
-
getAsFloat
public float getAsFloat()Description copied from interface:FloatSupplierGets a result.- Specified by:
getAsFloatin interfaceFloatSupplier- Returns:
- a result
-
accept
public void accept(float value) Description copied from interface:FloatConsumerPerforms this operation on the given argument.- Specified by:
acceptin interfaceFloatConsumer- Parameters:
value- the input argument
-