Package com.anylogic.engine
- All Superinterfaces:
AbstractLinkToAgent<T,
,A> Serializable
- All Known Implementing Classes:
LinkToAgentImpl
public interface LinkToAgent<T extends Agent,A extends Agent> extends AbstractLinkToAgent<T,A>
Modifier and Type | Method | Description |
---|---|---|
void | connectTo |
Creates a uni-directional connection between this agent and a given
other agent.
|
void | deliver |
Delivers a message to connected given agent immediately during this method call.
|
boolean | disconnect() |
Disconnects this agent from another given agent.
|
T | getConnectedAgent() |
Returns connected agent
|
boolean | isConnected() |
Tests if this link is connected to some agent.
|
void | send |
Sends a message to connected agent.
|
T getConnectedAgent()
Returns connected agent
- Returns:
- connected agent or
null
if this link isn't connected
boolean isConnected()
Tests if this link is connected to some agent.
- Returns:
true
if the link is connected,false
otherwise- See Also:
-
getConnectedAgent()
void connectTo(T a)
Creates a uni-directional connection between this agent and a given
other agent. Raises error if you try to connect to itself. Does
nothing if agents are already connected. Performs disconnect -
in case when link was previously connected to some other agent.
- Parameters:
a
- another agent
boolean disconnect()
Disconnects this agent from another given agent.
- Parameters:
a
- another agent- Returns:
true
if the agents were connected,false
otherwise
void send(Object msg)
Sends a message to connected agent. The message will be delivered during
a separate event scheduled to occur in zero time after the current one.
If you are OK with the message delivered immediately during this event,
use deliver() method, which has better performance.
- Parameters:
msg
- a message
void deliver(Object msg)
Delivers a message to connected given agent immediately during this method call.
If you wish this to happen in a separate event, use send() method.
- Parameters:
msg
- a message