Package org.opentrafficsim.core.gtu
Class GtuTemplate
java.lang.Object
org.opentrafficsim.core.gtu.GtuTemplate
- All Implemented Interfaces:
Supplier<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
-
Constructor Summary
ConstructorsConstructorDescriptionGtuTemplate(GtuType gtuType, Supplier<Length> lengthSupplier, Supplier<Length> widthSupplier, Supplier<Speed> maximumSpeedSupplier) Constructor.GtuTemplate(GtuType gtuType, Supplier<Length> lengthSupplier, Supplier<Length> widthSupplier, Supplier<Speed> maximumSpeedSupplier, Supplier<Acceleration> maximumAccelerationSupplier, Supplier<Acceleration> maximumDecelerationSupplier) Constructor. -
Method Summary
Modifier and TypeMethodDescriptioncopyForGtuType(GtuType newGtuType) Returns the same Characteristics, but pertaining to a different GTU type.get()Returns characteristics for the given GTU.Returns the GTU type.toString()
-
Constructor Details
-
GtuTemplate
public GtuTemplate(GtuType gtuType, Supplier<Length> lengthSupplier, Supplier<Length> widthSupplier, Supplier<Speed> maximumSpeedSupplier) throws NullPointerException Constructor.- Parameters:
gtuType- GtuType, the GtuType to make it identifiable.lengthSupplier- supplier for the length of the GTU type (parallel with driving direction).widthSupplier- supplier for the width of the GTU type (perpendicular to driving direction).maximumSpeedSupplier- supplier 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, Supplier<Length> lengthSupplier, Supplier<Length> widthSupplier, Supplier<Speed> maximumSpeedSupplier, Supplier<Acceleration> maximumAccelerationSupplier, Supplier<Acceleration> maximumDecelerationSupplier) throws NullPointerException Constructor.- Parameters:
gtuType- GtuType, the GtuType to make it identifiable.lengthSupplier- supplier for the length of the GTU type (parallel with driving direction).widthSupplier- supplier for the width of the GTU type (perpendicular to driving direction).maximumSpeedSupplier- supplier for the maximum speed of the GTU type (in the driving direction).maximumAccelerationSupplier- supplier for the maximum acceleration of the GTU typemaximumDecelerationSupplier- supplier 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 theGtuCharacteristicsshould be the same.- Parameters:
newGtuType- the new GTU type.- Returns:
- Copy of this
TemplateGTUTypelinked to the new GTU type.
-
get
Returns characteristics for the given GTU.- Specified by:
getin interfaceSupplier<GtuCharacteristics>- Returns:
- characteristics for the given GTU
-
getGtuType
Returns the GTU type.- Returns:
- gtuType.
-
toString
-