DirectedLaneMovementStep.java

  1. package org.opentrafficsim.road.gtu.lane.tactical.directedlanechange;

  2. import java.io.Serializable;

  3. import org.opentrafficsim.core.network.LateralDirectionality;
  4. import org.opentrafficsim.road.gtu.lane.tactical.following.AccelerationStep;

  5. /**
  6.  * Acceleration, lane change decision and time until when this movement is committed.
  7.  * <p>
  8.  * Copyright (c) 2013-2022 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
  9.  * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
  10.  * <p>
  11.  * @version $Revision: 1155 $, $LastChangedDate: 2015-07-26 01:01:13 +0200 (Sun, 26 Jul 2015) $, by $Author: averbraeck $,
  12.  *          initial 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 DirectedLaneMovementStep implements Serializable
  17. {
  18.     /** */
  19.     private static final long serialVersionUID = 20160400L;

  20.     /** The resulting acceleration and duration of validity. */
  21.     private final AccelerationStep accelerationStep;

  22.     /**
  23.      * Lane change. This has one of the following values:
  24.      * <table ><caption>&nbsp;</caption>
  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 direction;

  40.     /**
  41.      * Construct a new LaneChangeModelResult.
  42.      * @param accelerationStep AccelerationStep; the acceleration and duration of validity of this result.
  43.      * @param direction LateralDirectionality; this has one of the values:
  44.      *            <table ><caption>&nbsp;</caption>
  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, as seen from the GTU in forward driving direction</td>
  52.      *            </tr>
  53.      *            <tr>
  54.      *            <td>LateralDirectionality.RIGHT:</td>
  55.      *            <td>Move to the Right adjacent lane, as seen from the GTU in forward driving direction</td>
  56.      *            </tr>
  57.      *            </table>
  58.      */
  59.     public DirectedLaneMovementStep(final AccelerationStep accelerationStep, final LateralDirectionality direction)
  60.     {
  61.         this.accelerationStep = accelerationStep;
  62.         this.direction = direction;
  63.     }

  64.     /**
  65.      * @return the acceleration step.
  66.      */
  67.     public final AccelerationStep getGfmr()
  68.     {
  69.         return this.accelerationStep;
  70.     }

  71.     /**
  72.      * @return laneChange. This has one of the values:
  73.      *         <table ><caption>&nbsp;</caption>
  74.      *         <tr>
  75.      *         <td>null:</td>
  76.      *         <td>Stay in the current lane</td>
  77.      *         </tr>
  78.      *         <tr>
  79.      *         <td>LateralDirectionality.LEFT:</td>
  80.      *         <td>Move to the Left adjacent lane, as seen from the GTU in forward driving direction</td>
  81.      *         </tr>
  82.      *         <tr>
  83.      *         <td>LateralDirectionality.RIGHT:</td>
  84.      *         <td>Move to the Right adjacent lane, as seen from the GTU in forward driving direction</td>
  85.      *         </tr>
  86.      *         </table>
  87.      */
  88.     public final LateralDirectionality getLaneChange()
  89.     {
  90.         return this.direction;
  91.     }

  92.     /** {@inheritDoc} */
  93.     @Override
  94.     public final String toString()
  95.     {
  96.         return this.accelerationStep.toString() + ", "
  97.                 + (null == this.direction ? "no lane change" : this.direction.toString());
  98.     }

  99. }