"

2013 FRC Java API

"

edu.wpi.first.wpilibj.tables
Interface ITable

All Known Implementing Classes:
NetworkTable

public interface ITable

A table whose values can be read and written to

Author:
Mitchell

Method Summary
 void addSubTableListener(ITableListener listener)
          This will immediately notify the listener of all current sub tables
 void addTableListener(ITableListener listener)
          Add a listener for changes to the table
 void addTableListener(ITableListener listener, boolean immediateNotify)
          Add a listener for changes to the table
 void addTableListener(String key, ITableListener listener, boolean immediateNotify)
          Add a listener for changes to a specific key the table
 boolean containsKey(String key)
           
 boolean containsSubTable(String key)
           
 boolean getBoolean(String key)
           
 boolean getBoolean(String key, boolean defaultValue)
           
 double getDouble(String key)
          Deprecated. Returns the value at the specified key.
 double getDouble(String key, double defaultValue)
          Deprecated. Returns the value at the specified key.
 int getInt(String key)
          Deprecated. Returns the value at the specified key.
 int getInt(String key, int defaultValue)
          Deprecated. Returns the value at the specified key.
 double getNumber(String key)
           
 double getNumber(String key, double defaultValue)
           
 String getString(String key)
           
 String getString(String key, String defaultValue)
           
 ITable getSubTable(String key)
           
 Object getValue(String key)
          Gets the value associated with a key as an object
 void putBoolean(String key, boolean value)
          Put a boolean in the table
 void putDouble(String key, double value)
          Deprecated. Maps the specified key to the specified value in this table. The key can not be null. The value can be retrieved by calling the get method with a key that is equal to the original key.
 void putInt(String key, int value)
          Deprecated. Maps the specified key to the specified value in this table. The key can not be null. The value can be retrieved by calling the get method with a key that is equal to the original key.
 void putNumber(String key, double value)
          Put a number in the table
 void putString(String key, String value)
          Put a string in the table
 void putValue(String key, Object value)
          Put a value in the table
 void removeTableListener(ITableListener listener)
          Remove a listener from receiving table events
 void retrieveValue(String key, Object externalValue)
           
 

Method Detail

containsKey

boolean containsKey(String key)
Parameters:
key - the key to search for
Returns:
true if the table as a value assigned to the given key

containsSubTable

boolean containsSubTable(String key)
Parameters:
key - the key to search for
Returns:
true if there is a subtable with the key which contains at least one key/subtable of its own

getSubTable

ITable getSubTable(String key)
Parameters:
key - the name of the table relative to this one
Returns:
a sub table relative to this one

getValue

Object getValue(String key)
                throws TableKeyNotDefinedException
Gets the value associated with a key as an object

Parameters:
key - the key of the value to look up
Returns:
the value associated with the given key
Throws:
TableKeyNotDefinedException - if there is no value associated with the given key

putValue

void putValue(String key,
              Object value)
              throws IllegalArgumentException
Put a value in the table

Parameters:
key - the key to be assigned to
value - the value that will be assigned
Throws:
IllegalArgumentException - when the value is not supported by the table

retrieveValue

void retrieveValue(String key,
                   Object externalValue)

putNumber

void putNumber(String key,
               double value)
Put a number in the table

Parameters:
key - the key to be assigned to
value - the value that will be assigned

getNumber

double getNumber(String key)
                 throws TableKeyNotDefinedException
Parameters:
key - the key to look up
Returns:
the value associated with the given key
Throws:
TableKeyNotDefinedException - if there is no value associated with the given key

getNumber

double getNumber(String key,
                 double defaultValue)
Parameters:
key - the key to look up
defaultValue - the value to be returned if no value is found
Returns:
the value associated with the given key or the given default value if there is no value associated with the key

putString

void putString(String key,
               String value)
Put a string in the table

Parameters:
key - the key to be assigned to
value - the value that will be assigned

getString

String getString(String key)
                 throws TableKeyNotDefinedException
Parameters:
key - the key to look up
Returns:
the value associated with the given key
Throws:
TableKeyNotDefinedException - if there is no value associated with the given key

getString

String getString(String key,
                 String defaultValue)
Parameters:
key - the key to look up
defaultValue - the value to be returned if no value is found
Returns:
the value associated with the given key or the given default value if there is no value associated with the key

putBoolean

void putBoolean(String key,
                boolean value)
Put a boolean in the table

Parameters:
key - the key to be assigned to
value - the value that will be assigned

getBoolean

boolean getBoolean(String key)
                   throws TableKeyNotDefinedException
Parameters:
key - the key to look up
Returns:
the value associated with the given key
Throws:
TableKeyNotDefinedException - if there is no value associated with the given key

getBoolean

boolean getBoolean(String key,
                   boolean defaultValue)
Parameters:
key - the key to look up
defaultValue - the value to be returned if no value is found
Returns:
the value associated with the given key or the given default value if there is no value associated with the key

addTableListener

void addTableListener(ITableListener listener)
Add a listener for changes to the table

Parameters:
listener - the listener to add

addTableListener

void addTableListener(ITableListener listener,
                      boolean immediateNotify)
Add a listener for changes to the table

Parameters:
listener - the listener to add
immediateNotify - if true then this listener will be notified of all current entries (marked as new)

addTableListener

void addTableListener(String key,
                      ITableListener listener,
                      boolean immediateNotify)
Add a listener for changes to a specific key the table

Parameters:
key - the key to listen for
listener - the listener to add
immediateNotify - if true then this listener will be notified of all current entries (marked as new)

addSubTableListener

void addSubTableListener(ITableListener listener)
This will immediately notify the listener of all current sub tables

Parameters:
listener -

removeTableListener

void removeTableListener(ITableListener listener)
Remove a listener from receiving table events

Parameters:
listener - the listener to be removed

putInt

void putInt(String key,
            int value)
Deprecated. Maps the specified key to the specified value in this table. The key can not be null. The value can be retrieved by calling the get method with a key that is equal to the original key.

Parameters:
key - the key
value - the value
Throws:
IllegalArgumentException - if key is null

getInt

int getInt(String key)
           throws TableKeyNotDefinedException
Deprecated. Returns the value at the specified key.

Parameters:
key - the key
Returns:
the value
Throws:
TableKeyNotDefinedException - if there is no value mapped to by the key
IllegalArgumentException - if the value mapped to by the key is not an int
IllegalArgumentException - if the key is null

getInt

int getInt(String key,
           int defaultValue)
           throws TableKeyNotDefinedException
Deprecated. Returns the value at the specified key.

Parameters:
key - the key
defaultValue - the value returned if the key is undefined
Returns:
the value
Throws:
NetworkTableKeyNotDefined - if there is no value mapped to by the key
IllegalArgumentException - if the value mapped to by the key is not an int
IllegalArgumentException - if the key is null
TableKeyNotDefinedException

putDouble

void putDouble(String key,
               double value)
Deprecated. Maps the specified key to the specified value in this table. The key can not be null. The value can be retrieved by calling the get method with a key that is equal to the original key.

Parameters:
key - the key
value - the value
Throws:
IllegalArgumentException - if key is null

getDouble

double getDouble(String key)
                 throws TableKeyNotDefinedException
Deprecated. Returns the value at the specified key.

Parameters:
key - the key
Returns:
the value
Throws:
NoSuchEleNetworkTableKeyNotDefinedmentException - if there is no value mapped to by the key
IllegalArgumentException - if the value mapped to by the key is not a double
IllegalArgumentException - if the key is null
TableKeyNotDefinedException

getDouble

double getDouble(String key,
                 double defaultValue)
Deprecated. Returns the value at the specified key.

Parameters:
key - the key
defaultValue - the value returned if the key is undefined
Returns:
the value
Throws:
NoSuchEleNetworkTableKeyNotDefinedmentException - if there is no value mapped to by the key
IllegalArgumentException - if the value mapped to by the key is not a double
IllegalArgumentException - if the key is null

"

2013 FRC Java API

"

"
For updated information see the Java FRC site
"