View Javadoc
1   package org.opentrafficsim.road.gtu.lane.tactical.directedlanechange;
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-2019 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 DirectedLaneMovementStep implements Serializable
20  {
21      /** */
22      private static final long serialVersionUID = 20160400L;
23  
24      /** The resulting acceleration and duration of validity. */
25      private final AccelerationStep accelerationStep;
26  
27      /**
28       * Lane change. This has one of the following values:
29       * <table summary="">
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 direction;
45  
46      /**
47       * Construct a new LaneChangeModelResult.
48       * @param accelerationStep AccelerationStep; the acceleration and duration of validity of this result.
49       * @param direction LateralDirectionality; this has one of the values:
50       *            <table summary="">
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 DirectedLaneMovementStep(final AccelerationStep accelerationStep, final LateralDirectionality direction)
66      {
67          this.accelerationStep = accelerationStep;
68          this.direction = direction;
69      }
70  
71      /**
72       * @return the acceleration step.
73       */
74      public final AccelerationStep getGfmr()
75      {
76          return this.accelerationStep;
77      }
78  
79      /**
80       * @return laneChange. This has one of the values:
81       *         <table summary="">
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 getLaneChange()
97      {
98          return this.direction;
99      }
100 
101     /** {@inheritDoc} */
102     @Override
103     public final String toString()
104     {
105         return this.accelerationStep.toString() + ", "
106                 + (null == this.direction ? "no lane change" : this.direction.toString());
107     }
108 
109 }