|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectti.chimera.registry.Node
Base class for a node in the tree. A node can have an optional contract, which constraints what values can be assigned to this node. If no contract is specified, the null-contract (ie. accept any value) will be used.
Clients can subscribe to the value of the node, in which case every time the node's value is changed, the new value will be published to them. (Also, the current value is immediately published, upon subscription.) All changes to a node are published in the order they occur.
NOTE: currently it is possible that a value be published to a subscriber after the subscriber has been unsubscribed, but only if the change that is being published occurred before the subscriber unsubscribed.
Nested Class Summary | |
static class |
Node.NonSwingWorker
|
static class |
Node.SwingWorker
|
Constructor Summary | |
Node(java.lang.Object value,
NodeContract contract,
java.lang.String comment)
Class Constructor. |
Method Summary | |
java.lang.String |
getComment()
Get the node's comment. |
NodeContract |
getNodeContract()
Get the node's contract. |
java.lang.String |
getPrimaryPath()
Get the primary path of this node. |
java.lang.Object |
getValue()
Get the current value of the node. |
void |
setValue(java.lang.Object value)
Set the value of this node, and publish the new value to all the subscribers. |
void |
subscribe(NodeSubscriber s)
Add the subscriber to the list of registered subscribers, and immediately publish the current value. |
java.lang.String |
toString()
For debug |
void |
unsubscribe(NodeSubscriber s)
Remove the subscriber from the list of registered subscribers. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Node(java.lang.Object value, NodeContract contract, java.lang.String comment)
value
- the node's initial valuecontract
- the node's contract, or null
comment
- a string containing a description of the purpose
of this node, the node's usage, etc. Can contain HTML markup.Method Detail |
public NodeContract getNodeContract()
NodeContract
public java.lang.String getComment()
public void setValue(java.lang.Object value)
value
- the node's new valuepublic java.lang.Object getValue()
public java.lang.String getPrimaryPath()
null
. Otherwise
this will be the first path this node is linked in to but has not
yet been unlinked from.
null
.public void subscribe(NodeSubscriber s)
s
- the subscriberpublic void unsubscribe(NodeSubscriber s)
s
- the subscriberpublic java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |