Class GtuTemplate

java.lang.Object
org.opentrafficsim.core.gtu.GtuTemplate
All Implemented Interfaces:
Serializable, Generator<GtuCharacteristics>

public class GtuTemplate extends Object implements 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 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 type
      maximumDecelerationGenerator - Generator<Acceleration>; generator for the maximum deceleration of the GTU type
      Throws:
      NullPointerException - when one of the arguments is null
  • Method Details

    • copyForGtuType

      public GtuTemplate 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 the GtuCharacteristics 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 interface Generator<GtuCharacteristics>
      Returns:
      characteristics for the given GTU
      Throws:
      ProbabilityException - in case of probability exception
      ParameterException - in case of parameter exception
    • getGtuType

      public GtuType getGtuType()
      Returns:
      gtuType.
    • toString

      public String toString()
      Overrides:
      toString in class Object