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