Class TunableLong
java.lang.Object
org.wpilib.tunable.TunableBase
org.wpilib.tunable.TunableLong
- All Implemented Interfaces:
LongConsumer, LongSupplier
A tunable long.
-
Field Summary
Fields inherited from class TunableBase
m_changed -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTunableLong(TunableConfig config) Constructs a tunable long.protectedTunableLong(TunableConfig config, boolean supportsChangeNotification) Constructs a tunable long. -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(long value) static TunableLongcreate()Creates a tunable long with the initial value of 0.static TunableLongcreate(long initialValue) Creates a tunable long with the given initial value.static TunableLongcreate(LongSupplier getter, LongConsumer setter) Creates a tunable long with the given getter and setter.static TunableLongcreateConfig(long initialValue, TunableConfig config) Creates a tunable long with the given initial value and config.static TunableLongcreateConfig(LongSupplier getter, LongConsumer setter, TunableConfig config) Creates a tunable long with the given getter, setter, and config.static TunableLongcreateConfig(TunableConfig config) Creates a tunable long with the given config and an initial value of 0.abstract longget()Gets the value.longabstract voidset(long 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 LongConsumer
andThen
-
Constructor Details
-
TunableLong
Constructs a tunable long.- Parameters:
config- tunable config
-
TunableLong
Constructs a tunable long.- Parameters:
config- tunable configsupportsChangeNotification- whether the tunable notifies backends when it changes
-
-
Method Details
-
create
Creates a tunable long with the initial value of 0.- Returns:
- a tunable long
-
create
Creates a tunable long with the given initial value.- Parameters:
initialValue- initial value- Returns:
- a tunable long
-
create
Creates a tunable long 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 long
-
createConfig
Creates a tunable long with the given config and an initial value of 0.- Parameters:
config- tunable config- Returns:
- a tunable long
-
createConfig
Creates a tunable long with the given initial value and config.- Parameters:
initialValue- initial valueconfig- tunable config- Returns:
- a tunable long
-
createConfig
public static TunableLong createConfig(LongSupplier getter, LongConsumer setter, TunableConfig config) Creates a tunable long 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 long
-
set
public abstract void set(long value) Sets the value.Implementations must not throw.
- Parameters:
value- value
-
get
public abstract long get()Gets the value.Implementations must not throw.
- Returns:
- value
-
getAsLong
public long getAsLong()- Specified by:
getAsLongin interfaceLongSupplier
-
accept
public void accept(long value) - Specified by:
acceptin interfaceLongConsumer
-