View Javadoc
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-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
12   * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
13   * </p>
14   * @author <a href="https://github.com/averbraeck">Alexander Verbraeck</a>
15   * @author <a href="https://tudelft.nl/staff/p.knoppers-1">Peter Knoppers</a>
16   */
17  public class LaneMovementStep implements Serializable
18  {
19      /** */
20      private static final long serialVersionUID = 20150206L;
21  
22      /** The resulting acceleration and duration of validity. */
23      private final AccelerationStep gfmr;
24  
25      /**
26       * Lane change. This has one of the following values:
27       * <table >
28       * <caption>&nbsp;</caption>
29       * <tr>
30       * <td>null:</td>
31       * <td>Stay in the current lane</td>
32       * </tr>
33       * <tr>
34       * <td>LateralDirectionality.LEFT:</td>
35       * <td>Move to the Left adjacent lane, as seen from the GTU in forward driving direction</td>
36       * </tr>
37       * <tr>
38       * <td>LateralDirectionality.RIGHT:</td>
39       * <td>Move to the Right adjacent lane, as seen from the GTU in forward driving direction</td>
40       * </tr>
41       * </table>
42       */
43      private final LateralDirectionality laneChange;
44  
45      /**
46       * Construct a new LaneChangeModelResult.
47       * @param gfmr AccelerationStep; the acceleration and duration of validity of this result.
48       * @param laneChange LateralDirectionality; this has one of the values:
49       *            <table >
50       *            <caption>&nbsp;</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 >
82       *         <caption>&nbsp;</caption>
83       *         <tr>
84       *         <td>null:</td>
85       *         <td>Stay in the current lane</td>
86       *         </tr>
87       *         <tr>
88       *         <td>LateralDirectionality.LEFT:</td>
89       *         <td>Move to the Left adjacent lane, as seen from the GTU in forward driving direction</td>
90       *         </tr>
91       *         <tr>
92       *         <td>LateralDirectionality.RIGHT:</td>
93       *         <td>Move to the Right adjacent lane, as seen from the GTU in forward driving direction</td>
94       *         </tr>
95       *         </table>
96       */
97      public final LateralDirectionality getLaneChangeDirection()
98      {
99          return this.laneChange;
100     }
101 
102     /** {@inheritDoc} */
103     @Override
104     public final String toString()
105     {
106         return this.gfmr.toString() + ", " + (null == this.laneChange ? "no lane change" : this.laneChange.toString());
107     }
108 
109 }