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-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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGtuType.DEFAULTSDefault types with their name.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static GtuCharacteristicsdefaultCharacteristics(GtuType gtuType, Network network, StreamInterface randomStream)Returns default characteristics for given GTUType.NetworkgetNetwork()booleanisOfType(GtuType.DEFAULTS type)Whether this, or any of the parent types, equals the given type.booleanisType(GtuType.DEFAULTS type)Whether this equals the given type.StringtoString()-
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
-
-