public interface Component extends Node
Node
's network reachability, this is a dynamic value and
can be changed at any time. For example, this is used to hide multi-block
screen parts that are not the origin from computers in the network.
The method responsible for dispatching network messages from computers also
only allows sending messages to components that the computer can see,
according to the component's visibility. Therefore nodes won't receive
messages from computer's that should not be able to see them.Modifier and Type | Method and Description |
---|---|
Callback |
annotation(java.lang.String method)
Get the annotation information of a method.
|
boolean |
canBeSeenFrom(Node other)
Tests whether this component can be seen by the specified node,
usually representing a computer in the network.
|
java.lang.Object[] |
invoke(java.lang.String method,
Context context,
java.lang.Object... arguments)
Tries to call a function with the specified name on this component.
|
java.util.Collection<java.lang.String> |
methods()
The list of names of methods exposed by this component.
|
java.lang.String |
name()
The name of the node.
|
void |
setVisibility(Visibility value)
Set the visibility of this component.
|
Visibility |
visibility()
Get the visibility of this component.
|
address, canBeReachedFrom, connect, disconnect, host, isNeighborOf, neighbors, network, reachability, reachableNodes, remove, sendToAddress, sendToNeighbors, sendToReachable, sendToVisible
load, save
java.lang.String name()
Visibility visibility()
void setVisibility(Visibility value)
java.lang.IllegalArgumentException
- if the specified value is
more visible than the node's
reachability.boolean canBeSeenFrom(Node other)
other
- the computer node to check for.java.util.Collection<java.lang.String> methods()
Callback annotation(java.lang.String method)
method
- the method to the the info for.java.lang.Object[] invoke(java.lang.String method, Context context, java.lang.Object... arguments) throws java.lang.Exception
methods()
.
The returned array may be null if there is no return value.method
- the name of the method to call.context
- the context from which the method is called, usually the
instance of the computer running the script that made
the call.arguments
- the arguments passed to the method.java.lang.NoSuchMethodException
- if there is no method with that name.java.lang.Exception