Package com.anylogic.engine
- Constructor Summary
- Method Summary
- Constructor Details
- Method Details
- getConnections
- getConnectionsNumber
- size
- getConnectedAgent
- getRandomConnectedAgent
- connectTo
- isConnectedTo
- disconnectFrom
- disconnectFromAll
- send
- sendToAllConnected
- sendToRandomConnected
- deliver
- deliverToAllConnected
- deliverToRandomConnected
- doConnect_xjal
- doDisconnect_xjal
- onReceive
- getBidirectionalPeer_xjal
- getOwner
- onDestroy
- getLinkToAgentCommonAnimationSettings
- getLinkToAgentMyAnimationSettings
- isDeliverToAgent_xjal
- isVisible
- setVisible
- getLineColor
- setLineColor
- getLineWidth
- setLineWidth
- getLineStyle
- setLineStyle
- getArrowStyle
- setArrowStyle
- getArrowLocation
- setArrowLocation
- copyFrom_xjal
- onDestroy
- java.lang.Object
- com.anylogic.engine.LinkToAgentStandardImpl<T,
- All Implemented Interfaces:
AbstractLinkToAgent<T,
,A> AgentDestroyListener
,LinkToAgentAnimationSettings
,LinkToAgentCollection<T,
,A> Serializable
public class LinkToAgentStandardImpl<T extends Agent,A extends Agent> extends Object implements LinkToAgentCollection<T,A>
- See Also:
- Serialized Form
Constructor | Description |
---|---|
LinkToAgentStandardImpl |
Modifier and Type | Method | Description |
---|---|---|
boolean | connectTo |
Creates a connection to a given other agent.
|
void | copyFrom_xjal | |
void | deliver | |
void | deliverToAllConnected | |
void | deliverToRandomConnected | |
boolean | disconnectFrom |
Disconnects this agent from another given agent.
|
void | disconnectFromAll() |
Disconnects the agent from all other agents.
|
void | doConnect_xjal |
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 |
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, | getBidirectionalPeer_xjal |
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 the connected agent with a given index.
|
List<T> | getConnections() |
Returns a collection of agents connected to this agent (bi-directionally),
or empty collection if there have not been any connections yet.
|
int | getConnectionsNumber() |
Returns the number of agents connected to this agent.
|
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() | |
T | getRandomConnectedAgent() |
Returns the randomly chosen connected agent.
|
boolean | isConnectedTo |
Tests if this agent is connected to a given other 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 | |
void | onReceive |
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 |
Sends a message to a given agent.
|
void | sendToAllConnected |
Sends a message to all connected agents.
|
void | sendToRandomConnected |
Sends a message to a randomly chosen connected agent.
|
void | setArrowLocation | |
void | setArrowStyle | |
void | setLineColor | |
void | setLineStyle | |
void | setLineWidth | |
void | setVisible | |
int | size() |
Returns the number of agents connected to this agent.
The same as LinkToAgentCollection.getConnectionsNumber() |
public LinkToAgentStandardImpl(A owner, LinkToAgentAnimationSettings commonAnimationSettings)
public List<T> getConnections()
Description copied from interface:
LinkToAgentCollection
Returns a collection of agents connected to this agent (bi-directionally),
or empty collection if there have not been any connections yet. You should not
modify this collection.
- Specified by:
getConnections
in interfaceLinkToAgentCollection<T extends Agent,
A extends Agent> - Returns:
- collection of connected agents, may be empty
public int getConnectionsNumber()
Description copied from interface:
LinkToAgentCollection
Returns the number of agents connected to this agent.
- Specified by:
getConnectionsNumber
in interfaceLinkToAgentCollection<T extends Agent,
A extends Agent> - Returns:
- the number of agents connected to this agent
public int size()
Description copied from interface:
LinkToAgentCollection
Returns the number of agents connected to this agent.
The same as
The same as
LinkToAgentCollection.getConnectionsNumber()
public T getConnectedAgent(int index)
Description copied from interface:
LinkToAgentCollection
Returns the connected agent with a given index.
- Specified by:
getConnectedAgent
in interfaceLinkToAgentCollection<T extends Agent,
A extends Agent> - Parameters:
index
- the index of connection- Returns:
- the connected agent with a given index
public T getRandomConnectedAgent()
Description copied from interface:
LinkToAgentCollection
Returns the randomly chosen connected agent.
- Specified by:
getRandomConnectedAgent
in interfaceLinkToAgentCollection<T extends Agent,
A extends Agent> - Returns:
- the connected agent
public boolean connectTo(T a)
Description copied from interface:
LinkToAgentCollection
Creates a connection to a given other agent. Raises error if you try
to connect to itself. Does
nothing and returns
false
if agents are already connected.public boolean isConnectedTo(Agent a)
Description copied from interface:
LinkToAgentCollection
Tests if this agent is connected to a given other agent.
- Specified by:
isConnectedTo
in interfaceLinkToAgentCollection<T extends Agent,
A extends Agent> - Parameters:
a
- another agent- Returns:
true
if the agents are connected,false
otherwise
public boolean disconnectFrom(Agent a)
Description copied from interface:
LinkToAgentCollection
Disconnects this agent from another given agent.
- Specified by:
disconnectFrom
in interfaceLinkToAgentCollection<T extends Agent,
A extends Agent> - Parameters:
a
- another agent- Returns:
true
if the agents were connected,false
otherwise
public void disconnectFromAll()
Description copied from interface:
LinkToAgentCollection
Disconnects the agent from all other agents.
- Specified by:
disconnectFromAll
in interfaceLinkToAgentCollection<T extends Agent,
A extends Agent>
public void send(Object msg, T dest)
Description copied from interface:
LinkToAgentCollection
Sends a message to a given 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
LinkToAgentCollection.deliver(Object, Agent)
method, which has better performance.public void sendToAllConnected(Object msg)
Description copied from interface:
LinkToAgentCollection
Sends a message to all connected agents.
The message will be delivered during a separate event
scheduled to occur in zero time after the current one.
- Specified by:
sendToAllConnected
in interfaceLinkToAgentCollection<T extends Agent,
A extends Agent> - Parameters:
msg
- a message
public void sendToRandomConnected(Object msg)
Description copied from interface:
LinkToAgentCollection
Sends a message to a randomly chosen connected agent.
The message will be delivered during a separate event
scheduled to occur in zero time after the current one.
- Specified by:
sendToRandomConnected
in interfaceLinkToAgentCollection<T extends Agent,
A extends Agent> - Parameters:
msg
- a message
public void deliver(Object msg, T dest)
public void deliverToAllConnected(Object msg)
- Specified by:
deliverToAllConnected
in interfaceLinkToAgentCollection<T extends Agent,
A extends Agent> - Parameters:
msg
- the message
public void deliverToRandomConnected(Object msg)
- Specified by:
deliverToRandomConnected
in interfaceLinkToAgentCollection<T extends Agent,
A extends Agent> - Parameters:
msg
- a message
@AnyLogicInternalAPI public void doConnect_xjal(T a)
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:
doConnect_xjal
in interfaceAbstractLinkToAgent<T extends Agent,
A extends Agent>
@AnyLogicInternalAPI public void doDisconnect_xjal(T a)
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:
doDisconnect_xjal
in interfaceAbstractLinkToAgent<T extends Agent,
A extends Agent>
@AnyLogicInternalCodegenAPI public void onReceive(Object msg, Agent sender)
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.
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
@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.
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 Color getLineColor()
- Specified by:
getLineColor
in interfaceLinkToAgentAnimationSettings
@AnyLogicInternalAPI public void setLineColor(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
@AnyLogicInternalAPI public void onDestroy(Agent agent)
- Specified by:
onDestroy
in interfaceAgentDestroyListener