Package org.opentrafficsim.core.gtu
Class TemplateGTUType
- java.lang.Object
-
- org.opentrafficsim.core.gtu.TemplateGTUType
-
- All Implemented Interfaces:
Serializable
,Generator<GTUCharacteristics>
public class TemplateGTUType extends Object implements Serializable, Generator<GTUCharacteristics>
TemplateGTUType stores some of the information that is needed to generate a GTU.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$, @version $Revision$, by $Author$, initial version Jul 8, 2014
- Author:
- Alexander Verbraeck
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TemplateGTUType(GTUType gtuType, Generator<Length> lengthGenerator, Generator<Length> widthGenerator, Generator<Speed> maximumSpeedGenerator)
TemplateGTUType(GTUType gtuType, Generator<Length> lengthGenerator, Generator<Length> widthGenerator, Generator<Speed> maximumSpeedGenerator, Generator<Acceleration> maximumAccelerationGenerator, Generator<Acceleration> maximumDecelerationGenerator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TemplateGTUType
copyForGtuType(GTUType newGtuType)
Returns the same Characteristics, but pertaining to a different GTU type.GTUCharacteristics
draw()
Returns characteristics for the given GTU.GTUType
getGTUType()
String
toString()
-
-
-
Constructor Detail
-
TemplateGTUType
public TemplateGTUType(GTUType gtuType, Generator<Length> lengthGenerator, Generator<Length> widthGenerator, Generator<Speed> maximumSpeedGenerator) throws NullPointerException
- Parameters:
gtuType
- GTUType; GTUType, the GTUType to make it identifiable.lengthGenerator
- Generator<Length>; generator for the length of the GTU type (parallel with driving direction).widthGenerator
- Generator<Length>; generator for the width of the GTU type (perpendicular to driving direction).maximumSpeedGenerator
- Generator<Speed>; generator for the maximum speed of the GTU type (in the driving direction).- Throws:
NullPointerException
- when one of the arguments is null
-
TemplateGTUType
public TemplateGTUType(GTUType gtuType, Generator<Length> lengthGenerator, Generator<Length> widthGenerator, Generator<Speed> maximumSpeedGenerator, Generator<Acceleration> maximumAccelerationGenerator, Generator<Acceleration> maximumDecelerationGenerator) throws NullPointerException
- Parameters:
gtuType
- GTUType; GTUType, the GTUType to make it identifiable.lengthGenerator
- Generator<Length>; generator for the length of the GTU type (parallel with driving direction).widthGenerator
- Generator<Length>; generator for the width of the GTU type (perpendicular to driving direction).maximumSpeedGenerator
- Generator<Speed>; generator for the maximum speed of the GTU type (in the driving direction).maximumAccelerationGenerator
- Generator<Acceleration>; generator for the maximum acceleration of the GTU typemaximumDecelerationGenerator
- Generator<Acceleration>; generator for the maximum deceleration of the GTU type- Throws:
NullPointerException
- when one of the arguments is null
-
-
Method Detail
-
copyForGtuType
public TemplateGTUType copyForGtuType(GTUType newGtuType)
Returns the same Characteristics, but pertaining to a different GTU type. This is useful for when the GTU type is used for other purposes in simulation, where theGTUCharacteristics
should be the same.- Parameters:
newGtuType
- GTUType; the new GTU type.- Returns:
- Copy of this
TemplateGTUType
linked to the new GTU type.
-
draw
public GTUCharacteristics draw() throws ProbabilityException, ParameterException
Returns characteristics for the given GTU.- Specified by:
draw
in interfaceGenerator<GTUCharacteristics>
- Returns:
- characteristics for the given GTU
- Throws:
ProbabilityException
- in case of probability exceptionParameterException
- in case of parameter exception
-
getGTUType
public GTUType getGTUType()
- Returns:
- gtuType.
-
-