AnyLogic AnyLogic
Expand
Font size
All Superinterfaces:
AbstractLinkToAgent<T,​A>, java.io.Serializable
All Known Implementing Classes:
LinkToAgentImpl

public interface LinkToAgent<T extends Agent,​A extends Agent>
extends AbstractLinkToAgent<T,​A>

Method Summary

All Methods Instance Methods Abstract Methods 
void connectTo​(T a)
Creates a uni-directional connection between this agent and a given other agent.
void deliver​(java.lang.Object msg)
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​(java.lang.Object msg)
Sends a message to connected agent.
Modifier and Type Method Description

Methods inherited from interface com.anylogic.engine.AbstractLinkToAgent

doConnect_xjal, doDisconnect_xjal, getBidirectionalPeer_xjal, getLinkToAgentCommonAnimationSettings, getLinkToAgentMyAnimationSettings, getOwner, isDeliverToAgent_xjal, onDestroy, onReceive

Method Detail

getConnectedAgent

T getConnectedAgent()
Returns connected agent
Returns:
connected agent or null if this link isn't connected

isConnected

boolean isConnected()
Tests if this link is connected to some agent.
Returns:
true if the link is connected, false otherwise
See Also:
getConnectedAgent()

connectTo

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

disconnect

boolean disconnect()
Disconnects this agent from another given agent.
Parameters:
a - another agent
Returns:
true if the agents were connected, false otherwise

send

void send​(java.lang.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

deliver

void deliver​(java.lang.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
How can we improve this article?