|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcore.ModuleCommunicationBus
public class ModuleCommunicationBus
Intermodule communication bus. Works as a blackboard where modules can post data, subscribe to data changes and also poll for data values. This is fairly similar to Message class' property interface, but these values are shared for a node instead of message.
Constructor Summary | |
---|---|
ModuleCommunicationBus()
Constructor. |
Method Summary | |
---|---|
void |
addProperty(java.lang.String key,
java.lang.Object value)
Adds a new property for this node. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ModuleCommunicationBus()
Method Detail |
---|
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 store
SimError
- 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 object
public 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 store
SimError
public double updateDouble(java.lang.String key, double delta) throws SimError
key
- The key of variable to updatedelta
- Value added to the old value
SimError
- 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 key
SimError
- 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 key
SimError
- 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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |