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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears all values from the table.getBoolean(String key) Reads a boolean property value.Reads a numeric property value.Reads a string property value.voidRemoves a key from the table.voidsetBoolean(String key, boolean value) Writes a boolean property value.voidWrites a numeric property value.voidsetFastMode(boolean on) Sets the table to fast mode.voidWrites 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:ITableProxyWrites a numeric property value.- Specified by:
setDoublein interfaceITableProxy- Parameters:
key- The name of the property.value- The value to write.
-
setBoolean
Description copied from interface:ITableProxyWrites a boolean property value.- Specified by:
setBooleanin interfaceITableProxy- Parameters:
key- The name of the property.value- The value to write.
-
setString
Description copied from interface:ITableProxyWrites a string property value.- Specified by:
setStringin interfaceITableProxy- Parameters:
key- The name of the property.value- The value to write.
-
getDouble
Description copied from interface:ITableProxyReads a numeric property value.- Specified by:
getDoublein 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:ITableProxyReads a boolean property value.- Specified by:
getBooleanin 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:ITableProxyReads a string property value.- Specified by:
getStringin 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:ITableProxyClears all values from the table.- Specified by:
clearin interfaceITableProxy
-
setFastMode
public void setFastMode(boolean on) Description copied from interface:ITableProxySets 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:
setFastModein interfaceITableProxy- Parameters:
on- True to turn fast mode on, false to turn it off.
-
remove
Description copied from interface:ITableProxyRemoves a key from the table.- Specified by:
removein interfaceITableProxy- Parameters:
key- The name of the property to remove.
-