View Javadoc
1   package org.opentrafficsim.road.gtu.following;
2   
3   import org.opentrafficsim.core.OTS_SCALAR;
4   
5   /**
6    * Storage for the result of a GTU following model. <br>
7    * Currently the result is restricted to a constant acceleration during the period of validity (the time slot) of the result.
8    * <p>
9    * Copyright (c) 2013-2015 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/license.html">OpenTrafficSim License</a>.
11   * <p>
12   * @version $Revision: 1378 $, $LastChangedDate: 2015-09-03 13:38:01 +0200 (Thu, 03 Sep 2015) $, by $Author: averbraeck $,
13   *          initial version 6 feb. 2015 <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 AccelerationStep implements OTS_SCALAR
18  {
19      /** Acceleration that will be maintained during the current time slot. */
20      private final Acceleration.Abs acceleration;
21  
22      /** Time when the current time slot ends. */
23      private final Time.Abs validUntil;
24  
25      /**
26       * Create a new GTUFollowingModelResult.
27       * @param acceleration DoubleScalarAbs&lt;AccelerationUnit&gt;; computed acceleration
28       * @param validUntil DoubleScalarAbs&lt;TimeUnit&gt;; time when this result expires
29       */
30      public AccelerationStep(final Acceleration.Abs acceleration, final Time.Abs validUntil)
31      {
32          this.acceleration = acceleration;
33          this.validUntil = validUntil;
34      }
35  
36      /**
37       * @return acceleration.
38       */
39      public final Acceleration.Abs getAcceleration()
40      {
41          return this.acceleration;
42      }
43  
44      /**
45       * @return validUntil.
46       */
47      public final Time.Abs getValidUntil()
48      {
49          return this.validUntil;
50      }
51  
52      /**
53       * {@inheritDoc}
54       */
55      public final String toString()
56      {
57          return String.format("a=%s, valid until %s", this.acceleration, this.validUntil);
58      }
59  
60  }