Class CompleteRoute

  • All Implemented Interfaces:
    Serializable, Identifiable

    public class CompleteRoute
    extends Route
    A CompleteRoute is a Route with directly connected Nodes.

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

    $LastChangedDate: 2015-07-16 10:20:53 +0200 (Thu, 16 Jul 2015) $, @version $Revision: 1124 $, by $Author: pknoppers $, initial version Jul 22, 2015

    Author:
    Alexander Verbraeck, Peter Knoppers
    See Also:
    Serialized Form
    • Constructor Detail

      • CompleteRoute

        public CompleteRoute​(String id,
                             GTUType gtuType)
        Create an empty route for the given GTUType.
        Parameters:
        id - String; the name of the route
        gtuType - GTUType; the GTUType for which this is a route
      • CompleteRoute

        public CompleteRoute​(String id,
                             GTUType gtuType,
                             List<Node> nodes)
                      throws NetworkException
        Create a route based on an initial list of nodes.
        This constructor makes a defensive copy of the provided List.
        Parameters:
        id - String; the name of the route.
        gtuType - GTUType; the GTUType for which this is a route
        nodes - List<Node>; the initial list of nodes.
        Throws:
        NetworkException - if intermediate nodes are missing in the route.
    • Method Detail

      • addNode

        public final CompleteRoute addNode​(Node node)
                                    throws NetworkException
        Add a node to the end of the node list.
        Overrides:
        addNode in class Route
        Parameters:
        node - Node; the node to add.
        Returns:
        Route; this route for method chaining
        Throws:
        NetworkException - in case node could not be added to the route.
      • containsLink

        public final boolean containsLink​(Link link)
        Determine if this Route contains the specified Link.
        Parameters:
        link - Link; the link to check in the route.
        Returns:
        whether the link is part of the route or not.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Route