View Javadoc
1   package org.opentrafficsim.road.gtu.lane.tactical.lanechangemobil;
2   
3   import org.opentrafficsim.core.network.LateralDirectionality;
4   import org.opentrafficsim.road.gtu.lane.tactical.following.AccelerationStep;
5   
6   /**
7    * Acceleration, lane change decision and time until when this movement is committed.
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: 1155 $, $LastChangedDate: 2015-07-26 01:01:13 +0200 (Sun, 26 Jul 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 LaneMovementStep
18  {
19      /** The resulting acceleration and duration of validity. */
20      private final AccelerationStep gfmr;
21  
22      /**
23       * Lane change. This has one of the following values:
24       * <table summary="">
25       * <tr>
26       * <td>null:</td>
27       * <td>Stay in the current lane</td>
28       * </tr>
29       * <tr>
30       * <td>LateralDirectionality.LEFT:</td>
31       * <td>Move to the Left adjacent lane, as seen from the GTU in forward driving direction</td>
32       * </tr>
33       * <tr>
34       * <td>LateralDirectionality.RIGHT:</td>
35       * <td>Move to the Right adjacent lane, as seen from the GTU in forward driving direction</td>
36       * </tr>
37       * </table>
38       */
39      private final LateralDirectionality laneChange;
40  
41      /**
42       * Construct a new LaneChangeModelResult.
43       * @param gfmr GTUFollowingModelResult; the acceleration and duration of validity of this result.
44       * @param laneChange LateralDirectionality; this has one of the values:
45       *            <table summary="">
46       *            <tr>
47       *            <td>null:</td>
48       *            <td>Stay in the current lane</td>
49       *            </tr>
50       *            <tr>
51       *            <td>LateralDirectionality.LEFT:</td>
52       *            <td>Move to the Left adjacent lane, as seen from the GTU in forward driving direction</td>
53       *            </tr>
54       *            <tr>
55       *            <td>LateralDirectionality.RIGHT:</td>
56       *            <td>Move to the Right adjacent lane, as seen from the GTU in forward driving direction</td>
57       *            </tr>
58       *            </table>
59       */
60      public LaneMovementStep(final AccelerationStep gfmr, final LateralDirectionality laneChange)
61      {
62          this.gfmr = gfmr;
63          this.laneChange = laneChange;
64      }
65  
66      /**
67       * @return the GTUModelFollowingResult.
68       */
69      public final AccelerationStep getGfmr()
70      {
71          return this.gfmr;
72      }
73  
74      /**
75       * @return laneChange. This has one of the values:
76       *         <table summary="">
77       *         <tr>
78       *         <td>null:</td>
79       *         <td>Stay in the current lane</td>
80       *         </tr>
81       *         <tr>
82       *         <td>LateralDirectionality.LEFT:</td>
83       *         <td>Move to the Left adjacent lane, as seen from the GTU in forward driving direction</td>
84       *         </tr>
85       *         <tr>
86       *         <td>LateralDirectionality.RIGHT:</td>
87       *         <td>Move to the Right adjacent lane, as seen from the GTU in forward driving direction</td>
88       *         </tr>
89       *         </table>
90       */
91      public final LateralDirectionality getLaneChange()
92      {
93          return this.laneChange;
94      }
95  
96      /** {@inheritDoc} */
97      public final String toString()
98      {
99          return this.gfmr.toString() + ", " + (null == this.laneChange ? "no lane change" : this.laneChange.toString());
100     }
101 
102 }