1 package org.opentrafficsim.trafficcontrol;
2
3 import org.djutils.event.EventListener;
4 import org.djutils.event.EventProducer;
5 import org.djutils.event.EventType;
6 import org.djutils.metadata.MetaData;
7 import org.djutils.metadata.ObjectDescriptor;
8 import org.opentrafficsim.core.object.NonLocatedObject;
9 import org.opentrafficsim.road.network.lane.object.trafficlight.TrafficLightColor;
10
11
12
13
14
15
16
17
18
19
20
21 public interface TrafficController extends EventProducer, EventListener, NonLocatedObject
22 {
23
24
25
26
27 @Override
28 String getId();
29
30
31 String STARTING_UP = "starting up";
32
33
34 String BEING_CLONED = "being cloned";
35
36
37 String RUNNING = "running";
38
39
40 String SHUTTING_DOWN = "shutting down";
41
42
43 String OFF = "off";
44
45
46 int NO_STREAM = -1;
47
48
49
50
51
52 EventType TRAFFICCONTROL_CONTROLLER_CREATED = new EventType("TRAFFICCONTROL.CONTROLLER_CREATED",
53 new MetaData("Controller created", "Controller id, initial state",
54 new ObjectDescriptor("Controller id", "Id of the controller", String.class),
55 new ObjectDescriptor("Initial state", "Initial state", String.class)));
56
57
58
59
60
61
62 EventType TRAFFICCONTROL_CONTROLLER_EVALUATING =
63 new EventType("TRAFFICCONTROL.CONTROLLER_EVALUATING", new MetaData("Controller eveluating", "Controller id",
64 new ObjectDescriptor("Controller id", "Id of the controller", String.class)));
65
66
67
68
69
70 EventType TRAFFICCONTROL_CONTROLLER_WARNING = new EventType("TRAFFICCONTROL.CONTROLLER_WARNING",
71 new MetaData("Controller warning", "Controller id, warning message",
72 new ObjectDescriptor("Controller id", "Id of the controller", String.class),
73 new ObjectDescriptor("Message", "Message", String.class)));
74
75
76
77
78
79
80 EventType TRAFFICCONTROL_STATE_CHANGED = new EventType("TRAFFIC_CONTROL.STATE_CHANGED",
81 new MetaData("Controller state changed", "Controller id, old state, new state",
82 new ObjectDescriptor("Controller id", "Id of the controller", String.class),
83 new ObjectDescriptor("Old state", "Old state", String.class),
84 new ObjectDescriptor("New state", "New state", String.class)));
85
86
87
88
89
90 EventType TRAFFIC_LIGHT_CHANGED = new EventType("TrafficLightChanged",
91 new MetaData("Controller state changed", "Controller id, old state, new state",
92 new ObjectDescriptor("Controller id", "Id of the controller", String.class),
93 new ObjectDescriptor("Stream", "Stream number", Short.class),
94 new ObjectDescriptor("Light color", "New traffic light color", TrafficLightColor.class)));
95
96
97
98
99
100
101
102 EventType TRAFFICCONTROL_VARIABLE_CREATED = new EventType("TRAFFICCONTROL.VARIABLE_CREATED",
103 new MetaData("Controller state changed", "Controller id, old state, new state",
104 new ObjectDescriptor("Controller id", "Id of the controller", String.class),
105 new ObjectDescriptor("Variable id", "Id of the variable", String.class),
106 new ObjectDescriptor("Stream", "Stream number", Short.class),
107 new ObjectDescriptor("Initial value", "Initial value", Double.class)));
108
109
110
111
112
113
114
115
116
117
118
119
120 EventType TRAFFICCONTROL_SET_TRACING = new EventType("TRAFFICCONTROL.SET_TRACING",
121 new MetaData("Controller state changed", "Controller id, old state, new state",
122 new ObjectDescriptor("Controller id", "Id of the controller", String.class),
123 new ObjectDescriptor("Variable id", "Id of the variable", String.class),
124 new ObjectDescriptor("Stream", "Stream number", Short.class),
125 new ObjectDescriptor("Trace", "Trace", Boolean.class)));
126
127
128
129
130
131
132
133
134
135 EventType TRAFFICCONTROL_TRACED_VARIABLE_UPDATED = new EventType("TRAFFICCONTROL.VARIABLE_UPDATED",
136 new MetaData("Controller state changed", "Controller id, old state, new state",
137 new ObjectDescriptor("Controller id", "Id of the controller", String.class),
138 new ObjectDescriptor("Variable id", "Id of the variable", String.class),
139 new ObjectDescriptor("Stream", "Stream number", Short.class),
140 new ObjectDescriptor("Old value", "Old value", Double.class),
141 new ObjectDescriptor("New value", "New value", Double.class),
142 new ObjectDescriptor("Expression", "Expression or description", String.class)));
143
144
145
146
147
148
149
150
151
152
153
154
155 EventType TRAFFICCONTROL_CONFLICT_GROUP_CHANGED = new EventType("TRAFFICCONTROL.CONFLICT_GROUP_CHANGED",
156 new MetaData("Controller state changed", "Controller id, old state, new state",
157 new ObjectDescriptor("Controller id", "Id of the controller", String.class),
158 new ObjectDescriptor("Old stream", "Old conflict group stream", String.class),
159 new ObjectDescriptor("New stream", "New conflict group stream", String.class)));
160
161 }