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-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
7 * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
8 * </p>
9 * @author <a href="https://github.com/averbraeck">Alexander Verbraeck</a>
10 * @author <a href="https://github.com/peter-knoppers">Peter Knoppers</a>
11 * @author <a href="https://github.com/wjschakel">Wouter Schakel</a>
12 */
13 public interface Synchronizable
14 {
15
16 /**
17 * Returns the synchronization state.
18 * @return synchronization state
19 */
20 State getSynchronizationState();
21
22 /**
23 * State of synchronization.
24 * <p>
25 * Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
26 * <br>
27 * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
28 * </p>
29 * @author <a href="https://github.com/averbraeck">Alexander Verbraeck</a>
30 * @author <a href="https://github.com/peter-knoppers">Peter Knoppers</a>
31 * @author <a href="https://github.com/wjschakel">Wouter Schakel</a>
32 */
33 enum State
34 {
35 /** No synchronization. */
36 NONE,
37
38 /** Subject vehicle is adjusting speed. */
39 SYNCHRONIZING,
40
41 /** Subject vehicle is adjusting speed and indicating desired lane change. */
42 INDICATING,
43
44 /** Subject vehicle is cooperating for a lane change of another GTU. */
45 COOPERATING;
46
47 /**
48 * Returns whether this is NONE.
49 * @return whether this is NONE
50 */
51 public boolean isNone()
52 {
53 return this == NONE;
54 }
55
56 /**
57 * Returns whether this is SYNCHRONIZING.
58 * @return whether this is SYNCHRONIZING
59 */
60 public boolean isSycnhronizing()
61 {
62 return this == SYNCHRONIZING;
63 }
64
65 /**
66 * Returns whether this is INDICATING.
67 * @return whether this is INDICATING
68 */
69 public boolean isIndicating()
70 {
71 return this == INDICATING;
72 }
73
74 /**
75 * Returns whether this is COOPERATING.
76 * @return whether this is COOPERATING
77 */
78 public boolean isCooperating()
79 {
80 return this == COOPERATING;
81 }
82 }
83
84 }