Package com.anylogic.engine
- Constructor Summary
- Method Summary
- Methods inherited from class java.lang.Object
- Methods inherited from interface com.anylogic.engine.AbstractLinkToAgent
- Constructor Detail
- Method Detail
- getConnectedAgent
- isConnected
- doConnect_xjal
- doDisconnect_xjal
- onReceive
- connectTo
- disconnect
- send
- deliver
- getBidirectionalPeer_xjal
- getOwner
- onDestroy
- onDestroy
- getLinkToAgentCommonAnimationSettings
- getLinkToAgentMyAnimationSettings
- isDeliverToAgent_xjal
- isVisible
- setVisible
- getLineColor
- setLineColor
- getLineWidth
- setLineWidth
- getLineStyle
- setLineStyle
- getArrowStyle
- setArrowStyle
- getArrowLocation
- setArrowLocation
- copyFrom_xjal
- java.lang.Object
-
- com.anylogic.engine.LinkToAgentImpl<T,A>
- All Implemented Interfaces:
AbstractLinkToAgent<T,A>
,AgentDestroyListener
,LinkToAgent<T,A>
,LinkToAgentAnimationSettings
,java.io.Serializable
public class LinkToAgentImpl<T extends Agent,A extends Agent> extends java.lang.Object implements LinkToAgent<T,A>
- See Also:
- Serialized Form
LinkToAgentImpl(A owner,
LinkToAgentAnimationSettings commonAnimationSettings) |
|
Constructor | Description |
---|
void |
connectTo(T a) |
Creates a uni-directional connection between this agent and a given
other agent.
|
void |
copyFrom_xjal(LinkToAgentAnimationSettings linkToAgentMyAnimationSettings) |
|
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.
|
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. |
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. |
double |
getArrowLocation() |
|
LineArrowStyle |
getArrowStyle() |
|
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. |
T |
getConnectedAgent() |
Returns connected agent
|
java.awt.Color |
getLineColor() |
|
LineStyle |
getLineStyle() |
|
double |
getLineWidth() |
|
LinkToAgentAnimationSettings |
getLinkToAgentCommonAnimationSettings() |
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 |
LinkToAgentAnimationSettings |
getLinkToAgentMyAnimationSettings() |
Returns link animation settings for this particular agent.
Changes to these settings apply to drawing of this link only inside its agent |
A |
getOwner() |
|
boolean |
isConnected() |
Tests if this link is connected to some agent.
|
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).
|
boolean |
isVisible() |
|
void |
onDestroy() |
Discards the link and disconnects it if it is bidirectional.
|
void |
onDestroy(Agent agent) |
|
void |
onReceive(java.lang.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 |
void |
send(java.lang.Object msg) |
Sends a message to connected agent.
|
void |
setArrowLocation(double arrowLocation) |
|
void |
setArrowStyle(LineArrowStyle arrowStyle) |
|
void |
setLineColor(java.awt.Color lineColor) |
|
void |
setLineStyle(LineStyle lineStyle) |
|
void |
setLineWidth(double lineWidth) |
|
void |
setVisible(boolean visible) |
|
Modifier and Type | Method | Description |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getLinkToAgentCommonAnimationSettings, getLinkToAgentMyAnimationSettings, isDeliverToAgent_xjal
public LinkToAgentImpl(A owner, LinkToAgentAnimationSettings commonAnimationSettings)
public T getConnectedAgent()
Description copied from interface:
LinkToAgent
Returns connected agent
- Specified by:
getConnectedAgent
in interfaceLinkToAgent<T extends Agent,A extends Agent>
- Returns:
- connected agent or
null
if this link isn't connected
public boolean isConnected()
Description copied from interface:
LinkToAgent
Tests if this link is connected to some agent.
- Specified by:
isConnected
in interfaceLinkToAgent<T extends Agent,A extends Agent>
- Returns:
true
if the link is connected,false
otherwise- See Also:
LinkToAgent.getConnectedAgent()
@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.
it may be removed/renamed in future. It is public due to technical reasons.
- Specified by:
doConnect_xjal
in interfaceAbstractLinkToAgent<T extends Agent,A extends Agent>
@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.
it may be removed/renamed in future. It is public due to technical reasons.
- Specified by:
doDisconnect_xjal
in interfaceAbstractLinkToAgent<T extends Agent,A extends Agent>
@AnyLogicInternalCodegenAPI public void onReceive(java.lang.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
it may be removed/renamed in future. It is public due to technical reasons.
Override for custom on receive action
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 interfaceLinkToAgent<T extends Agent,A extends Agent>
- Parameters:
a
- another agent
public boolean disconnect()
Description copied from interface:
LinkToAgent
Disconnects this agent from another given agent.
- Specified by:
disconnect
in interfaceLinkToAgent<T extends Agent,A extends Agent>
- Returns:
true
if the agents were connected,false
otherwise
public void send(java.lang.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.
If you are OK with the message delivered immediately during this event,
use deliver() method, which has better performance.
- Specified by:
send
in interfaceLinkToAgent<T extends Agent,A extends Agent>
- Parameters:
msg
- a message
public void deliver(java.lang.Object msg)
Description copied from interface:
LinkToAgent
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.
- Specified by:
deliver
in interfaceLinkToAgent<T extends Agent,A extends Agent>
- Parameters:
msg
- a message
@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.
it may be removed/renamed in future. It is public due to technical reasons.
- Specified by:
getBidirectionalPeer_xjal
in interfaceAbstractLinkToAgent<T extends Agent,A extends Agent>
public A getOwner()
@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.
@AnyLogicInternalAPI public void onDestroy(Agent agent)
- Specified by:
onDestroy
in interfaceAgentDestroyListener
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
Changes to these settings apply to drawing of all links of this type
- Specified by:
getLinkToAgentCommonAnimationSettings
in interfaceAbstractLinkToAgent<T extends Agent,A extends Agent>
- Specified by:
getLinkToAgentCommonAnimationSettings
in interfaceLinkToAgentAnimationSettings
- Returns:
- shared link animation settings
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
Changes to these settings apply to drawing of this link only inside its agent
- Specified by:
getLinkToAgentMyAnimationSettings
in interfaceAbstractLinkToAgent<T extends Agent,A extends Agent>
- Returns:
- link animation settings for this particular agent
@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 interfaceAbstractLinkToAgent<T extends Agent,A extends Agent>
- Returns:
- call agent's "On Receive" code or not
@AnyLogicInternalAPI public boolean isVisible()
- Specified by:
isVisible
in interfaceLinkToAgentAnimationSettings
@AnyLogicInternalAPI public void setVisible(boolean visible)
- Specified by:
setVisible
in interfaceLinkToAgentAnimationSettings
@AnyLogicInternalAPI public java.awt.Color getLineColor()
- Specified by:
getLineColor
in interfaceLinkToAgentAnimationSettings
@AnyLogicInternalAPI public void setLineColor(java.awt.Color lineColor)
- Specified by:
setLineColor
in interfaceLinkToAgentAnimationSettings
@AnyLogicInternalAPI public double getLineWidth()
- Specified by:
getLineWidth
in interfaceLinkToAgentAnimationSettings
@AnyLogicInternalAPI public void setLineWidth(double lineWidth)
- Specified by:
setLineWidth
in interfaceLinkToAgentAnimationSettings
@AnyLogicInternalAPI public LineStyle getLineStyle()
- Specified by:
getLineStyle
in interfaceLinkToAgentAnimationSettings
@AnyLogicInternalAPI public void setLineStyle(LineStyle lineStyle)
- Specified by:
setLineStyle
in interfaceLinkToAgentAnimationSettings
@AnyLogicInternalAPI public LineArrowStyle getArrowStyle()
- Specified by:
getArrowStyle
in interfaceLinkToAgentAnimationSettings
@AnyLogicInternalAPI public void setArrowStyle(LineArrowStyle arrowStyle)
- Specified by:
setArrowStyle
in interfaceLinkToAgentAnimationSettings
@AnyLogicInternalAPI public double getArrowLocation()
- Specified by:
getArrowLocation
in interfaceLinkToAgentAnimationSettings
@AnyLogicInternalAPI public void setArrowLocation(double arrowLocation)
- Specified by:
setArrowLocation
in interfaceLinkToAgentAnimationSettings
@AnyLogicInternalAPI public void copyFrom_xjal(LinkToAgentAnimationSettings linkToAgentMyAnimationSettings)
- Specified by:
copyFrom_xjal
in interfaceLinkToAgentAnimationSettings
-
How can we improve this article?
-