AnyLogic
Expand
Font size
All Implemented Interfaces:
AbstractLinkToAgent<T,A>, AgentDestroyListener, LinkToAgent<T,A>, LinkToAgentAnimationSettings, Serializable

public class LinkToAgentImpl<T extends Agent,A extends Agent>
extends Object
implements LinkToAgent<T,A>
See Also:
Serialized Form

Constructor Summary

ConstructorDescription
LinkToAgentImpl(A owner, LinkToAgentAnimationSettings commonAnimationSettings) 

Method Summary

Modifier and TypeMethodDescription
voidconnectTo(T a)
Creates a uni-directional connection between this agent and a given other agent.
voidcopyFrom_xjal(LinkToAgentAnimationSettings linkToAgentMyAnimationSettings) 
voiddeliver(Object msg) 
booleandisconnect()
Disconnects this agent from another given agent.
voiddoConnect_xjal(T a)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. It is public due to technical reasons.
voiddoDisconnect_xjal(T a)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. It is public due to technical reasons.
doublegetArrowLocation() 
LineArrowStylegetArrowStyle() 
AbstractLinkToAgent<A,T>getBidirectionalPeer_xjal(T agent)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. It is public due to technical reasons.
TgetConnectedAgent()
Returns connected agent
ColorgetLineColor() 
LineStylegetLineStyle() 
doublegetLineWidth() 
LinkToAgentAnimationSettingsgetLinkToAgentCommonAnimationSettings()
Returns link animation settings shared by the all the agents having this link.
Changes to these settings apply to drawing of all links of this type
LinkToAgentAnimationSettingsgetLinkToAgentMyAnimationSettings()
Returns link animation settings for this particular agent.
Changes to these settings apply to drawing of this link only inside its agent
AgetOwner() 
booleanisConnected()
Tests if this link is connected to some agent.
booleanisDeliverToAgent_xjal()
Override this function for agent links which should call agent's "On Receive" code (which is defined in a standard 'connections' link).
booleanisVisible() 
voidonDestroy()
Discards the link and disconnects it if it is bidirectional.
voidonDestroy(Agent agent) 
voidonReceive(Object msg, Agent sender)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. It is public due to technical reasons.
Override for custom on receive action
voidsend(Object msg)
Sends a message to connected agent.
voidsetArrowLocation(double arrowLocation) 
voidsetArrowStyle(LineArrowStyle arrowStyle) 
voidsetLineColor(Color lineColor) 
voidsetLineStyle(LineStyle lineStyle) 
voidsetLineWidth(double lineWidth) 
voidsetVisible(boolean visible) 

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Methods inherited from interface com.anylogic.engine.AbstractLinkToAgent

getLinkToAgentCommonAnimationSettings, getLinkToAgentMyAnimationSettings, isDeliverToAgent_xjal

Constructor Details

LinkToAgentImpl

public LinkToAgentImpl(A owner,
 LinkToAgentAnimationSettings commonAnimationSettings)

Method Details

getConnectedAgent

public T getConnectedAgent()
Description copied from interface: LinkToAgent
Returns connected agent
Specified by:
getConnectedAgent in interface LinkToAgent<T extends Agent,A extends Agent>
Returns:
connected agent or null if this link isn't connected

isConnected

public boolean isConnected()
Description copied from interface: LinkToAgent
Tests if this link is connected to some agent.
Specified by:
isConnected in interface LinkToAgent<T extends Agent,A extends Agent>
Returns:
true if the link is connected, false otherwise
See Also:

doConnect_xjal

@AnyLogicInternalAPI
public void doConnect_xjal(T a)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. It is public due to technical reasons.
Specified by:
doConnect_xjal in interface AbstractLinkToAgent<T extends Agent,A extends Agent>

doDisconnect_xjal

@AnyLogicInternalAPI
public void doDisconnect_xjal(T a)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. It is public due to technical reasons.
Specified by:
doDisconnect_xjal in interface AbstractLinkToAgent<T extends Agent,A extends Agent>

onReceive

@AnyLogicInternalCodegenAPI
public void onReceive(Object msg,
 Agent sender)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. It is public due to technical reasons.
Override for custom on receive action
Specified by:
onReceive in interface AbstractLinkToAgent<T extends Agent,A extends Agent>

connectTo

public void connectTo(T a)
Description copied from interface: LinkToAgent
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.
Specified by:
connectTo in interface LinkToAgent<T extends Agent,A extends Agent>
Parameters:
a - another agent

disconnect

public boolean disconnect()
Description copied from interface: LinkToAgent
Disconnects this agent from another given agent.
Specified by:
disconnect in interface LinkToAgent<T extends Agent,A extends Agent>
Returns:
true if the agents were connected, false otherwise

send

public void send(Object msg)
Description copied from interface: LinkToAgent
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.
Specified by:
send in interface LinkToAgent<T extends Agent,A extends Agent>
Parameters:
msg - a message

deliver

public void deliver(Object msg)
Specified by:
deliver in interface LinkToAgent<T extends Agent,A extends Agent>
Parameters:
msg - a message

getBidirectionalPeer_xjal

@AnyLogicInternalCodegenAPI
public AbstractLinkToAgent<A,T> getBidirectionalPeer_xjal(T agent)
Description copied from interface: AbstractLinkToAgent
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. It is public due to technical reasons.
Specified by:
getBidirectionalPeer_xjal in interface AbstractLinkToAgent<T extends Agent,A extends Agent>

getOwner

public A getOwner()
Specified by:
getOwner in interface AbstractLinkToAgent<T extends Agent,A extends Agent>

onDestroy

@AnyLogicInternalCodegenAPI
public void onDestroy()
Description copied from interface: AbstractLinkToAgent
Discards the link and disconnects it if it is bidirectional. Must be called when the agent is destroyed.
Specified by:
onDestroy in interface AbstractLinkToAgent<T extends Agent,A extends Agent>

onDestroy

@AnyLogicInternalAPI
public void onDestroy(Agent agent)
Specified by:
onDestroy in interface AgentDestroyListener

getLinkToAgentCommonAnimationSettings

public LinkToAgentAnimationSettings getLinkToAgentCommonAnimationSettings()
Description copied from interface: AbstractLinkToAgent
Returns link animation settings shared by the all the agents having this link.
Changes to these settings apply to drawing of all links of this type
Specified by:
getLinkToAgentCommonAnimationSettings in interface AbstractLinkToAgent<T extends Agent,A extends Agent>
Specified by:
getLinkToAgentCommonAnimationSettings in interface LinkToAgentAnimationSettings
Returns:
shared link animation settings

getLinkToAgentMyAnimationSettings

public LinkToAgentAnimationSettings getLinkToAgentMyAnimationSettings()
Description copied from interface: AbstractLinkToAgent
Returns link animation settings for this particular agent.
Changes to these settings apply to drawing of this link only inside its agent
Specified by:
getLinkToAgentMyAnimationSettings in interface AbstractLinkToAgent<T extends Agent,A extends Agent>
Returns:
link animation settings for this particular agent

isDeliverToAgent_xjal

@AnyLogicInternalCodegenAPI
public boolean isDeliverToAgent_xjal()
Override this function for agent links which should call agent's "On Receive" code (which is defined in a standard 'connections' link). Default implementation returns false
Specified by:
isDeliverToAgent_xjal in interface AbstractLinkToAgent<T extends Agent,A extends Agent>
Returns:
call agent's "On Receive" code or not

isVisible

@AnyLogicInternalAPI
public boolean isVisible()
Specified by:
isVisible in interface LinkToAgentAnimationSettings

setVisible

@AnyLogicInternalAPI
public void setVisible(boolean visible)
Specified by:
setVisible in interface LinkToAgentAnimationSettings

getLineColor

@AnyLogicInternalAPI
public Color getLineColor()
Specified by:
getLineColor in interface LinkToAgentAnimationSettings

setLineColor

@AnyLogicInternalAPI
public void setLineColor(Color lineColor)
Specified by:
setLineColor in interface LinkToAgentAnimationSettings

getLineWidth

@AnyLogicInternalAPI
public double getLineWidth()
Specified by:
getLineWidth in interface LinkToAgentAnimationSettings

setLineWidth

@AnyLogicInternalAPI
public void setLineWidth(double lineWidth)
Specified by:
setLineWidth in interface LinkToAgentAnimationSettings

getLineStyle

@AnyLogicInternalAPI
public LineStyle getLineStyle()
Specified by:
getLineStyle in interface LinkToAgentAnimationSettings

setLineStyle

@AnyLogicInternalAPI
public void setLineStyle(LineStyle lineStyle)
Specified by:
setLineStyle in interface LinkToAgentAnimationSettings

getArrowStyle

@AnyLogicInternalAPI
public LineArrowStyle getArrowStyle()
Specified by:
getArrowStyle in interface LinkToAgentAnimationSettings

setArrowStyle

@AnyLogicInternalAPI
public void setArrowStyle(LineArrowStyle arrowStyle)
Specified by:
setArrowStyle in interface LinkToAgentAnimationSettings

getArrowLocation

@AnyLogicInternalAPI
public double getArrowLocation()
Specified by:
getArrowLocation in interface LinkToAgentAnimationSettings

setArrowLocation

@AnyLogicInternalAPI
public void setArrowLocation(double arrowLocation)
Specified by:
setArrowLocation in interface LinkToAgentAnimationSettings

copyFrom_xjal

@AnyLogicInternalAPI
public void copyFrom_xjal(LinkToAgentAnimationSettings linkToAgentMyAnimationSettings)
Specified by:
copyFrom_xjal in interface LinkToAgentAnimationSettings