Class RailArc

All Implemented Interfaces:
AgentGraphArc, GeometricGraphArc, LongAgentGraphArc

public class RailArc extends LongAgentGraphArcImpl
Rail arc is the element that is contained in arcs of railway graph. Rail arcs contains polyline representing the trajectory which is used to move the trains.
Author:
Andrey Malykhanov, Amalgama LLC
  • Field Details

  • Constructor Details

    • RailArc

      protected RailArc(String name, Polyline polyline)
      Creates a new instance of rail arc with the specified name and polyline.
      Parameters:
      name - the name of the arc
      polyline - the polyline of the arc
  • Method Details

    • getTrack

      public RailTrack getTrack()
      Returns the track which this rail arc belongs to.
      Returns:
      track which this rail arc belongs to
    • isForward

      public boolean isForward()
      Returns true if this arc is the forward arc of the rail track it belongs to and false otherwise.
      Returns:
      true if this arc is the forward arc of the rail track it belongs to and false otherwise
    • getName

      public String getName()
      Returns the name of this arc
      Returns:
      name of this arc
    • addCallbackPosition

      public void addCallbackPosition(GeometricGraphPosition<?,?> position, BiConsumer<Train,Boolean> callback)
    • onAgentReachedPosition

      public void onAgentReachedPosition(GraphAgent<?,?> graphAgent, GeometricGraphPosition<?,?> position)
      Description copied from interface: AgentGraphArc
      Callback method called when an agent reaches the specified callback position belonging to this arc.
      Specified by:
      onAgentReachedPosition in interface AgentGraphArc
      Overrides:
      onAgentReachedPosition in class AgentGraphArcImpl
      Parameters:
      graphAgent - agent that have reached the specified callback position
      position - specified callback position
    • toString

      public String toString()
      Overrides:
      toString in class AgentGraphArcImpl