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.
-
Field Summary
Fields inherited from class TunableBase
m_changed -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTunableBoolean(TunableConfig config) Constructs a tunable boolean.protectedTunableBoolean(TunableConfig config, boolean supportsChangeNotification) Constructs a tunable boolean. -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(boolean value) Performs this operation on the given argument.static TunableBooleancreate()Creates a tunable boolean with the initial value of false.static TunableBooleancreate(boolean initialValue) Creates a tunable boolean with the given initial value.static TunableBooleancreate(BooleanSupplier getter, BooleanConsumer setter) Creates a tunable boolean with the given getter and setter.static TunableBooleancreateConfig(boolean initialValue, TunableConfig config) Creates a tunable boolean with the given initial value and config.static TunableBooleancreateConfig(BooleanSupplier getter, BooleanConsumer setter, TunableConfig config) Creates a tunable boolean with the given getter, setter, and config.static TunableBooleancreateConfig(TunableConfig config) Creates a tunable boolean with the given config and an initial value of false.abstract booleanget()Gets the value.booleanabstract voidset(boolean value) Sets the value.Methods inherited from class TunableBase
getConfig, getProperties, hasChanged, isRobust, markChanged, resetChanged, supportsChangeNotification
-
Constructor Details
-
TunableBoolean
Constructs a tunable boolean.- Parameters:
config- tunable config
-
TunableBoolean
Constructs a tunable boolean.- Parameters:
config- tunable configsupportsChangeNotification- whether the tunable notifies backends when it changes
-
-
Method Details
-
create
Creates a tunable boolean with the initial value of false.- Returns:
- a tunable boolean
-
create
Creates a tunable boolean with the given initial value.- Parameters:
initialValue- initial value- Returns:
- a tunable boolean
-
create
Creates a tunable boolean 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 boolean
-
createConfig
Creates a tunable boolean with the given config and an initial value of false.- Parameters:
config- tunable config- Returns:
- a tunable boolean
-
createConfig
Creates a tunable boolean with the given initial value and config.- Parameters:
initialValue- initial valueconfig- 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 valuesetter- setter for the tunable valueconfig- 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:
getAsBooleanin interfaceBooleanSupplier
-
accept
public void accept(boolean value) Description copied from interface:BooleanConsumerPerforms this operation on the given argument.- Specified by:
acceptin interfaceBooleanConsumer- Parameters:
value- the input argument
-