1 package org.opentrafficsim.core.gtu.following;
2
3 import org.opentrafficsim.core.unit.AccelerationUnit;
4 import org.opentrafficsim.core.unit.TimeUnit;
5 import org.opentrafficsim.core.value.vdouble.scalar.DoubleScalar;
6
7 /**
8 * Storage for the result of a GTU following model. <br/>
9 * Currently the result is restricted to a constant acceleration during the period of validity (the time slot) of the
10 * result.
11 * <p>
12 * Copyright (c) 2013-2014 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights
13 * reserved. <br>
14 * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>.
15 * <p>
16 * @version 6 feb. 2015 <br>
17 * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
18 * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
19 */
20 public class AccelerationStep
21 {
22 /** Acceleration that will be maintained during the current time slot. */
23 private final DoubleScalar.Abs<AccelerationUnit> acceleration;
24
25 /** Time when the current time slot ends. */
26 private final DoubleScalar.Abs<TimeUnit> validUntil;
27
28 /**
29 * Create a new GTUFollowingModelResult.
30 * @param acceleration DoubleScalarAbs<AccelerationUnit>; computed acceleration
31 * @param validUntil DoubleScalarAbs<TimeUnit>; time when this result expires
32 */
33 public AccelerationStep(final DoubleScalar.Abs<AccelerationUnit> acceleration,
34 final DoubleScalar.Abs<TimeUnit> validUntil)
35 {
36 this.acceleration = acceleration;
37 this.validUntil = validUntil;
38 }
39
40 /**
41 * @return acceleration.
42 */
43 public final DoubleScalar.Abs<AccelerationUnit> getAcceleration()
44 {
45 return this.acceleration;
46 }
47
48 /**
49 * @return validUntil.
50 */
51 public final DoubleScalar.Abs<TimeUnit> getValidUntil()
52 {
53 return this.validUntil;
54 }
55
56 /**
57 * {@inheritDoc}
58 */
59 public final String toString()
60 {
61 return String.format("a=%s, valid until %s", this.acceleration, this.validUntil);
62 }
63
64 }