Interface Link

All Superinterfaces:
Drawable, Identifiable, Locatable, Serializable
All Known Implementing Classes:
CapacityOTSLink, OTSLink

public interface Link
extends Locatable, Serializable, Identifiable, Drawable
Link as a connection between two Nodes.

Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.

$LastChangedDate: 2019-01-06 01:35:05 +0100 (Sun, 06 Jan 2019) $, @version $Revision: 4831 $, by $Author: averbraeck $, initial version Aug 19, 2014

Author:
Alexander Verbraeck, Peter Knoppers
  • Field Details

    • GTU_ADD_EVENT

      static final EventType GTU_ADD_EVENT
      The timed event type for pub/sub indicating the addition of a GTU to the link.
      Payload: Object[] {String gtuId, GTU gtu, int count_after_addition}
    • GTU_REMOVE_EVENT

      static final EventType GTU_REMOVE_EVENT
      The timed event type for pub/sub indicating the removal of a GTU from the link.
      Payload: Object[] {String gtuId, GTU gtu, int count_after_removal}
  • Method Details

    • getNetwork

      Network getNetwork()
      Return the network in which this link is registered. Cannot be null.
      Returns:
      Network; the network in which this link is registered
    • getId

      String getId()
      Specified by:
      getId in interface Identifiable
      Returns:
      id.
    • getStartNode

      Node getStartNode()
      Returns:
      start node.
    • getEndNode

      Node getEndNode()
      Returns:
      end node.
    • getLinkType

      LinkType getLinkType()
      Returns:
      the link type.
    • getDesignLine

      OTSLine3D getDesignLine()
      Returns:
      the design line.
    • getSimulator

      Returns:
      the simulator.
    • getLength

      Length getLength()
      Returns:
      length of the link.
    • getDirectionality

      LongitudinalDirectionality getDirectionality​(GTUType gtuType)
      This method returns the directionality of the link for a GTU type. It might be that the link is FORWARD (from start node to end node) for the GTU type CAR, but BOTH for the GTU type BICYCLE (i.e., bicycles can also go from end node to start node). If there is no entry for the given GTU Type, the values of GTUType.ALL will be returned. If this entry is not present, LongitudinalDirectionality.NONE will be returned.
      Parameters:
      gtuType - GTUType; the GTU type to request the directionality for
      Returns:
      the longitudinal directionality of the link (FORWARD, BACKWARD, BOTH or NONE) for the given GTU type. NONE will be returned if no directionality is given.
    • addGTU

      void addGTU​(GTU gtu)
      Add a GTU to this link (e.g., for statistical purposes, or for a model on macro level). It is safe to add a GTU again. No warning or error will be given. The GTU_ADD_EVENT will only be fired when the GTU was not already on the link.
      Parameters:
      gtu - GTU; the GTU to add.
    • removeGTU

      void removeGTU​(GTU gtu)
      Remove a GTU from this link. It is safe to try to remove a GTU again. No warning or error will be given. The GTU_REMOVE_EVENT will only be fired when the GTU was on the link.
      Parameters:
      gtu - GTU; the GTU to remove.
    • getGTUs

      Set<GTU> getGTUs()
      Provide a safe copy of the set of GTUs.
      Returns:
      Set<GTU>; a safe copy of the set of GTUs
    • getGTUCount

      int getGTUCount()
      Provide the number of GTUs on this link.
      Returns:
      int; the number of GTUs on this link