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