1 package org.opentrafficsim.road.gtu.lane.tactical.following;
2
3 import java.io.Serializable;
4
5 import org.djunits.value.vdouble.scalar.Acceleration;
6 import org.djunits.value.vdouble.scalar.Duration;
7 import org.djunits.value.vdouble.scalar.Time;
8
9 /**
10 * Storage for the result of a GTU following model. <br>
11 * Currently the result is restricted to a constant acceleration during the period of validity (the time slot) of the result.
12 * <p>
13 * Copyright (c) 2013-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
14 * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
15 * <p>
16 * @version $Revision: 1378 $, $LastChangedDate: 2015-09-03 13:38:01 +0200 (Thu, 03 Sep 2015) $, by $Author: averbraeck $,
17 * initial version 6 feb. 2015 <br>
18 * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
19 * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
20 */
21 public class AccelerationStep implements Serializable
22 {
23 /** */
24 private static final long serialVersionUID = 20150000L;
25
26 /** Acceleration that will be maintained during the current time slot. */
27 private final Acceleration acceleration;
28
29 /** Time when the current time slot ends. */
30 private final Time validUntil;
31
32 /** Duration of the time step. */
33 private final Duration duration;
34
35 /**
36 * Create a new GTUFollowingModelResult.
37 * @param acceleration DoubleScalarAbs<AccelerationUnit>; computed acceleration
38 * @param validUntil Time; time when this result expires
39 * @param duration Duration; duration of the time step
40 */
41 public AccelerationStep(final Acceleration acceleration, final Time validUntil, final Duration duration)
42 {
43 this.acceleration = acceleration;
44 this.validUntil = validUntil;
45 this.duration = duration;
46 }
47
48 /**
49 * @return acceleration.
50 */
51 public final Acceleration getAcceleration()
52 {
53 return this.acceleration;
54 }
55
56 /**
57 * @return validUntil.
58 */
59 public final Time getValidUntil()
60 {
61 return this.validUntil;
62 }
63
64 /**
65 * @return duration.
66 */
67 public final Duration getDuration()
68 {
69 return this.duration;
70 }
71
72 /** {@inheritDoc} */
73 @Override
74 public final String toString()
75 {
76 return String.format("a=%s, valid until %s", this.acceleration, this.validUntil);
77 }
78
79 }