Package org.opentrafficsim.core.gtu
Class GtuTemplate
java.lang.Object
org.opentrafficsim.core.gtu.GtuTemplate
- All Implemented Interfaces:
Serializable
,Generator<GtuCharacteristics>
Stores some of the information that is needed to generate a GTU.
Copyright (c) 2013-2024 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:
-
Constructor Summary
ConstructorDescriptionGtuTemplate
(GtuType gtuType, Generator<org.djunits.value.vdouble.scalar.Length> lengthGenerator, Generator<org.djunits.value.vdouble.scalar.Length> widthGenerator, Generator<org.djunits.value.vdouble.scalar.Speed> maximumSpeedGenerator) GtuTemplate
(GtuType gtuType, Generator<org.djunits.value.vdouble.scalar.Length> lengthGenerator, Generator<org.djunits.value.vdouble.scalar.Length> widthGenerator, Generator<org.djunits.value.vdouble.scalar.Speed> maximumSpeedGenerator, Generator<org.djunits.value.vdouble.scalar.Acceleration> maximumAccelerationGenerator, Generator<org.djunits.value.vdouble.scalar.Acceleration> maximumDecelerationGenerator) -
Method Summary
Modifier and TypeMethodDescriptioncopyForGtuType
(GtuType newGtuType) Returns the same Characteristics, but pertaining to a different GTU type.draw()
Returns characteristics for the given GTU.toString()
-
Constructor Details
-
GtuTemplate
public GtuTemplate(GtuType gtuType, Generator<org.djunits.value.vdouble.scalar.Length> lengthGenerator, Generator<org.djunits.value.vdouble.scalar.Length> widthGenerator, Generator<org.djunits.value.vdouble.scalar.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
-
GtuTemplate
public GtuTemplate(GtuType gtuType, Generator<org.djunits.value.vdouble.scalar.Length> lengthGenerator, Generator<org.djunits.value.vdouble.scalar.Length> widthGenerator, Generator<org.djunits.value.vdouble.scalar.Speed> maximumSpeedGenerator, Generator<org.djunits.value.vdouble.scalar.Acceleration> maximumAccelerationGenerator, Generator<org.djunits.value.vdouble.scalar.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 Details
-
copyForGtuType
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
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
- Returns:
- gtuType.
-
toString
-