Class TunableBase
java.lang.Object
org.wpilib.tunable.TunableBase
- Direct Known Subclasses:
Tunable, TunableBoolean, TunableDouble, TunableFloat, TunableInt, TunableLong
The base class for tunables.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanWhether the tunable value has changed since the last time it was tuned. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTunableBase(TunableConfig config) Constructs a tunable base.protectedTunableBase(TunableConfig config, boolean supportsChangeNotification) Constructs a tunable base. -
Method Summary
Modifier and TypeMethodDescriptionReturns the configuration of this tunable.Returns the properties of this tunable as a JSON string.booleanReturns whether the tunable value has changed since the last time it was tuned.booleanisRobust()Returns whether this tunable is robust.protected voidMarks the tunable changed and notifies backends.voidResets the changed flag.booleanReturns whether this tunable notifies backends when set() marks it changed.
-
Field Details
-
m_changed
protected boolean m_changedWhether the tunable value has changed since the last time it was tuned. This is set to true when set() is called and cleared when notifyTune() is called.
-
-
Constructor Details
-
TunableBase
Constructs a tunable base.- Parameters:
config- tunable config
-
TunableBase
Constructs a tunable base.If supportsChangeNotification is true, subclasses must call
markChanged()instead of setting m_changed directly.- Parameters:
config- tunable configsupportsChangeNotification- whether the tunable notifies backends when it changes
-
-
Method Details
-
isRobust
public boolean isRobust()Returns whether this tunable is robust.- Returns:
- true if the tunable is robust, false otherwise
- See Also:
-
getProperties
Returns the properties of this tunable as a JSON string.- Returns:
- the properties of this tunable as a JSON string
- See Also:
-
getConfig
Returns the configuration of this tunable.- Returns:
- the configuration of this tunable
-
hasChanged
public boolean hasChanged()Returns whether the tunable value has changed since the last time it was tuned.- Returns:
- true if the tunable value has changed, false otherwise
-
supportsChangeNotification
public boolean supportsChangeNotification()Returns whether this tunable notifies backends when set() marks it changed.- Returns:
- true if this tunable notifies backends when changed, false otherwise
-
markChanged
protected void markChanged()Marks the tunable changed and notifies backends. -
resetChanged
public void resetChanged()Resets the changed flag. Should generally only be used by backends.
-