1 package org.opentrafficsim.road.gtu.lane.tactical.lanechangemobil;
2
3 import java.io.Serializable;
4
5 import org.opentrafficsim.core.network.LateralDirectionality;
6 import org.opentrafficsim.road.gtu.lane.tactical.following.AccelerationStep;
7
8 /**
9 * Acceleration, lane change decision and time until when this movement is committed.
10 * <p>
11 * Copyright (c) 2013-2020 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/license.html">OpenTrafficSim License</a>.
13 * <p>
14 * @version $Revision: 1155 $, $LastChangedDate: 2015-07-26 01:01:13 +0200 (Sun, 26 Jul 2015) $, by $Author: averbraeck $,
15 * initial version 6 feb. 2015 <br>
16 * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
17 * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
18 */
19 public class LaneMovementStep implements Serializable
20 {
21 /** */
22 private static final long serialVersionUID = 20150206L;
23
24 /** The resulting acceleration and duration of validity. */
25 private final AccelerationStep gfmr;
26
27 /**
28 * Lane change. This has one of the following values:
29 * <table ><caption> </caption>
30 * <tr>
31 * <td>null:</td>
32 * <td>Stay in the current lane</td>
33 * </tr>
34 * <tr>
35 * <td>LateralDirectionality.LEFT:</td>
36 * <td>Move to the Left adjacent lane, as seen from the GTU in forward driving direction</td>
37 * </tr>
38 * <tr>
39 * <td>LateralDirectionality.RIGHT:</td>
40 * <td>Move to the Right adjacent lane, as seen from the GTU in forward driving direction</td>
41 * </tr>
42 * </table>
43 */
44 private final LateralDirectionality laneChange;
45
46 /**
47 * Construct a new LaneChangeModelResult.
48 * @param gfmr AccelerationStep; the acceleration and duration of validity of this result.
49 * @param laneChange LateralDirectionality; this has one of the values:
50 * <table ><caption> </caption>
51 * <tr>
52 * <td>null:</td>
53 * <td>Stay in the current lane</td>
54 * </tr>
55 * <tr>
56 * <td>LateralDirectionality.LEFT:</td>
57 * <td>Move to the Left adjacent lane, as seen from the GTU in forward driving direction</td>
58 * </tr>
59 * <tr>
60 * <td>LateralDirectionality.RIGHT:</td>
61 * <td>Move to the Right adjacent lane, as seen from the GTU in forward driving direction</td>
62 * </tr>
63 * </table>
64 */
65 public LaneMovementStep(final AccelerationStep gfmr, final LateralDirectionality laneChange)
66 {
67 this.gfmr = gfmr;
68 this.laneChange = laneChange;
69 }
70
71 /**
72 * @return the GTUModelFollowingResult.
73 */
74 public final AccelerationStep getGfmr()
75 {
76 return this.gfmr;
77 }
78
79 /**
80 * @return laneChange. This has one of the values:
81 * <table ><caption> </caption>
82 * <tr>
83 * <td>null:</td>
84 * <td>Stay in the current lane</td>
85 * </tr>
86 * <tr>
87 * <td>LateralDirectionality.LEFT:</td>
88 * <td>Move to the Left adjacent lane, as seen from the GTU in forward driving direction</td>
89 * </tr>
90 * <tr>
91 * <td>LateralDirectionality.RIGHT:</td>
92 * <td>Move to the Right adjacent lane, as seen from the GTU in forward driving direction</td>
93 * </tr>
94 * </table>
95 */
96 public final LateralDirectionality getLaneChangeDirection()
97 {
98 return this.laneChange;
99 }
100
101 /** {@inheritDoc} */
102 @Override
103 public final String toString()
104 {
105 return this.gfmr.toString() + ", " + (null == this.laneChange ? "no lane change" : this.laneChange.toString());
106 }
107
108 }