Class GtuTemplate

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

public class GtuTemplate extends Object implements 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 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 type
      maximumDecelerationSupplier - supplier 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 - the new GTU type.
      Returns:
      Copy of this TemplateGTUType linked to the new GTU type.
    • get

      public GtuCharacteristics get()
      Returns characteristics for the given GTU.
      Specified by:
      get in interface Supplier<GtuCharacteristics>
      Returns:
      characteristics for the given GTU
    • getGtuType

      public GtuType getGtuType()
      Returns the GTU type.
      Returns:
      gtuType.
    • toString

      public String toString()
      Overrides:
      toString in class Object