Package xbot.common.properties
Class PreferenceStorage
java.lang.Object
xbot.common.properties.PreferenceStorage
- All Implemented Interfaces:
ITableProxy
,PermanentStorage
This saves properties to the robot using WPI's built-in
Preferences library.
This stores them in a simple key-value pair on the robot, in a file called
/home/lvuser/networktables.ini
.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clears all values from the table.getBoolean
(String key) Reads a boolean property value.Reads a numeric property value.Reads a string property value.void
Removes a key from the table.void
setBoolean
(String key, boolean value) Writes a boolean property value.void
Writes a numeric property value.void
setFastMode
(boolean on) Sets the table to fast mode.void
Writes a string property value.
-
Field Details
-
log
protected static org.apache.logging.log4j.Logger log
-
-
Constructor Details
-
PreferenceStorage
@Inject public PreferenceStorage()
-
-
Method Details
-
setDouble
Description copied from interface:ITableProxy
Writes a numeric property value.- Specified by:
setDouble
in interfaceITableProxy
- Parameters:
key
- The name of the property.value
- The value to write.
-
setBoolean
Description copied from interface:ITableProxy
Writes a boolean property value.- Specified by:
setBoolean
in interfaceITableProxy
- Parameters:
key
- The name of the property.value
- The value to write.
-
setString
Description copied from interface:ITableProxy
Writes a string property value.- Specified by:
setString
in interfaceITableProxy
- Parameters:
key
- The name of the property.value
- The value to write.
-
getDouble
Description copied from interface:ITableProxy
Reads a numeric property value.- Specified by:
getDouble
in interfaceITableProxy
- Parameters:
key
- The name of the property.- Returns:
- The value of the property, or null if it does not exist.
-
getBoolean
Description copied from interface:ITableProxy
Reads a boolean property value.- Specified by:
getBoolean
in interfaceITableProxy
- Parameters:
key
- The name of the property.- Returns:
- The value of the property, or null if it does not exist.
-
getString
Description copied from interface:ITableProxy
Reads a string property value.- Specified by:
getString
in interfaceITableProxy
- Parameters:
key
- The name of the property.- Returns:
- The value of the property, or null if it does not exist.
-
clear
public void clear()Description copied from interface:ITableProxy
Clears all values from the table.- Specified by:
clear
in interfaceITableProxy
-
setFastMode
public void setFastMode(boolean on) Description copied from interface:ITableProxy
Sets the table to fast mode. This is a hint to the underlying implementation that we are going to be doing a lot of reads and writes in a short period of time, and that it should optimize for that case.- Specified by:
setFastMode
in interfaceITableProxy
- Parameters:
on
- True to turn fast mode on, false to turn it off.
-
remove
Description copied from interface:ITableProxy
Removes a key from the table.- Specified by:
remove
in interfaceITableProxy
- Parameters:
key
- The name of the property to remove.
-