Interface AgentGraphArc

All Superinterfaces:
GeometricGraphArc
All Known Subinterfaces:
LongAgentGraphArc
All Known Implementing Classes:
AgentGraphArcImpl, LongAgentGraphArcImpl, RailArc

public interface AgentGraphArc extends GeometricGraphArc
Interface to be implemented by all classes that can be values of graph arcs of GraphEnvironment.
Author:
Andrey Malykhanov
  • Method Details

    • getReverseArc

      AgentGraphArc getReverseArc()
      Description copied from interface: GeometricGraphArc
      Returns the arc that is a reverse to this one, or null if this is a one-way arc.
      Specified by:
      getReverseArc in interface GeometricGraphArc
      Returns:
      reverse arc, or null
    • addAgent

      void addAgent(GraphAgent<?,?> graphAgent)
      Adds the specified agent to this arc, e.g. when the agent enters this arc or jumps to it.
      Parameters:
      graphAgent - agent being added
    • removeAgent

      void removeAgent(GraphAgent<?,?> graphAgent)
      Removes the specified agent from this arc, e.g. when the agent leaves this arc or is completely removed from graph environment.
      Parameters:
      graphAgent - agent being removed
    • onAgentVelocityChanged

      void onAgentVelocityChanged(GraphAgent<?,?> graphAgent)
      Callback method called immediately after velocity of the specified agent located on this arc changes.
      Parameters:
      graphAgent - agent whose velocity has just been changed
    • recalculateAgents

      void recalculateAgents(GraphAgent<?,?> exceptAgent, boolean recalculateReverseArc)
      Recalculates the internal events (specifically, events of reaching other agents) for all agents on this arc, except for the specified one.
      Parameters:
      exceptAgent - agent for which the recalculation is not performed
      recalculateReverseArc - whether or not to recalculate agents on the reverse arc, if any
    • getAgents

      List<GraphAgent<?,?>> getAgents()
      Returns an unmodifiable list of agents that are currently on this arc.
      Returns:
      unmodifiable list of agents that are currently on this arc
    • containsAgent

      boolean containsAgent(GraphAgent<?,?> graphAgent)
      Checks whether the specified agent is currently on this arc.
      Parameters:
      graphAgent - specified agent
      Returns:
      true if the specified agent is currently on this arc, false otherwise
      See Also:
    • addCallbackPosition

      void addCallbackPosition(GeometricGraphPosition<?,?> position)
      Adds the specified callback position to this arc. The callback method onAgentReachedPosition(GraphAgent, GeometricGraphPosition) will be called every time an GraphAgent reaches the specified position.
      Parameters:
      position - specified callback position
      See Also:
    • removeCallbackPosition

      void removeCallbackPosition(GeometricGraphPosition<?,?> position)
      Removes the specified callback position previously added by addCallbackPosition(GeometricGraphPosition) method from this arc. Does nothing if there is no specified callback position on this arc.
      Parameters:
      position - specified callback position
      See Also:
    • clearCallbackPositions

      void clearCallbackPositions()
      Removes all callback positions from this arc, if any.
      See Also:
    • getCallbackPositions

      List<GeometricGraphPosition<?,?>> getCallbackPositions()
      Returns an unmodifiable list of all callback positions belonging to this arc.
      Returns:
      unmodifiable list of all callback positions belonging to this arc
    • afterAgentEntered

      void afterAgentEntered(GraphAgent<?,?> graphAgent)
      Callback method called after an agent enters this arc.
      Parameters:
      graphAgent - agent that have just entered this arc
      See Also:
    • beforeAgentExited

      void beforeAgentExited(GraphAgent<?,?> graphAgent)
      Callback method called before an agent exits this arc.
      Parameters:
      graphAgent - agent that is about to exit this arc
      See Also:
    • onAgentReachedPosition

      void onAgentReachedPosition(GraphAgent<?,?> graphAgent, GeometricGraphPosition<?,?> position)
      Callback method called when an agent reaches the specified callback position belonging to this arc.
      Parameters:
      graphAgent - agent that have reached the specified callback position
      position - specified callback position