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

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

Method Summary

Modifier and TypeMethodDescription
voidconnectTo(T a)
Creates a uni-directional connection between this agent and a given other agent.
voiddeliver(Object msg)
Delivers a message to connected given agent immediately during this method call.
booleandisconnect()
Disconnects this agent from another given agent.
TgetConnectedAgent()
Returns connected agent
booleanisConnected()
Tests if this link is connected to some agent.
voidsend(Object msg)
Sends a message to connected agent.

Method Details

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(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(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