Package com.anylogic.engine
- Field Summary
- Method Summary
- Method Details
- getEnvironment
- getConnections
- getConnectionsNumber
- getConnectedAgent
- getRandomConnectedAgent
- isConnectedTo
- connectTo
- disconnectFrom
- disconnectFromAll
- send
- send
- deliver
- deliver
- receive
- agentInfo
- getSpaceType
- setEnvironment_xjal
- addConnection_xjal
- removeConnection_xjal
- restoreConnections_xjal
- copyToAndDestroyOnSpaceTypeChange_xjal
- All Superinterfaces:
AgentExtension
,Serializable
- All Known Subinterfaces:
ExtAgentContinuous
,ExtAgentDiscrete
,ExtAgentGIS
- All Known Implementing Classes:
ExtAgentContinuousDelegate
,ExtEntityContinuousDelegate
public interface ExtAgentInteractive extends AgentExtension
An extension of
- time (continuous or discrete)
- connections between agents, networks (e.g. social) and their visualisation
- communication - message passing and broadcasting
Also, there are several extension classes for different space types.
Agent
designed to support agent communication,
in particular:- time (continuous or discrete)
- connections between agents, networks (e.g. social) and their visualisation
- communication - message passing and broadcasting
Also, there are several extension classes for different space types.
- Author:
- AnyLogic North America, LLC https://anylogic.com
Modifier and Type | Method | Description |
---|---|---|
void | addConnection_xjal |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future |
String | agentInfo() | |
boolean | connectTo |
Creates a bi-directional connection between this agent and a given
other agent.
|
void | copyToAndDestroyOnSpaceTypeChange_xjal | |
void | deliver |
Delivers a message to a given agent immediately during this method call.
|
void | deliver |
Delivers a message to an agent or a group of agents, as specified by the
mode parameter immediately during this method call.
|
boolean | disconnectFrom |
Disconnects this agent from another given agent.
|
void | disconnectFromAll() |
Disconnects the agent from all other agents.
|
Agent | getConnectedAgent |
Returns the connected agent with a given index.
|
<T extends Agent> | 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.
|
Agent | getEnvironment() |
Returns the environment where this agent belongs to.
|
Agent | getRandomConnectedAgent() |
Returns the randomly chosen connected agent.
|
SpaceType | getSpaceType() |
Returns the type of space this agent lives in, one of
SPACE_CONTINUOUS, SPACE_DISCRETE, SPACE_GIS, SPACE_NONE |
boolean | isConnectedTo |
Tests if this agent is connected to a given other agent.
|
void | receive |
Immediately delivers a message to this agent.
|
void | removeConnection_xjal |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future |
void | restoreConnections_xjal |
Deprecated.
|
void | send |
Sends a message to a given agent.
|
void | send |
Sends a message to an agent or a group of agents, as specified by the
mode parameter.
|
void | setEnvironment_xjal |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future |
Agent getEnvironment()
Returns the environment where this agent belongs to.
- Returns:
- the environment where this agent belongs to
<T extends Agent> 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. You should not
modify this collection.
- Returns:
- collection of connected agents, may be empty
int getConnectionsNumber()
Returns the number of agents connected to this agent.
- Returns:
- the number of agents connected to this agent
Agent getConnectedAgent(int index)
Returns the connected agent with a given index.
- Parameters:
index
- the index of connection- Returns:
- the connected agent with a given index
Agent getRandomConnectedAgent()
Returns the randomly chosen connected agent.
- Returns:
- the connected agent
boolean isConnectedTo(Agent a)
Tests if this agent is connected to a given other agent.
- Parameters:
a
- another agent- Returns:
true
if the agents are connected,false
otherwise
boolean connectTo(Agent a)
Creates a bi-directional connection between this agent and a given
other agent. Raises error if you try to connect to itself. Does
nothing and returns
false
if agents are already connected.- Parameters:
a
- another agent- Returns:
true
if was not connected before,false
if was already connected
boolean disconnectFrom(Agent a)
Disconnects this agent from another given agent.
- Parameters:
a
- another agent- Returns:
true
if the agents were connected,false
otherwise
void disconnectFromAll()
Disconnects the agent from all other agents.
void send(Object msg, Agent dest)
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 deliver() method, which has better performance.
- Parameters:
msg
- a messagedest
- the destination agent
void send(Object msg, MessageDeliveryType mode)
Sends a message to an agent or a group of agents, as specified by the
mode parameter. 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 messagemode
- specifies the message sending mode (ALL, RANDOM, ...)
void deliver(Object msg, Agent dest)
Delivers a message to a given agent immediately during this method call.
If you wish this to happen in a separate event, use send() method.
- Parameters:
msg
- a messagedest
- the destination agent
void deliver(Object msg, MessageDeliveryType mode)
Delivers a message to an agent or a group of agents, as specified by the
mode parameter immediately during this method call.
If you wish this to happen in a separate event, use send() method.
- Parameters:
msg
- the messagemode
- specifies the message sending mode (ALL, RANDOM, ...)
void receive(Object msg)
Immediately delivers a message to this agent. Sender is set to null.
- Parameters:
msg
- the message
String agentInfo()
SpaceType getSpaceType()
Returns the type of space this agent lives in, one of
SPACE_CONTINUOUS, SPACE_DISCRETE, SPACE_GIS, SPACE_NONE
- Returns:
- one of
SPACE_CONTINUOUS, SPACE_DISCRETE, SPACE_GIS, SPACE_NONE
@AnyLogicInternalAPI void setEnvironment_xjal(Agent environment)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future
it may be removed/renamed in future
- Parameters:
environment
-
@AnyLogicInternalAPI void addConnection_xjal(Agent a)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future
it may be removed/renamed in future
@AnyLogicInternalAPI void removeConnection_xjal(Agent a)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future
it may be removed/renamed in future
@AnyLogicInternalAPI @Deprecated void restoreConnections_xjal(List<?> connections)
Deprecated.
This method is internal and shouldn't be called by user.
it may be removed/renamed in future
it may be removed/renamed in future
@AnyLogicInternalAPI void copyToAndDestroyOnSpaceTypeChange_xjal(ExtAgentInteractive newExt)