public class ModuleCommunicationBus
extends java.lang.Object
| Constructor and Description |
|---|
ModuleCommunicationBus()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addProperty(java.lang.String key,
java.lang.Object value)
Adds a new property for this node.
|
boolean |
containsProperty(java.lang.String key)
Returns true if the bus contains a value for the given key
|
double |
getDouble(java.lang.String key,
double naValue)
Returns a double value from the communication bus.
|
int |
getInt(java.lang.String key,
int naValue)
Returns an integer value from the communication bus.
|
java.lang.Object |
getProperty(java.lang.String key)
Returns an object that was stored using the given key.
|
void |
subscribe(java.lang.String key,
ModuleCommunicationListener module)
Subscribes a module to changes of a certain value.
|
java.lang.String |
toString() |
void |
unsubscribe(java.lang.String key,
ModuleCommunicationListener module)
Removes a notification subscription
|
double |
updateDouble(java.lang.String key,
double delta)
Changes the Double value with given key with the value delta
|
void |
updateProperty(java.lang.String key,
java.lang.Object value)
Updates a value for an existing property.
|
public void addProperty(java.lang.String key,
java.lang.Object value)
throws SimError
getProperty(java.lang.String).key - The key which is used to lookup the valuevalue - The value to storeSimError - if there is already a value for the given keypublic java.lang.Object getProperty(java.lang.String key)
key - The key used to lookup the objectpublic boolean containsProperty(java.lang.String key)
key - The key for which a value's existence is checkedpublic void updateProperty(java.lang.String key,
java.lang.Object value)
throws SimError
addProperty(String, Object) should be used which
checks for name space clashes.key - The key which is used to lookup the valuevalue - The new value to storeSimErrorpublic double updateDouble(java.lang.String key,
double delta)
throws SimError
key - The key of variable to updatedelta - Value added to the old valueSimError - if the value with the given key was not a Doublepublic double getDouble(java.lang.String key,
double naValue)
throws SimError
key - The key of the variablenaValue - The value to return if there is no value for the keySimError - if the value with the given key was not a Doublepublic int getInt(java.lang.String key,
int naValue)
throws SimError
key - The key of the variablenaValue - The value to return if there is no value for the keySimError - if the value with the given key was not an Integerpublic void subscribe(java.lang.String key,
ModuleCommunicationListener module)
key - The key of the value whose changes the module is interested ofmodule - The module to subscribe.public void unsubscribe(java.lang.String key,
ModuleCommunicationListener module)
key - The key for which the subscription should be removedmodule - The module to whose subscription is removedpublic java.lang.String toString()
toString in class java.lang.Object