1 package org.opentrafficsim.road.gtu.lane.plan.operational;
2
3 import java.io.Serializable;
4
5 import org.djunits.value.vdouble.scalar.Acceleration;
6 import org.opentrafficsim.core.network.LateralDirectionality;
7
8 /**
9 * Simplified plan containing only an acceleration value and possible lane change direction.
10 * <p>
11 * Copyright (c) 2013-2016 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/current/license.html">OpenTrafficSim License</a>.
13 * <p>
14 * @version $Revision$, $LastChangedDate$, by $Author$, initial version Jul 26, 2016 <br>
15 * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
16 * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
17 * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
18 */
19
20 public class SimpleOperationalPlan implements Serializable
21 {
22
23 /** */
24 private static final long serialVersionUID = 20160811L;
25
26 /** Acceleration. */
27 private Acceleration acceleration;
28
29 /** Lane change direction. */
30 private final LateralDirectionality laneChangeDirection;
31
32 /**
33 * @param acceleration acceleration
34 */
35 public SimpleOperationalPlan(final Acceleration acceleration)
36 {
37 this.acceleration = acceleration;
38 this.laneChangeDirection = null;
39 }
40
41 /**
42 * @param acceleration acceleration
43 * @param laneChangeDirection lane change direction, may be {@code null}.
44 */
45 public SimpleOperationalPlan(final Acceleration acceleration, final LateralDirectionality laneChangeDirection)
46 {
47 this.acceleration = acceleration;
48 this.laneChangeDirection = laneChangeDirection;
49 }
50
51 /**
52 * @return acceleration.
53 */
54 public final Acceleration getAcceleration()
55 {
56 return this.acceleration;
57 }
58
59 /**
60 * @return laneChangeDirection, may be {@code null} if no lane change.
61 */
62 public final LateralDirectionality getLaneChangeDirection()
63 {
64 return this.laneChangeDirection;
65 }
66
67 /**
68 * Set minimum of current and given acceleration.
69 * @param a acceleration to set if lower than current acceleration
70 */
71 public final void minimumAcceleration(final Acceleration a)
72 {
73 this.acceleration = Acceleration.min(this.acceleration, a);
74 }
75
76 /** {@inheritDoc} */
77 @SuppressWarnings("checkstyle:designforextension")
78 public String toString()
79 {
80 return "SimpleOperationalPlan [Acceleration=" + this.acceleration + ", change=" + this.laneChangeDirection + "]";
81 }
82
83 }