public interface ExtAgentInteractive extends AgentExtension
Agent
designed to support agent communication,
in particular:P_AGENT_INTERACTIVE_DELEGATE, P_AGENT_WITH_SPATIAL_METRICS_DELEGATE, P_AGENT_WITH_SPECIFIC_SPACE, P_AGENT_WITH_SPECIFIC_SPACE_DELEGATE, P_ENTITY_DELEGATE, P_ENV_WITH_SPECIFIC_SPACE, P_ROOT, P_SPACE, P_USER_EXT
Modifier and Type | Method and Description |
---|---|
void |
addConnection_xjal(Agent a)
This method is internal and shouldn't be called by user.
|
java.lang.String |
agentInfo() |
boolean |
connectTo(Agent a)
Creates a bi-directional connection between this agent and a given
other agent.
|
void |
copyToAndDestroyOnSpaceTypeChange_xjal(ExtAgentInteractive newExt) |
void |
deliver(java.lang.Object msg,
Agent dest)
Delivers a message to a given agent immediately during this method call.
|
void |
deliver(java.lang.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.
|
boolean |
disconnectFrom(Agent a)
Disconnects this agent from another given agent.
|
void |
disconnectFromAll()
Disconnects the agent from all other agents.
|
Agent |
getConnectedAgent(int index)
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(Agent a)
Tests if this agent is connected to a given other agent.
|
void |
receive(java.lang.Object msg)
Immediately delivers a message to this agent.
|
void |
removeConnection_xjal(Agent a)
This method is internal and shouldn't be called by user.
|
void |
restoreConnections_xjal(java.util.List<?> connections)
Deprecated.
|
void |
send(java.lang.Object msg,
Agent dest)
Sends a message to a given agent.
|
void |
send(java.lang.Object msg,
MessageDeliveryType mode)
Sends a message to an agent or a group of agents, as specified by the
mode parameter.
|
void |
setEnvironment_xjal(Agent environment)
This method is internal and shouldn't be called by user.
|
getAgent, next_xjal, onDestroy, onExtensionRemoved, priority, setNext_xjal, supportsInterface_xjal
Agent getEnvironment()
<T extends Agent> java.util.List<T> getConnections()
int getConnectionsNumber()
Agent getConnectedAgent(int index)
index
- the index of connectionAgent getRandomConnectedAgent()
boolean isConnectedTo(Agent a)
a
- another agenttrue
if the agents are connected, false
otherwiseboolean connectTo(Agent a)
false
if agents are already connected.a
- another agenttrue
if was not connected before,
false
if was already connectedboolean disconnectFrom(Agent a)
a
- another agenttrue
if the agents were connected, false
otherwisevoid disconnectFromAll()
void send(java.lang.Object msg, Agent dest)
msg
- a messagedest
- the destination agentvoid send(java.lang.Object msg, MessageDeliveryType mode)
msg
- a messagemode
- specifies the message sending mode (ALL, RANDOM, ...)void deliver(java.lang.Object msg, Agent dest)
msg
- a messagedest
- the destination agentvoid deliver(java.lang.Object msg, MessageDeliveryType mode)
msg
- the messagemode
- specifies the message sending mode (ALL, RANDOM, ...)void receive(java.lang.Object msg)
msg
- the messagejava.lang.String agentInfo()
SpaceType getSpaceType()
SPACE_CONTINUOUS, SPACE_DISCRETE, SPACE_GIS, SPACE_NONE
SPACE_CONTINUOUS, SPACE_DISCRETE, SPACE_GIS, SPACE_NONE
@AnyLogicInternalAPI void setEnvironment_xjal(Agent environment)
environment
- @AnyLogicInternalAPI void addConnection_xjal(Agent a)
@AnyLogicInternalAPI void removeConnection_xjal(Agent a)
@AnyLogicInternalAPI @Deprecated void restoreConnections_xjal(java.util.List<?> connections)
@AnyLogicInternalAPI void copyToAndDestroyOnSpaceTypeChange_xjal(ExtAgentInteractive newExt)
Copyright © AnyLogic North America, LLC. All Rights Reserved.