1 package org.djutils.event;
2
3 import java.io.Serializable;
4 import java.rmi.RemoteException;
5 import java.util.List;
6 import java.util.Set;
7
8 import org.djutils.event.reference.Reference;
9 import org.djutils.event.reference.ReferenceType;
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 public class LocalEventProducer implements EventProducer, Serializable
37 {
38
39 private static final long serialVersionUID = 20200207;
40
41
42 private EventListenerMap eventListenerMap = new EventListenerMap();
43
44
45 @Override
46 public EventListenerMap getEventListenerMap()
47 {
48 return this.eventListenerMap;
49 }
50
51
52
53
54
55
56 @Override
57 public boolean addListener(final EventListener listener, final EventType eventType, final int position,
58 final ReferenceType referenceType)
59 {
60 try
61 {
62 return EventProducer.super.addListener(listener, eventType, position, referenceType);
63 }
64 catch (RemoteException exception)
65 {
66 throw new RuntimeException(exception);
67 }
68 }
69
70
71 @Override
72 public boolean addListener(final EventListener listener, final EventType eventType)
73 {
74 try
75 {
76 return EventProducer.super.addListener(listener, eventType);
77 }
78 catch (RemoteException exception)
79 {
80 throw new RuntimeException(exception);
81 }
82 }
83
84
85 @Override
86 public boolean addListener(final EventListener listener, final EventType eventType, final ReferenceType referenceType)
87 {
88 try
89 {
90 return EventProducer.super.addListener(listener, eventType, referenceType);
91 }
92 catch (RemoteException exception)
93 {
94 throw new RuntimeException(exception);
95
96 }
97 }
98
99
100 @Override
101 public boolean addListener(final EventListener listener, final EventType eventType, final int position)
102 {
103 try
104 {
105 return EventProducer.super.addListener(listener, eventType, position);
106 }
107 catch (RemoteException exception)
108 {
109 throw new RuntimeException(exception);
110
111 }
112 }
113
114
115 @Override
116 public int removeAllListeners()
117 {
118 try
119 {
120 return EventProducer.super.removeAllListeners();
121 }
122 catch (RemoteException exception)
123 {
124 throw new RuntimeException(exception);
125
126 }
127 }
128
129
130 @Override
131 public int removeAllListeners(final Class<?> ofClass)
132 {
133 try
134 {
135 return EventProducer.super.removeAllListeners(ofClass);
136 }
137 catch (RemoteException exception)
138 {
139 throw new RuntimeException(exception);
140
141 }
142 }
143
144
145 @Override
146 public boolean removeListener(final EventListener listener, final EventType eventType)
147 {
148 try
149 {
150 return EventProducer.super.removeListener(listener, eventType);
151 }
152 catch (RemoteException exception)
153 {
154 throw new RuntimeException(exception);
155
156 }
157 }
158
159
160 @Override
161 public boolean hasListeners()
162 {
163 try
164 {
165 return EventProducer.super.hasListeners();
166 }
167 catch (RemoteException exception)
168 {
169 throw new RuntimeException(exception);
170
171 }
172 }
173
174
175 @Override
176 public int numberOfListeners(final EventType eventType)
177 {
178 try
179 {
180 return EventProducer.super.numberOfListeners(eventType);
181 }
182 catch (RemoteException exception)
183 {
184 throw new RuntimeException(exception);
185
186 }
187 }
188
189
190 @Override
191 public List<Reference<EventListener>> getListenerReferences(final EventType eventType)
192 {
193 try
194 {
195 return EventProducer.super.getListenerReferences(eventType);
196 }
197 catch (RemoteException exception)
198 {
199 throw new RuntimeException(exception);
200
201 }
202 }
203
204
205 @Override
206 public Set<EventType> getEventTypesWithListeners()
207 {
208 try
209 {
210 return EventProducer.super.getEventTypesWithListeners();
211 }
212 catch (RemoteException exception)
213 {
214 throw new RuntimeException(exception);
215
216 }
217 }
218
219
220 @Override
221 public void fireEvent(final Event event)
222 {
223 try
224 {
225 EventProducer.super.fireEvent(event);
226 }
227 catch (RemoteException exception)
228 {
229 throw new RuntimeException(exception);
230
231 }
232 }
233
234
235 @Override
236 public <C extends Comparable<C> & Serializable> void fireTimedEvent(final TimedEvent<C> event)
237 {
238 try
239 {
240 EventProducer.super.fireTimedEvent(event);
241 }
242 catch (RemoteException exception)
243 {
244 throw new RuntimeException(exception);
245
246 }
247 }
248
249
250 @Override
251 public void fireEvent(final EventType eventType)
252 {
253 try
254 {
255 EventProducer.super.fireEvent(eventType);
256 }
257 catch (RemoteException exception)
258 {
259 throw new RuntimeException(exception);
260
261 }
262 }
263
264
265 @Override
266 public <C extends Comparable<C> & Serializable> void fireTimedEvent(final EventType eventType, final C time)
267 {
268 try
269 {
270 EventProducer.super.fireTimedEvent(eventType, time);
271 }
272 catch (RemoteException exception)
273 {
274 throw new RuntimeException(exception);
275
276 }
277 }
278
279
280 @Override
281 public void fireEvent(final EventType eventType, final Serializable value)
282 {
283 try
284 {
285 EventProducer.super.fireEvent(eventType, value);
286 }
287 catch (RemoteException exception)
288 {
289 throw new RuntimeException(exception);
290
291 }
292 }
293
294
295 @Override
296 public <C extends Comparable<C> & Serializable> void fireTimedEvent(final EventType eventType, final Serializable value,
297 final C time)
298
299 {
300 try
301 {
302 EventProducer.super.fireTimedEvent(eventType, value, time);
303 }
304 catch (RemoteException exception)
305 {
306 throw new RuntimeException(exception);
307
308 }
309 }
310
311
312 @Override
313 public void fireUnverifiedEvent(final EventType eventType)
314 {
315 try
316 {
317 EventProducer.super.fireUnverifiedEvent(eventType);
318 }
319 catch (RemoteException exception)
320 {
321 throw new RuntimeException(exception);
322
323 }
324 }
325
326
327 @Override
328 public <C extends Comparable<C> & Serializable> void fireUnverifiedTimedEvent(final EventType eventType, final C time)
329
330 {
331 try
332 {
333 EventProducer.super.fireUnverifiedTimedEvent(eventType, time);
334 }
335 catch (RemoteException exception)
336 {
337 throw new RuntimeException(exception);
338
339 }
340 }
341
342
343 @Override
344 public void fireUnverifiedEvent(final EventType eventType, final Serializable value)
345 {
346 try
347 {
348 EventProducer.super.fireUnverifiedEvent(eventType, value);
349 }
350 catch (RemoteException exception)
351 {
352 throw new RuntimeException(exception);
353
354 }
355 }
356
357
358 @Override
359 public <C extends Comparable<C> & Serializable> void fireUnverifiedTimedEvent(final EventType eventType,
360 final Serializable value, final C time)
361 {
362 try
363 {
364 EventProducer.super.fireUnverifiedTimedEvent(eventType, value, time);
365 }
366 catch (RemoteException exception)
367 {
368 throw new RuntimeException(exception);
369
370 }
371 }
372
373 }