Interface Link

    • Field Detail

      • GTU_ADD_EVENT

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

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

      • 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
      • 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.
      • 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