|
" 2013 FRC Java API " |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.wpi.first.wpilibj.networktables.NetworkTable
public class NetworkTable
Field Summary | |
---|---|
static int |
DEFAULT_PORT
The default port that network tables operates on |
static char |
PATH_SEPARATOR
The path separator for sub-tables and keys |
Method Summary | |
---|---|
void |
addConnectionListener(IRemoteConnectionListener listener,
boolean immediateNotify)
Register an object to listen for connection and disconnection events |
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)
Checks the table and tells if it contains the specified key |
boolean |
containsSubTable(String key)
|
boolean |
getBoolean(String key)
Returns the key that the name maps to. |
boolean |
getBoolean(String key,
boolean defaultValue)
Returns the key that the name maps to. |
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)
Returns the key that the name maps to. |
double |
getNumber(String key,
double defaultValue)
Returns the key that the name maps to. |
String |
getString(String key)
Returns the key that the name maps to. |
String |
getString(String key,
String defaultValue)
Returns the key that the name maps to. |
ITable |
getSubTable(String key)
Returns the table at the specified key. |
static NetworkTable |
getTable(String key)
Gets the table with the specified key. |
Object |
getValue(String key)
Returns the key that the name maps to. |
Object |
getValue(String key,
Object defaultValue)
Returns the key that the name maps to. |
static void |
initialize()
|
boolean |
isConnected()
Get the current state of the objects connection |
boolean |
isServer()
If the object is acting as a server |
void |
putBoolean(String key,
boolean value)
Maps the specified key to the specified value in this 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)
Maps the specified key to the specified value in this table. |
void |
putString(String key,
String value)
Maps the specified key to the specified value in this table. |
void |
putValue(String key,
Object value)
Maps the specified key to the specified value in this table. |
void |
removeConnectionListener(IRemoteConnectionListener listener)
Unregister a listener from connection events |
void |
removeTableListener(ITableListener listener)
Remove a listener from receiving table events |
void |
retrieveValue(String key,
Object externalValue)
|
static void |
setIPAddress(String address)
|
static void |
setServerMode()
set that network tables should be a server This must be called before initalize or getTable |
static void |
setTeam(int team)
set the team the robot is configured for (this will set the ip address that network tables will connect to in client mode) This must be called before initalize or getTable |
String |
toString()
Returns a string representation of the object. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final char PATH_SEPARATOR
public static final int DEFAULT_PORT
Method Detail |
---|
public static void initialize() throws IOException
IOException
public static void setServerMode()
public static void setTeam(int team)
team
- the team numberpublic static void setIPAddress(String address)
address
- the adress that network tables will connect to in client modepublic static NetworkTable getTable(String key)
key
- the key name
public String toString()
Object
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
toString
in class Object
public boolean isConnected()
IRemote
isConnected
in interface IRemote
public boolean isServer()
IRemote
isServer
in interface IRemote
public void addConnectionListener(IRemoteConnectionListener listener, boolean immediateNotify)
IRemote
addConnectionListener
in interface IRemote
listener
- the listener to be registerimmediateNotify
- if the listener object should be notified of the current connection statepublic void removeConnectionListener(IRemoteConnectionListener listener)
IRemote
removeConnectionListener
in interface IRemote
listener
- the listener to be unregisteredpublic void addTableListener(ITableListener listener)
ITable
addTableListener
in interface ITable
listener
- the listener to addpublic void addTableListener(ITableListener listener, boolean immediateNotify)
ITable
addTableListener
in interface ITable
listener
- the listener to addimmediateNotify
- if true then this listener will be notified of all current entries (marked as new)public void addTableListener(String key, ITableListener listener, boolean immediateNotify)
ITable
addTableListener
in interface ITable
key
- the key to listen forlistener
- the listener to addimmediateNotify
- if true then this listener will be notified of all current entries (marked as new)public void addSubTableListener(ITableListener listener)
ITable
addSubTableListener
in interface ITable
public void removeTableListener(ITableListener listener)
ITable
removeTableListener
in interface ITable
listener
- the listener to be removedpublic ITable getSubTable(String key)
getSubTable
in interface ITable
key
- the key name
public boolean containsKey(String key)
containsKey
in interface ITable
key
- the key to be checked
public boolean containsSubTable(String key)
containsSubTable
in interface ITable
key
- the key to search for
public void putNumber(String key, double value)
putNumber
in interface ITable
key
- the keyvalue
- the valuepublic double getNumber(String key) throws TableKeyNotDefinedException
getNumber
in interface ITable
key
- the key name
TableKeyNotDefinedException
- if the specified key is nullpublic double getNumber(String key, double defaultValue)
getNumber
in interface ITable
key
- the key namedefaultValue
- the default value if the key is null
public void putString(String key, String value)
putString
in interface ITable
key
- the keyvalue
- the valuepublic String getString(String key) throws TableKeyNotDefinedException
getString
in interface ITable
key
- the key name
TableKeyNotDefinedException
- if the specified key is nullpublic String getString(String key, String defaultValue)
getString
in interface ITable
key
- the key namedefaultValue
- the default value if the key is null
public void putBoolean(String key, boolean value)
putBoolean
in interface ITable
key
- the keyvalue
- the valuepublic boolean getBoolean(String key) throws TableKeyNotDefinedException
getBoolean
in interface ITable
key
- the key name
TableKeyNotDefinedException
- if the specified key is nullpublic boolean getBoolean(String key, boolean defaultValue)
getBoolean
in interface ITable
key
- the key namedefaultValue
- the default value if the key is null
public void retrieveValue(String key, Object externalValue)
retrieveValue
in interface ITable
public void putValue(String key, Object value)
putValue
in interface ITable
key
- the key namevalue
- the value to be putpublic Object getValue(String key) throws TableKeyNotDefinedException
getValue
in interface ITable
key
- the key name
TableKeyNotDefinedException
- if the specified key is nullpublic Object getValue(String key, Object defaultValue)
key
- the key namedefaultValue
- the default value if the key is null
public void putInt(String key, int value)
putInt
in interface ITable
key
- the keyvalue
- the value
IllegalArgumentException
- if key is nullpublic int getInt(String key) throws TableKeyNotDefinedException
getInt
in interface ITable
key
- the key
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 nullpublic int getInt(String key, int defaultValue) throws TableKeyNotDefinedException
getInt
in interface ITable
key
- the keydefaultValue
- the value returned if the key is undefined
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
public void putDouble(String key, double value)
putDouble
in interface ITable
key
- the keyvalue
- the value
IllegalArgumentException
- if key is nullpublic double getDouble(String key) throws TableKeyNotDefinedException
getDouble
in interface ITable
key
- the key
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
public double getDouble(String key, double defaultValue)
getDouble
in interface ITable
key
- the keydefaultValue
- the value returned if the key is undefined
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 " |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |