Class GTUType

  • All Implemented Interfaces:
    java.io.Serializable, Identifiable

    public final class GTUType
    extends HierarchicalType<GTUType>
    implements java.io.Serializable
    A GTU type identifies the type of a GTU.
    GTU types are used to check whether a particular GTU can travel over a particular part of infrastructure. E.g. a (LaneBased)GTU with GTUType CAR can travel over lanes that have a LaneType that has the GTUType CAR in the compatibility set.

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

    Version:
    $Revision: 6384 $, $LastChangedDate: 2020-02-13 11:30:49 +0100 (Thu, 13 Feb 2020) $, by $Author: wjschakel $, initial version Dec 31, 2014
    Author:
    Alexander Verbraeck, Peter Knoppers
    See Also:
    Serialized Form
    • Constructor Detail

      • GTUType

        public GTUType​(java.lang.String id,
                       Network network)
                throws java.lang.NullPointerException
        Parameters:
        id - String; The id of the GTUType to make it identifiable.
        network - Network; The network to which the GTUType belongs
        Throws:
        java.lang.NullPointerException - if the id is null
      • GTUType

        public GTUType​(java.lang.String id,
                       GTUType parent)
                throws java.lang.NullPointerException
        Parameters:
        id - String; The id of the GTUType to make it identifiable.
        parent - GTUType; parent GTU type
        Throws:
        java.lang.NullPointerException - if the id is null
    • Method Detail

      • isOfType

        public boolean isOfType​(GTUType.DEFAULTS type)
        Whether this, or any of the parent types, equals the given type.
        Parameters:
        type - DEFAULTS; type
        Returns:
        whether this, or any of the parent types, equals the given type
      • isType

        public boolean isType​(GTUType.DEFAULTS type)
        Whether this equals the given type.
        Parameters:
        type - DEFAULTS; type
        Returns:
        whether this equals the given type
      • defaultCharacteristics

        public static GTUCharacteristics defaultCharacteristics​(GTUType gtuType,
                                                                Network network,
                                                                StreamInterface randomStream)
                                                         throws GTUException
        Returns default characteristics for given GTUType.
        Parameters:
        gtuType - GTUType; GTUType GTU type
        network - Network; the network to use as a key
        randomStream - StreamInterface; stream for random numbers
        Returns:
        default characteristics for given GTUType
        Throws:
        GTUException - if there are no default characteristics for the GTU type
      • getNetwork

        public Network getNetwork()
        Returns:
        the network to which the GTUType belongs
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object