Interface AgentGraphNode
- All Superinterfaces:
GeometricGraphNode
- All Known Subinterfaces:
LongAgentGraphNode
- All Known Implementing Classes:
AgentGraphNodeImpl
,LongAgentGraphNodeImpl
,RailNode
Interface to be implemented by all classes that can be values of graph nodes
of
GraphEnvironment
.- Author:
- Andrey Malykhanov
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAgent
(GraphAgent graphAgent) Adds the specified agent to this node, e.g.void
addCallbackPosition
(GeometricGraphPosition position) Adds the specified callback position to this node.void
afterAgentEntered
(GraphAgent graphAgent) Callback method called after an agent enters this node.void
beforeAgentExited
(GraphAgent graphAgent) Callback method called before an agent exits this node.void
Removes all callback positions from this node.boolean
containsAgent
(GraphAgent graphAgent) Checks whether the specified agent is at this node.Returns an unmodifiable list of agents that are currently at this node.Returns an unmodifiable list of all callback positions belonging to this node.void
onAgentReachedPosition
(GraphAgent graphAgent, GeometricGraphPosition position) Callback method called when an agent reaches a callback position belonging to this node.void
removeAgent
(GraphAgent graphAgent) Removes the specified agent from this node, e.g.void
removeCallbackPosition
(GeometricGraphPosition position) Removes the specified callback position previously added byaddCallbackPosition(GeometricGraphPosition)
method, from this node.Methods inherited from interface com.amalgamasimulation.graphagent.GeometricGraphNode
getPoint
-
Method Details
-
addAgent
Adds the specified agent to this node, e.g. when the agent enters this node or jumps to it.- Parameters:
graphAgent
- agent being added
-
removeAgent
Removes the specified agent from this node, e.g. when the agent leaves this node or is completely removed from graph environment.- Parameters:
graphAgent
- agent being removed
-
getAgents
List<GraphAgent> getAgents()Returns an unmodifiable list of agents that are currently at this node.- Returns:
- unmodifiable list of agents that are currently at this node
-
containsAgent
Checks whether the specified agent is at this node.- Parameters:
graphAgent
- specified agent- Returns:
true
if this agent is at this node,false
otherwise
-
addCallbackPosition
Adds the specified callback position to this node. AonAgentReachedPosition(GraphAgent, GeometricGraphPosition)
will be called every time an agent reaches this node.- Parameters:
position
- specified callback position- See Also:
-
removeCallbackPosition
Removes the specified callback position previously added byaddCallbackPosition(GeometricGraphPosition)
method, from this node. Does nothing if the specified callback position does not belong to this node.- Parameters:
position
- callback position being removed- See Also:
-
clearCallbackPositions
void clearCallbackPositions()Removes all callback positions from this node.- See Also:
-
getCallbackPositions
List<GeometricGraphPosition> getCallbackPositions()Returns an unmodifiable list of all callback positions belonging to this node.- Returns:
- unmodifiable list of all callback positions belonging to this node
-
afterAgentEntered
Callback method called after an agent enters this node.- Parameters:
graphAgent
- agent that have just entered this node
-
beforeAgentExited
Callback method called before an agent exits this node.- Parameters:
graphAgent
- agent that is about to exit this node
-
onAgentReachedPosition
Callback method called when an agent reaches a callback position belonging to this node.- Parameters:
graphAgent
- agent that have reached the specified callback positionposition
- the position that have been reached
-