1 package org.opentrafficsim.road.gtu.lane.tactical;
2
3 /**
4 * Interface for tactical planners that can return synchronization information for visualization.
5 * <p>
6 * Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
7 * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>.
8 * <p>
9 * @version $Revision$, $LastChangedDate$, by $Author$, initial version 23 feb. 2018 <br>
10 * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
11 * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
12 * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
13 */
14 public interface Synchronizable
15 {
16
17 /**
18 * Returns the synchronization state.
19 * @return State; synchronization state
20 */
21 State getSynchronizationState();
22
23 /**
24 * State of synchronization.
25 * <p>
26 * Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
27 * <br>
28 * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>.
29 * <p>
30 * @version $Revision$, $LastChangedDate$, by $Author$, initial version 23 feb. 2018 <br>
31 * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
32 * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
33 * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
34 */
35 enum State
36 {
37 /** No synchronization. */
38 NONE,
39
40 /** Subject vehicle is adjusting speed. */
41 SYNCHRONIZING,
42
43 /** Subject vehicle is adjusting speed and indicating desired lane change. */
44 INDICATING,
45
46 /** Subject vehicle is cooperating for a lane change of another GTU. */
47 COOPERATING;
48
49 /**
50 * Returns whether this is NONE.
51 * @return boolean; whether this is NONE
52 */
53 public boolean isNone()
54 {
55 return this == NONE;
56 }
57
58 /**
59 * Returns whether this is SYNCHRONIZING.
60 * @return boolean; whether this is SYNCHRONIZING
61 */
62 public boolean isSycnhronizing()
63 {
64 return this == SYNCHRONIZING;
65 }
66
67 /**
68 * Returns whether this is INDICATING.
69 * @return boolean; whether this is INDICATING
70 */
71 public boolean isIndicating()
72 {
73 return this == INDICATING;
74 }
75
76 /**
77 * Returns whether this is COOPERATING.
78 * @return boolean; whether this is COOPERATING
79 */
80 public boolean isCooperating()
81 {
82 return this == COOPERATING;
83 }
84 }
85
86 }