LaneBasedTemplateGTUTypeDistribution.java

  1. package org.opentrafficsim.road.gtu.generator.characteristics;

  2. import java.io.Serializable;

  3. import org.opentrafficsim.base.parameters.ParameterException;
  4. import org.opentrafficsim.core.distributions.Distribution;
  5. import org.opentrafficsim.core.distributions.ProbabilityException;
  6. import org.opentrafficsim.core.gtu.GTUException;

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

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

  21.     /** The Distribution of lane based template GTU types. */
  22.     private final Distribution<LaneBasedTemplateGTUType> distribution;

  23.     /**
  24.      * Construct a new LaneBasedTemplateGTUTypeDistribution.
  25.      * @param distributionOfLanebasedTemplateGTUType Distribution&lt;LaneBasedTemplateGTUType&gt;; the distribution of
  26.      *            LaneBasedTemplateGTUTypes
  27.      */
  28.     public LaneBasedTemplateGTUTypeDistribution(
  29.             final Distribution<LaneBasedTemplateGTUType> distributionOfLanebasedTemplateGTUType)
  30.     {
  31.         this.distribution = distributionOfLanebasedTemplateGTUType;
  32.     }

  33.     /** {@inheritDoc} */
  34.     @Override
  35.     public final LaneBasedGTUCharacteristics draw() throws ProbabilityException, ParameterException, GTUException
  36.     {
  37.         return this.distribution.draw().draw();
  38.     }

  39.     /** {@inheritDoc} */
  40.     @Override
  41.     public final String toString()
  42.     {
  43.         return "LaneBasedTemplateGTUTypeDistribution [distribution=" + this.distribution + "]";
  44.     }

  45. }