Package org.opentrafficsim.core.gtu
Class GTUType
- java.lang.Object
-
- org.opentrafficsim.base.Type<T>
-
- org.opentrafficsim.base.HierarchicalType<GTUType>
-
- org.opentrafficsim.core.gtu.GTUType
-
- All Implemented Interfaces:
Serializable
,Identifiable
public final class GTUType extends HierarchicalType<GTUType> implements 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-2022 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.- Version:
- $Revision$, $LastChangedDate$, by $Author$,
initial version Dec 31, 2014
- Author:
- Alexander Verbraeck, Peter Knoppers
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GTUType.DEFAULTS
Default types with their name.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static GTUCharacteristics
defaultCharacteristics(GTUType gtuType, Network network, StreamInterface randomStream)
Returns default characteristics for given GTUType.Network
getNetwork()
boolean
isOfType(GTUType.DEFAULTS type)
Whether this, or any of the parent types, equals the given type.boolean
isType(GTUType.DEFAULTS type)
Whether this equals the given type.String
toString()
-
Methods inherited from class org.opentrafficsim.base.HierarchicalType
commonAncestor, equals, getId, getParent, hashCode, isOfType
-
-
-
-
Constructor Detail
-
GTUType
public GTUType(String id, Network network) throws NullPointerException
- Parameters:
id
- String; The id of the GTUType to make it identifiable.network
- Network; The network to which the GTUType belongs- Throws:
NullPointerException
- if the id is null
-
GTUType
public GTUType(String id, GTUType parent) throws NullPointerException
- Parameters:
id
- String; The id of the GTUType to make it identifiable.parent
- GTUType; parent GTU type- Throws:
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 typenetwork
- Network; the network to use as a keyrandomStream
- 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
-
-