Class MockTunableBackend
java.lang.Object
org.wpilib.tunable.MockTunableBackend
- All Implemented Interfaces:
AutoCloseable, TunableBackend
A mock tunable backend for testing.
-
Nested Class Summary
Nested classes/interfaces inherited from interface TunableBackend
TunableBackend.PublishedTunable -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()booleangetBoolean(String path) Gets the value of a tunable.doubleGets the value of a tunable.floatGets the value of a tunable.intgetInteger(String path) Gets the value of a tunable.longGets the value of a tunable.getTunable(String path) Gets a published tunable.<T> TGets the value of a tunable.booleanpublish(String path, TunableBase tunable) Publishes a tunable.booleanpublishComplex(String path, ComplexTunable tunable) Publishes a complex tunable.voidRemoves a tunable.removePrefix(String prefix) Removes all tunables under a prefix.voidSets the value of a tunable.voidSets the value of a tunable.voidSets the value of a tunable.voidSets the value of a tunable.voidSets the value of a tunable.<T> voidSets the value of a tunable.voidsetBoolean(String path, boolean value) Sets the value of a tunable.voidSets the value of a tunable.voidSets the value of a tunable.voidSets the value of a tunable.voidSets the value of a tunable.<T> voidSets the value of a tunable.voidupdate()Updates all tunable values and calls callbacks where appropriate.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface TunableBackend
markDirty
-
Constructor Details
-
MockTunableBackend
public MockTunableBackend()Constructs a mock tunable backend.
-
-
Method Details
-
getTunable
Gets a published tunable.- Parameters:
path- normalized path- Returns:
- tunable
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
getBoolean
Gets the value of a tunable.- Parameters:
path- normalized path- Returns:
- value
-
getInteger
Gets the value of a tunable.- Parameters:
path- normalized path- Returns:
- value
-
getLong
Gets the value of a tunable.- Parameters:
path- normalized path- Returns:
- value
-
getFloat
Gets the value of a tunable.- Parameters:
path- normalized path- Returns:
- value
-
getDouble
Gets the value of a tunable.- Parameters:
path- normalized path- Returns:
- value
-
getValue
-
setBoolean
Sets the value of a tunable.- Parameters:
path- normalized pathvalue- value
-
setInt
Sets the value of a tunable.- Parameters:
path- normalized pathvalue- value
-
setLong
Sets the value of a tunable.- Parameters:
path- normalized pathvalue- value
-
setFloat
Sets the value of a tunable.- Parameters:
path- normalized pathvalue- value
-
setDouble
Sets the value of a tunable.- Parameters:
path- normalized pathvalue- value
-
setValue
Sets the value of a tunable.- Type Parameters:
T- value type- Parameters:
path- normalized pathvalue- value
-
setArray
Sets the value of a tunable.- Parameters:
path- normalized pathvalue- value
-
setArray
Sets the value of a tunable.- Parameters:
path- normalized pathvalue- value
-
setArray
Sets the value of a tunable.- Parameters:
path- normalized pathvalue- value
-
setArray
Sets the value of a tunable.- Parameters:
path- normalized pathvalue- value
-
setArray
Sets the value of a tunable.- Parameters:
path- normalized pathvalue- value
-
setArray
Sets the value of a tunable.- Type Parameters:
T- array element type- Parameters:
path- normalized pathvalue- value
-
publish
Description copied from interface:TunableBackendPublishes a tunable.Backend implementations must not throw from this method. Recoverable publication failures should be reported through
TunableRegistry.reportWarning(String)and skipped.- Specified by:
publishin interfaceTunableBackend- Parameters:
path- normalized pathtunable- the tunable- Returns:
- true if the tunable was published, false otherwise
-
publishComplex
Description copied from interface:TunableBackendPublishes a complex tunable.Backend implementations must not throw from this method. Recoverable publication failures should be reported through
TunableRegistry.reportWarning(String)and skipped.- Specified by:
publishComplexin interfaceTunableBackend- Parameters:
path- normalized pathtunable- the tunable- Returns:
- true if the tunable was published, false otherwise
-
remove
Description copied from interface:TunableBackendRemoves a tunable.Backend implementations must not throw from this method.
- Specified by:
removein interfaceTunableBackend- Parameters:
path- normalized path
-
removePrefix
Description copied from interface:TunableBackendRemoves all tunables under a prefix.Backend implementations must not throw from this method. The returned list must describe the tunables actually removed from the backend.
- Specified by:
removePrefixin interfaceTunableBackend- Parameters:
prefix- normalized path prefix- Returns:
- removed tunables
-
update
public void update()Description copied from interface:TunableBackendUpdates all tunable values and calls callbacks where appropriate.Backend implementations must not throw from this method. Recoverable update failures should be reported through
TunableRegistry.reportWarning(String)and skipped so the robot loop and registry state can continue updating.- Specified by:
updatein interfaceTunableBackend
-