public class LinkToAgentStandardImpl<T extends Agent,A extends Agent> extends java.lang.Object implements LinkToAgentCollection<T,A>
Constructor and Description |
---|
LinkToAgentStandardImpl(A owner,
LinkToAgentAnimationSettings commonAnimationSettings) |
Modifier and Type | Method and Description |
---|---|
boolean |
connectTo(T a)
Creates a connection to a given other agent.
|
void |
copyFrom_xjal(LinkToAgentAnimationSettings linkToAgentMyAnimationSettings) |
void |
deliver(java.lang.Object msg,
T dest)
Delivers a message to a given agent immediately during this method call.
|
void |
deliverToAllConnected(java.lang.Object msg)
Delivers a message to all connected agents.
|
void |
deliverToRandomConnected(java.lang.Object msg)
Delivers a message to a randomly chosen connected agent.
|
boolean |
disconnectFrom(Agent a)
Disconnects this agent from another given agent.
|
void |
disconnectFromAll()
Disconnects the agent from all other agents.
|
void |
doConnect_xjal(T a)
This method is internal and shouldn't be called by user.
|
void |
doDisconnect_xjal(T a)
This method is internal and shouldn't be called by user.
|
double |
getArrowLocation() |
LineArrowStyle |
getArrowStyle() |
AbstractLinkToAgent<A,T> |
getBidirectionalPeer_xjal(T agent)
This method is internal and shouldn't be called by user.
|
T |
getConnectedAgent(int index)
Returns the connected agent with a given index.
|
java.util.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.
|
java.awt.Color |
getLineColor() |
LineStyle |
getLineStyle() |
double |
getLineWidth() |
LinkToAgentAnimationSettings |
getLinkToAgentCommonAnimationSettings()
Returns link animation settings shared by the all the agents having this link.
|
LinkToAgentAnimationSettings |
getLinkToAgentMyAnimationSettings()
Returns link animation settings for this particular agent.
|
A |
getOwner() |
T |
getRandomConnectedAgent()
Returns the randomly chosen connected agent.
|
boolean |
isConnectedTo(Agent a)
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(Agent agent) |
void |
onReceive(java.lang.Object msg,
Agent sender)
This method is internal and shouldn't be called by user.
|
void |
send(java.lang.Object msg,
T dest)
Sends a message to a given agent.
|
void |
sendToAllConnected(java.lang.Object msg)
Sends a message to all connected agents.
|
void |
sendToRandomConnected(java.lang.Object msg)
Sends a message to a randomly chosen 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) |
int |
size()
Returns the number of agents connected to this agent.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
disconnectByCondition
getLinkToAgentCommonAnimationSettings, getLinkToAgentMyAnimationSettings, isDeliverToAgent_xjal
public LinkToAgentStandardImpl(A owner, LinkToAgentAnimationSettings commonAnimationSettings)
public java.util.List<T> getConnections()
LinkToAgentCollection
getConnections
in interface LinkToAgentCollection<T extends Agent,A extends Agent>
public int getConnectionsNumber()
LinkToAgentCollection
getConnectionsNumber
in interface LinkToAgentCollection<T extends Agent,A extends Agent>
public int size()
LinkToAgentCollection
LinkToAgentCollection.getConnectionsNumber()
public T getConnectedAgent(int index)
LinkToAgentCollection
getConnectedAgent
in interface LinkToAgentCollection<T extends Agent,A extends Agent>
index
- the index of connectionpublic T getRandomConnectedAgent()
LinkToAgentCollection
getRandomConnectedAgent
in interface LinkToAgentCollection<T extends Agent,A extends Agent>
public boolean connectTo(T a)
LinkToAgentCollection
false
if agents are already connected.public boolean isConnectedTo(Agent a)
LinkToAgentCollection
isConnectedTo
in interface LinkToAgentCollection<T extends Agent,A extends Agent>
a
- another agenttrue
if the agents are connected, false
otherwisepublic boolean disconnectFrom(Agent a)
LinkToAgentCollection
disconnectFrom
in interface LinkToAgentCollection<T extends Agent,A extends Agent>
a
- another agenttrue
if the agents were connected, false
otherwisepublic void disconnectFromAll()
LinkToAgentCollection
disconnectFromAll
in interface LinkToAgentCollection<T extends Agent,A extends Agent>
public void send(java.lang.Object msg, T dest)
LinkToAgentCollection
LinkToAgentCollection.deliver(Object, Agent)
method, which has better performance.public void sendToAllConnected(java.lang.Object msg)
LinkToAgentCollection
LinkToAgentCollection.deliverToAllConnected(Object)
method, which has better performance.sendToAllConnected
in interface LinkToAgentCollection<T extends Agent,A extends Agent>
msg
- a messagepublic void sendToRandomConnected(java.lang.Object msg)
LinkToAgentCollection
LinkToAgentCollection.deliverToRandomConnected(Object)
method, which has better performance.sendToRandomConnected
in interface LinkToAgentCollection<T extends Agent,A extends Agent>
msg
- a messagepublic void deliver(java.lang.Object msg, T dest)
LinkToAgentCollection
LinkToAgentCollection.send(Object, Agent)
method.public void deliverToAllConnected(java.lang.Object msg)
LinkToAgentCollection
LinkToAgentCollection.sendToAllConnected(Object)
method.deliverToAllConnected
in interface LinkToAgentCollection<T extends Agent,A extends Agent>
msg
- the messagepublic void deliverToRandomConnected(java.lang.Object msg)
LinkToAgentCollection
LinkToAgentCollection.sendToRandomConnected(Object)
method.deliverToRandomConnected
in interface LinkToAgentCollection<T extends Agent,A extends Agent>
msg
- a message@AnyLogicInternalAPI public void doConnect_xjal(T a)
AbstractLinkToAgent
doConnect_xjal
in interface AbstractLinkToAgent<T extends Agent,A extends Agent>
@AnyLogicInternalAPI public void doDisconnect_xjal(T a)
AbstractLinkToAgent
doDisconnect_xjal
in interface AbstractLinkToAgent<T extends Agent,A extends Agent>
@AnyLogicInternalCodegenAPI public void onReceive(java.lang.Object msg, Agent sender)
AbstractLinkToAgent
@AnyLogicInternalCodegenAPI public AbstractLinkToAgent<A,T> getBidirectionalPeer_xjal(T agent)
AbstractLinkToAgent
getBidirectionalPeer_xjal
in interface AbstractLinkToAgent<T extends Agent,A extends Agent>
public A getOwner()
@AnyLogicInternalCodegenAPI public void onDestroy()
AbstractLinkToAgent
public LinkToAgentAnimationSettings getLinkToAgentCommonAnimationSettings()
AbstractLinkToAgent
getLinkToAgentCommonAnimationSettings
in interface AbstractLinkToAgent<T extends Agent,A extends Agent>
getLinkToAgentCommonAnimationSettings
in interface LinkToAgentAnimationSettings
public LinkToAgentAnimationSettings getLinkToAgentMyAnimationSettings()
AbstractLinkToAgent
getLinkToAgentMyAnimationSettings
in interface AbstractLinkToAgent<T extends Agent,A extends Agent>
@AnyLogicInternalCodegenAPI public boolean isDeliverToAgent_xjal()
false
isDeliverToAgent_xjal
in interface AbstractLinkToAgent<T extends Agent,A extends Agent>
@AnyLogicInternalAPI public boolean isVisible()
isVisible
in interface LinkToAgentAnimationSettings
@AnyLogicInternalAPI public void setVisible(boolean visible)
setVisible
in interface LinkToAgentAnimationSettings
@AnyLogicInternalAPI public java.awt.Color getLineColor()
getLineColor
in interface LinkToAgentAnimationSettings
@AnyLogicInternalAPI public void setLineColor(java.awt.Color lineColor)
setLineColor
in interface LinkToAgentAnimationSettings
@AnyLogicInternalAPI public double getLineWidth()
getLineWidth
in interface LinkToAgentAnimationSettings
@AnyLogicInternalAPI public void setLineWidth(double lineWidth)
setLineWidth
in interface LinkToAgentAnimationSettings
@AnyLogicInternalAPI public LineStyle getLineStyle()
getLineStyle
in interface LinkToAgentAnimationSettings
@AnyLogicInternalAPI public void setLineStyle(LineStyle lineStyle)
setLineStyle
in interface LinkToAgentAnimationSettings
@AnyLogicInternalAPI public LineArrowStyle getArrowStyle()
getArrowStyle
in interface LinkToAgentAnimationSettings
@AnyLogicInternalAPI public void setArrowStyle(LineArrowStyle arrowStyle)
setArrowStyle
in interface LinkToAgentAnimationSettings
@AnyLogicInternalAPI public double getArrowLocation()
getArrowLocation
in interface LinkToAgentAnimationSettings
@AnyLogicInternalAPI public void setArrowLocation(double arrowLocation)
setArrowLocation
in interface LinkToAgentAnimationSettings
@AnyLogicInternalAPI public void copyFrom_xjal(LinkToAgentAnimationSettings linkToAgentMyAnimationSettings)
copyFrom_xjal
in interface LinkToAgentAnimationSettings
@AnyLogicInternalAPI public void onDestroy(Agent agent)
onDestroy
in interface AgentDestroyListener
Copyright © AnyLogic North America, LLC. All Rights Reserved.