GTUCharacteristics.java

  1. package org.opentrafficsim.core.gtu;

  2. import java.io.Serializable;

  3. import org.djunits.value.vdouble.scalar.Acceleration;
  4. import org.djunits.value.vdouble.scalar.Length;
  5. import org.djunits.value.vdouble.scalar.Speed;

  6. /**
  7.  * Characteristics of a GTU. This class is used to store all characteristics of a (not-yet constructed) GTU.
  8.  * <p>
  9.  * Copyright (c) 2013-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
  10.  * BSD-style license. See <a href="http://opentrafficsim.org/docs/current/license.html">OpenTrafficSim License</a>.
  11.  * <p>
  12.  * @version $Revision$, $LastChangedDate$, by $Author$, initial version Mar 8, 2016 <br>
  13.  * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
  14.  * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
  15.  */
  16. public class GTUCharacteristics implements Serializable
  17. {

  18.     /** */
  19.     private static final long serialVersionUID = 20160000L;

  20.     /** The type of the GTU. */
  21.     private final GTUType gtuType;

  22.     /** Length of the GTU. */
  23.     private final Length length;

  24.     /** Width of the GTU. */
  25.     private final Length width;

  26.     /** Maximum speed of the GTU. */
  27.     private final Speed maximumSpeed;

  28.     /** Maximum acceleration. */
  29.     private final Acceleration maximumAcceleration;

  30.     /** Maximum deceleration. */
  31.     private final Acceleration maximumDeceleration;

  32.     /** Front position relative to the reference position. */
  33.     private final Length front;

  34.     /**
  35.      * Construct a new set of GTUCharacteristics.
  36.      * @param gtuType GTUType; type of the (not yet constructed) GTU
  37.      * @param length Length; the length of the (non yet constructed) GTU
  38.      * @param width Length; the width of the (non yet constructed) GTU
  39.      * @param maximumSpeed Length; the maximum speed of the (non yet constructed) GTU
  40.      * @param maximumAcceleration Acceleration; maximum acceleration
  41.      * @param maximumDeceleration Acceleration; maximum deceleration
  42.      * @param front Length; front position relative to the reference position
  43.      */
  44.     public GTUCharacteristics(final GTUType gtuType, final Length length, final Length width, final Speed maximumSpeed,
  45.             final Acceleration maximumAcceleration, final Acceleration maximumDeceleration, final Length front)
  46.     {
  47.         this.gtuType = gtuType;
  48.         this.length = length;
  49.         this.width = width;
  50.         this.maximumSpeed = maximumSpeed;
  51.         this.maximumAcceleration = maximumAcceleration;
  52.         this.maximumDeceleration = maximumDeceleration;
  53.         this.front = front;
  54.     }

  55.     /**
  56.      * Retrieve the GTU type.
  57.      * @return GTUType
  58.      */
  59.     public final GTUType getGTUType()
  60.     {
  61.         return this.gtuType;
  62.     }

  63.     /**
  64.      * Retrieve the length.
  65.      * @return Length
  66.      */
  67.     public final Length getLength()
  68.     {
  69.         return this.length;
  70.     }

  71.     /**
  72.      * Retrieve the width.
  73.      * @return Length
  74.      */
  75.     public final Length getWidth()
  76.     {
  77.         return this.width;
  78.     }

  79.     /**
  80.      * Retrieve the maximum speed.
  81.      * @return Speed
  82.      */
  83.     public final Speed getMaximumSpeed()
  84.     {
  85.         return this.maximumSpeed;
  86.     }

  87.     /**
  88.      * Retrieve the maximum acceleration.
  89.      * @return Acceleration
  90.      */
  91.     public final Acceleration getMaximumAcceleration()
  92.     {
  93.         return this.maximumAcceleration;
  94.     }

  95.     /**
  96.      * Retrieve the maximum deceleration.
  97.      * @return Acceleration
  98.      */
  99.     public final Acceleration getMaximumDeceleration()
  100.     {
  101.         return this.maximumDeceleration;
  102.     }

  103.     /**
  104.      * Retrieve the front position relative to the reference position.
  105.      * @return Length
  106.      */
  107.     public final Length getFront()
  108.     {
  109.         return this.front;
  110.     }

  111.     /** {@inheritDoc} */
  112.     @Override
  113.     public String toString()
  114.     {
  115.         return "GTUCharacteristics [gtuType=" + this.gtuType + ", length=" + this.length + ", width=" + this.width
  116.                 + ", maximumSpeed=" + this.maximumSpeed + ", maximumAcceleration=" + this.maximumAcceleration
  117.                 + ", maximumDeceleration=" + this.maximumDeceleration + ", front=" + this.front + "]";
  118.     }

  119. }