Class TunableInt
java.lang.Object
org.wpilib.tunable.TunableBase
org.wpilib.tunable.TunableInt
- All Implemented Interfaces:
IntConsumer, IntSupplier
A tunable integer.
-
Field Summary
Fields inherited from class TunableBase
m_changed -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTunableInt(TunableConfig config) Constructs a tunable integer.protectedTunableInt(TunableConfig config, boolean supportsChangeNotification) Constructs a tunable integer. -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(int value) static TunableIntcreate()Creates a tunable integer with the initial value of 0.static TunableIntcreate(int initialValue) Creates a tunable integer with the given initial value.static TunableIntcreate(IntSupplier getter, IntConsumer setter) Creates a tunable integer with the given getter and setter.static TunableIntcreateConfig(int initialValue, TunableConfig config) Creates a tunable integer with the given initial value and config.static TunableIntcreateConfig(IntSupplier getter, IntConsumer setter, TunableConfig config) Creates a tunable integer with the given getter, setter, and config.static TunableIntcreateConfig(TunableConfig config) Creates a tunable integer with the given config and an initial value of 0.abstract intget()Gets the value.intgetAsInt()abstract voidset(int 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 IntConsumer
andThen
-
Constructor Details
-
TunableInt
Constructs a tunable integer.- Parameters:
config- tunable config
-
TunableInt
Constructs a tunable integer.- Parameters:
config- tunable configsupportsChangeNotification- whether the tunable notifies backends when it changes
-
-
Method Details
-
create
Creates a tunable integer with the initial value of 0.- Returns:
- a tunable integer
-
create
Creates a tunable integer with the given initial value.- Parameters:
initialValue- initial value- Returns:
- a tunable integer
-
create
Creates a tunable integer 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 integer
-
createConfig
Creates a tunable integer with the given config and an initial value of 0.- Parameters:
config- tunable config- Returns:
- a tunable integer
-
createConfig
Creates a tunable integer with the given initial value and config.- Parameters:
initialValue- initial valueconfig- tunable config- Returns:
- a tunable integer
-
createConfig
Creates a tunable integer 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 integer
-
set
public abstract void set(int value) Sets the value.Implementations must not throw.
- Parameters:
value- value
-
get
public abstract int get()Gets the value.Implementations must not throw.
- Returns:
- value
-
getAsInt
public int getAsInt()- Specified by:
getAsIntin interfaceIntSupplier
-
accept
public void accept(int value) - Specified by:
acceptin interfaceIntConsumer
-