GTUCharacteristics.java

  1. package org.opentrafficsim.core.gtu;

  2. import java.io.Serializable;

  3. import org.djunits.value.vdouble.scalar.Length;
  4. import org.djunits.value.vdouble.scalar.Speed;
  5. import org.opentrafficsim.core.dsol.OTSDEVSSimulatorInterface;
  6. import org.opentrafficsim.core.idgenerator.IdGenerator;
  7. import org.opentrafficsim.core.network.OTSNetwork;

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

  20.     /** */
  21.     private static final long serialVersionUID = 20160000L;

  22.     /** The type of the GTU. */
  23.     private final GTUType gtuType;

  24.     /** The id generator that will generate the id of the GTU. */
  25.     private final IdGenerator idGenerator;

  26.     /** Length of the GTU. */
  27.     private final Length length;

  28.     /** Width of the GTU. */
  29.     private final Length width;

  30.     /** Maximum speed of the GTU. */
  31.     private final Speed maximumSpeed;

  32.     /** The simulator that controls the GTU. */
  33.     private final OTSDEVSSimulatorInterface simulator;

  34.     /** The OTSNetwork that all generated GTUs will be registered in. */
  35.     private final OTSNetwork network;

  36.     /**
  37.      * Construct a new set of GTUCharacteristics.
  38.      * @param gtuType GTUType; type of the (not yet constructed) GTU
  39.      * @param idGenerator IdGenerator; the id generator for the (not yet constructed) GTU
  40.      * @param length Length; the length of the (non yet constructed) GTU
  41.      * @param width Length; the width of the (non yet constructed) GTU
  42.      * @param maximumSpeed Length; the maximum speed of the (non yet constructed) GTU
  43.      * @param simulator OTSDEVSSimulatorInterface; the simulator that controls the (not yet constructed) GTU
  44.      * @param network OTSNetwork; the network that will contain the GTU
  45.      */
  46.     public GTUCharacteristics(final GTUType gtuType, final IdGenerator idGenerator, final Length length,
  47.             final Length width, final Speed maximumSpeed, final OTSDEVSSimulatorInterface simulator,
  48.             final OTSNetwork network)
  49.     {
  50.         this.gtuType = gtuType;
  51.         this.idGenerator = idGenerator;
  52.         this.length = length;
  53.         this.width = width;
  54.         this.maximumSpeed = maximumSpeed;
  55.         this.simulator = simulator;
  56.         this.network = network;
  57.     }

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

  66.     /**
  67.      * Retrieve the id generator.
  68.      * @return IdGenerator
  69.      */
  70.     public final IdGenerator getIdGenerator()
  71.     {
  72.         return this.idGenerator;
  73.     }

  74.     /**
  75.      * Retrieve the length.
  76.      * @return Length
  77.      */
  78.     public final Length getLength()
  79.     {
  80.         return this.length;
  81.     }

  82.     /**
  83.      * Retrieve the width.
  84.      * @return Width.Rel
  85.      */
  86.     public final Length getWidth()
  87.     {
  88.         return this.width;
  89.     }

  90.     /**
  91.      * Retrieve the maximum speed.
  92.      * @return Speed
  93.      */
  94.     public final Speed getMaximumSpeed()
  95.     {
  96.         return this.maximumSpeed;
  97.     }

  98.     /**
  99.      * Retrieve the simulator.
  100.      * @return OTSDEVSSimulatorInterface
  101.      */
  102.     public final OTSDEVSSimulatorInterface getSimulator()
  103.     {
  104.         return this.simulator;
  105.     }

  106.     /**
  107.      * Retrieve the network.
  108.      * @return OTSNetwork
  109.      */
  110.     public final OTSNetwork getNetwork()
  111.     {
  112.         return this.network;
  113.     }

  114.     /** {@inheritDoc} */
  115.     @Override
  116.     public final String toString()
  117.     {
  118.         return "GTUCharacteristics [gtuType=" + this.gtuType + ", length=" + this.length + ", width=" + this.width
  119.                 + ", maximumSpeed=" + this.maximumSpeed + "]";
  120.     }

  121. }