public interface Node extends Persistable
Network
.
DriverItem
.
Existing blocks may be interfaced with the adapter block if a
DriverBlock
exists that supports the block.
Component
Modifier and Type | Method and Description |
---|---|
java.lang.String |
address()
The address of the node, so that it can be found in the network.
|
boolean |
canBeReachedFrom(Node other)
Checks whether this node can be reached from the specified node.
|
void |
connect(Node node)
Connects the specified node to this node.
|
void |
disconnect(Node node)
Disconnects the specified node from this node.
|
Environment |
host()
The environment hosting this node.
|
boolean |
isNeighborOf(Node other)
Checks whether this node is a neighbor of the specified node.
|
java.lang.Iterable<Node> |
neighbors()
Get the list of neighbor nodes, i.e.
|
Network |
network()
The network this node is currently in.
|
Visibility |
reachability()
The reachability of this node.
|
java.lang.Iterable<Node> |
reachableNodes()
Get the list of nodes reachable from this node, based on their
reachability() . |
void |
remove()
Removes this node from its network.
|
void |
sendToAddress(java.lang.String target,
java.lang.String name,
java.lang.Object... data)
Send a message to a node with the specified address.
|
void |
sendToNeighbors(java.lang.String name,
java.lang.Object... data)
Send a message to all neighbors of this node.
|
void |
sendToReachable(java.lang.String name,
java.lang.Object... data)
Send a message to all nodes reachable from this node.
|
void |
sendToVisible(java.lang.String name,
java.lang.Object... data)
Send a message to all nodes visible from this node.
|
loadData, saveData
Environment host()
Environment
this will
be the tile entity. For all other implementations this will be a managed
environment.Visibility reachability()
Component
's visibility, which is
checked before delivering messages a computer tries to send.java.lang.String address()
Network network()
boolean isNeighborOf(Node other)
other
- the node to check for.boolean canBeReachedFrom(Node other)
other
- the node to check for.java.lang.Iterable<Node> neighbors()
java.lang.Iterable<Node> reachableNodes()
reachability()
.
void connect(Node node)
node
- the node to connect to this node.java.lang.NullPointerException
- if network is null.void disconnect(Node node)
node
- the node to connect to this node.java.lang.NullPointerException
- if network is null.void remove()
void sendToAddress(java.lang.String target, java.lang.String name, java.lang.Object... data)
target
- the address of the node to send the message to.name
- the name of the message.data
- the data to pass along with the message.void sendToNeighbors(java.lang.String name, java.lang.Object... data)
name
- the name of the message.data
- the data to pass along with the message.void sendToReachable(java.lang.String name, java.lang.Object... data)
name
- the name of the message.data
- the data to pass along with the message.void sendToVisible(java.lang.String name, java.lang.Object... data)
name
- the name of the message.data
- the data to pass along with the message.