1 package org.djutils.stats.summarizers.event;
2
3 import org.djutils.event.EventType;
4 import org.djutils.metadata.MetaData;
5 import org.djutils.metadata.ObjectDescriptor;
6
7 /**
8 * StatisticsEvents defines the standard events for statistics. <br>
9 * <br>
10 * Copyright (c) 2020-2025 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See
11 * for project information <a href="https://djutils.org" target="_blank"> https://djutils.org</a>. The DJUTILS project is
12 * distributed under a three-clause BSD-style license, which can be found at
13 * <a href="https://djutils.org/docs/license.html" target="_blank"> https://djutils.org/docs/license.html</a>. <br>
14 * @author <a href="https://www.tudelft.nl/averbraeck">Alexander Verbraeck</a>
15 * @author <a href="https://www.tudelft.nl/pknoppers">Peter Knoppers</a>
16 */
17 public final class StatisticsEvents
18 {
19
20 /** Utility constructor. */
21 private StatisticsEvents()
22 {
23 // Utility constructor
24 }
25
26 /**
27 * INITIALIZED_EVENT is fired whenever a statistic is (re-)initialized. The event should define the Statistic as the source
28 * and null as the content.
29 */
30 public static final EventType INITIALIZED_EVENT =
31 new EventType("INITIALIZED_EVENT", new MetaData("No arguments", "null", new ObjectDescriptor[0]));
32
33 /**
34 * OBSERVATION_ADDED_EVENT is fired whenever an observation is processed. The event should define the Statistic as the
35 * source and the observation value as the content.
36 */
37 public static final EventType OBSERVATION_ADDED_EVENT =
38 new EventType("OBSERVATION_ADDED_EVENT", new MetaData("Ingested value", "Ingested Number value",
39 new ObjectDescriptor("Ingested value", "Ingested Number value", Number.class)));
40
41 /**
42 * WEIGTHED_OBSERVATION_ADDED_EVENT is fired whenever a weighted observation is processed. The event should define the
43 * Statistic as the source and an Object[] with { weight, observation_value } as the content.
44 */
45 public static final EventType WEIGHTED_OBSERVATION_ADDED_EVENT = new EventType("WEIGHTED_OBSERVATION_ADDED_EVENT",
46 new MetaData("Weight and value", "Double Weight and Double value",
47 new ObjectDescriptor[] {new ObjectDescriptor("Weight", "Double weight", Double.class),
48 new ObjectDescriptor("Value", "Double value", Double.class)}));
49
50 /**
51 * OBSERVATION_ADDED_EVENT is fired whenever an observation is processed. The event should define the Statistic as the
52 * source and an Object[] with { timestamp, observation_value } as the content. This event is also fired at the end of the
53 * observations to signal the final values.
54 */
55 public static final EventType TIMESTAMPED_OBSERVATION_ADDED_EVENT = new EventType("TIMESTAMPED_OBSERVATION_ADDED_EVENT",
56 new MetaData("Time stamp and value", "Time stamp and Double value",
57 new ObjectDescriptor[] {new ObjectDescriptor("TimeStamp", "Time stamp", Object.class),
58 new ObjectDescriptor("Value", "Double value", Double.class)}));
59
60 /* The following statistics are, e.g., used to draw graphs of the development of a statistical value. */
61
62 /**
63 * N_EVENT is fired whenever n is updated. The event should define the Statistic as the source and the current (Long) value
64 * of n as the content.
65 */
66 public static final EventType N_EVENT = new EventType("N_EVENT", new MetaData("count", "Number of registered events",
67 new ObjectDescriptor("eventCount", "Long event count", Long.class)));
68
69 /**
70 * COUNT_EVENT is fired whenever there is an observation that potentially updates the count of the Counter. The event should
71 * define the Statistic as the source and the current (Long) count value as the content.
72 */
73 public static final EventType COUNT_EVENT = new EventType("COUNT_EVENT", new MetaData("count",
74 "Number of registered events", new ObjectDescriptor("count", "Number of registered events", Long.class)));
75
76 /**
77 * MIN_EVENT is fired whenever there is an observation that potentially updates the lowest observed value of the statistic.
78 * The event should define the Statistic as the source and the current minimum observed value as the content.
79 */
80 public static final EventType MIN_EVENT = new EventType("MIN_EVENT", new MetaData("Minimum value", "Minimum Double value",
81 new ObjectDescriptor("Minimum value", "Minimum Double value", Double.class)));
82
83 /**
84 * MAX_EVENT is fired whenever there is an observation that potentially updates the highest observed value of the statistic.
85 * The event should define the Statistic as the source and the current maximum observed value as the content.
86 */
87 public static final EventType MAX_EVENT = new EventType("MAX_EVENT", new MetaData("Maximum value", "Maximum Double value",
88 new ObjectDescriptor("Maximum value", "Maximum Double value", Double.class)));
89
90 /**
91 * MEAN_EVENT is fired whenever there is an observation that potentially updates the population mean value of the statistic.
92 * The event should define the Statistic as the source and the current population mean as the content.
93 */
94 public static final EventType POPULATION_MEAN_EVENT = new EventType("POPULATION_MEAN_EVENT", new MetaData("Mean value",
95 "Mean Double value", new ObjectDescriptor("Mean value", "Mean Double value", Double.class)));
96
97 /**
98 * VARIANCE_EVENT is fired whenever there is an observation that potentially updates the population variance of the
99 * statistic. The event should define the Statistic as the source and the current population variance as the content.
100 */
101 public static final EventType POPULATION_VARIANCE_EVENT =
102 new EventType("POPULATION_VARIANCE_EVENT", new MetaData("Variance value", "Variance Double value",
103 new ObjectDescriptor("Variance value", "Variance Double value", Double.class)));
104
105 /**
106 * SKEWNESS_EVENT is fired whenever there is an observation that potentially updates the population skewness of the
107 * statistic. The event should define the Statistic as the source and the current population skewness as the content.
108 */
109 public static final EventType POPULATION_SKEWNESS_EVENT =
110 new EventType("POPULATION_SKEWNESS_EVENT", new MetaData("Skewness value", "Skewness Double value",
111 new ObjectDescriptor("Skewness value", "Skewness Double value", Double.class)));
112
113 /**
114 * KURTOSIS_EVENT is fired whenever there is an observation that potentially updates the population kurtosis of the
115 * statistic. The event should define the Statistic as the source and the current population kurtosis as the content.
116 */
117 public static final EventType POPULATION_KURTOSIS_EVENT =
118 new EventType("POPULATION_KURTOSIS_EVENT", new MetaData("Kurtosis value", "Kurtosis Double value",
119 new ObjectDescriptor("Kurtosis value", "Kurtosis Double value", Double.class)));
120
121 /**
122 * EXCESS_KURTOSIS_EVENT is fired whenever there is an observation that potentially updates the population excess kurtosis
123 * of the statistic. The event should define the Statistic as the source and the current population excess kurtosis as the
124 * content.
125 */
126 public static final EventType POPULATION_EXCESS_KURTOSIS_EVENT = new EventType("POPULATION_EXCESS_KURTOSIS_EVENT",
127 new MetaData("Excess kurtosis value", "Excess kurtosis Double value",
128 new ObjectDescriptor("Excess kurtosis value", "Excess kurtosis Double value", Double.class)));
129
130 /**
131 * STDEV_EVENT is fired whenever there is an observation that potentially updates the population standard deviation of the
132 * statistic. The event should define the Statistic as the source and the current population standard deviation as the
133 * content.
134 */
135 public static final EventType POPULATION_STDEV_EVENT = new EventType("POPULATION_STDEV_EVENT", new MetaData("StdDev value",
136 "StdDev Double value", new ObjectDescriptor("StdDev value", "StdDev Double value", Double.class)));
137
138 /**
139 * SUM_EVENT is fired whenever there is an observation that potentially updates the sum value of the statistic. The event
140 * should define the Statistic as the source and the current sum as the content.
141 */
142 public static final EventType SUM_EVENT = new EventType("SUM_EVENT",
143 new MetaData("Sum value", "Sum Double value", new ObjectDescriptor("Sum value", "Sum Double value", Double.class)));
144
145 /**
146 * SAMPLE_MEAN_EVENT is fired whenever there is an observation that potentially updates the sample mean value of the
147 * statistic. The event should define the Statistic as the source and the current sample mean as the content.
148 */
149 public static final EventType SAMPLE_MEAN_EVENT = new EventType("SAMPLE_MEAN_EVENT", new MetaData("Sample mean value",
150 "Sample mean Double value", new ObjectDescriptor("Sample mean value", "Sample mean Double value", Double.class)));
151
152 /**
153 * SAMPLE_VARIANCE_EVENT is fired whenever there is an observation that potentially updates the sample variance of the
154 * statistic. The event should define the Statistic as the source and the current sample variance as the content.
155 */
156 public static final EventType SAMPLE_VARIANCE_EVENT =
157 new EventType("SAMPLE_VARIANCE_EVENT", new MetaData("Sample variance value", "Sample variance Double value",
158 new ObjectDescriptor("Sample variance value", "Sample variance Double value", Double.class)));
159
160 /**
161 * SAMPLE_SKEWNESS_EVENT is fired whenever there is an observation that potentially updates the sample skewness of the
162 * statistic. The event should define the Statistic as the source and the current sample skewness as the content.
163 */
164 public static final EventType SAMPLE_SKEWNESS_EVENT =
165 new EventType("SAMPLE_SKEWNESS_EVENT", new MetaData("Sample skewness value", "Sample skewness Double value",
166 new ObjectDescriptor("Sample skewness value", "Sample skewness Double value", Double.class)));
167
168 /**
169 * SAMPLE_KURTOSIS_EVENT is fired whenever there is an observation that potentially updates the sample kurtosis of the
170 * statistic. The event should define the Statistic as the source and the current sample kurtosis as the content.
171 */
172 public static final EventType SAMPLE_KURTOSIS_EVENT =
173 new EventType("SAMPLE_KURTOSIS_EVENT", new MetaData("Sample kurtosis value", "Sample kurtosis Double value",
174 new ObjectDescriptor("sample kurtosis value", "Sample kurtosis Double value", Double.class)));
175
176 /**
177 * SAMPLE_KURTOSIS_EVENT is fired whenever there is an observation that potentially updates the sample excess kurtosis of
178 * the statistic. The event should define the Statistic as the source and the current sample excess kurtosis as the content.
179 */
180 public static final EventType SAMPLE_EXCESS_KURTOSIS_EVENT = new EventType("SAMPLE_EXCESS_KURTOSIS_EVENT",
181 new MetaData("Sample excess kurtosis value", "Sample excess kurtosis Double value",
182 new ObjectDescriptor("Sample excess kurtosis value", "Sample excess kurtosis Double value", Double.class)));
183
184 /**
185 * SAMPLE_STDEV_EVENT is fired whenever there is an observation that potentially updates the sample standard deviation of
186 * the statistic. The event should define the Statistic as the source and the current sample standard deviation as the
187 * content.
188 */
189 public static final EventType SAMPLE_STDEV_EVENT =
190 new EventType("SAMPLE_STDEV_EVENT", new MetaData("Sample stdDev value", "Sample stdDev Double value",
191 new ObjectDescriptor("Sample stdDev value", "Sample stdDev Double value", Double.class)));
192
193 /**
194 * WEIGHTED_MEAN_EVENT is fired whenever there is an observation that potentially updates the weighted population mean value
195 * of the statistic. The event should define the Statistic as the source and the current weighted population mean as the
196 * content.
197 */
198 public static final EventType WEIGHTED_POPULATION_MEAN_EVENT = new EventType("WEIGHTED_POPULATION_MEAN_EVENT", new MetaData(
199 "Weighted population mean value", "Weighed population mean Double value",
200 new ObjectDescriptor("Weighted population mean value", "Weighted population mean Double value", Double.class)));
201
202 /**
203 * WEIGHTED_VARIANCE_EVENT is fired whenever there is an observation that potentially updates the weighted population
204 * variance of the statistic. The event should define the Statistic as the source and the current weighted population
205 * variance as the content.
206 */
207 public static final EventType WEIGHTED_POPULATION_VARIANCE_EVENT = new EventType("WEIGHTED_POPULATION_VARIANCE_EVENT",
208 new MetaData("Weighted population variance value", "Weighted population variance Double value",
209 new ObjectDescriptor("Weighted population variance value", "Weighted population variance Double value",
210 Double.class)));
211
212 /**
213 * WEIGHTED_STDEV_EVENT is fired whenever there is an observation that potentially updates the weighted population standard
214 * deviation of the statistic. The event should define the Statistic as the source and the current weighted population
215 * standard deviation as the content.
216 */
217 public static final EventType WEIGHTED_POPULATION_STDEV_EVENT =
218 new EventType("WEIGHTED_POPULATION_STDEV_EVENT",
219 new MetaData("Weighted population stdDev value", "Weighted population stdDev Double value",
220 new ObjectDescriptor("Weighted population stdDev value", "Weighted population stdDev Double value",
221 Double.class)));
222
223 /**
224 * WEIGHTED_SUM_EVENT is fired whenever there is an observation that potentially updates the weighted sum value of the
225 * statistic. The event should define the Statistic as the source and the current weighted sum as the content.
226 */
227 public static final EventType WEIGHTED_SUM_EVENT =
228 new EventType("WEIGHTED_SUM_EVENT", new MetaData("Weighted sum value", "Weighted sum Double value",
229 new ObjectDescriptor("Weighted sum value", "Weighted sum Double value", Double.class)));
230
231 /**
232 * WEIGHTED_SAMPLE_MEAN_EVENT is fired whenever there is an observation that potentially updates the weighted sample mean
233 * value of the statistic. The event should define the Statistic as the source and the current weighted sample mean as the
234 * content.
235 */
236 public static final EventType WEIGHTED_SAMPLE_MEAN_EVENT = new EventType("WEIGHTED_SAMPLE_MEAN_EVENT",
237 new MetaData("Weighted sample mean value", "Weighted sample mean Double value",
238 new ObjectDescriptor("Weighted sample mean value", "Weighted sample mean Double value", Double.class)));
239
240 /**
241 * WEIGHTED_SAMPLE_VARIANCE_EVENT is fired whenever there is an observation that potentially updates the weighted sample
242 * variance of the statistic. The event should define the Statistic as the source and the current weighted sample variance
243 * as the content.
244 */
245 public static final EventType WEIGHTED_SAMPLE_VARIANCE_EVENT = new EventType("WEIGHTED_SAMPLE_VARIANCE_EVENT", new MetaData(
246 "Weighted sample variance value", "Weighted sample variance Double value",
247 new ObjectDescriptor("Weighted sample variance value", "Weighted sample variance Double value", Double.class)));
248
249 /**
250 * WEIGHTED_SAMPLE_STDEV_EVENT is fired whenever there is an observation that potentially updates the weighted sample
251 * standard deviation of the statistic. The event should define the Statistic as the source and the current weighted sample
252 * standard deviation as the content.
253 */
254 public static final EventType WEIGHTED_SAMPLE_STDEV_EVENT = new EventType("WEIGHTED_SAMPLE_STDEV_EVENT",
255 new MetaData("Weighted sample stdDev value", "Weighted sample stdDev Double value",
256 new ObjectDescriptor("Weighted sample stdDev value", "Weighted sample stdDev Double value", Double.class)));
257
258 /* ********************* TIMESTANPED VERSIONS OF EVENTS FOR THE TIMESTAMPWEIGHTEDTALLY ************************ */
259
260 /**
261 * TIMED_N_EVENT is fired whenever n is updated. The event should define the Statistic as the source and the current (Long)
262 * value of n as the content.
263 */
264 public static final EventType TIMED_N_EVENT = new EventType("TIMED_N_EVENT", new MetaData("count",
265 "Number of registered events", new ObjectDescriptor("eventCount", "Long event count", Long.class)));
266
267 /**
268 * TIMED_MIN_EVENT is fired whenever there is an observation that potentially updates the lowest observed value of the
269 * statistic. The event should define the Statistic as the source and the current minimum observed value as the content.
270 */
271 public static final EventType TIMED_MIN_EVENT = new EventType("TIMED_MIN_EVENT", new MetaData("Minimum value",
272 "Minimum Double value", new ObjectDescriptor("Minimum value", "Minimum Double value", Double.class)));
273
274 /**
275 * TIMED_MAX_EVENT is fired whenever there is an observation that potentially updates the highest observed value of the
276 * statistic. The event should define the Statistic as the source and the current maximum observed value as the content.
277 */
278 public static final EventType TIMED_MAX_EVENT = new EventType("TIMED_MAX_EVENT", new MetaData("Maximum value",
279 "Maximum Double value", new ObjectDescriptor("Maximum value", "Maximum Double value", Double.class)));
280
281 /**
282 * TIMED_WEIGHTED_MEAN_EVENT is fired whenever there is an observation that potentially updates the weighted population mean
283 * value of the statistic. The event should define the Statistic as the source and the current weighted population mean as
284 * the content.
285 */
286 public static final EventType TIMED_WEIGHTED_POPULATION_MEAN_EVENT = new EventType("TIMED_WEIGHTED_POPULATION_MEAN_EVENT",
287 new MetaData("Weighted population mean value", "Weighed population mean Double value", new ObjectDescriptor(
288 "Weighted population mean value", "Weighted population mean Double value", Double.class)));
289
290 /**
291 * TIMED_WEIGHTED_VARIANCE_EVENT is fired whenever there is an observation that potentially updates the weighted population
292 * variance of the statistic. The event should define the Statistic as the source and the current weighted population
293 * variance as the content.
294 */
295 public static final EventType TIMED_WEIGHTED_POPULATION_VARIANCE_EVENT =
296 new EventType("TIMED_WEIGHTED_POPULATION_VARIANCE_EVENT",
297 new MetaData("Weighted population variance value", "Weighted population variance Double value",
298 new ObjectDescriptor("Weighted population variance value",
299 "Weighted population variance Double value", Double.class)));
300
301 /**
302 * TIMED_WEIGHTED_STDEV_EVENT is fired whenever there is an observation that potentially updates the weighted population
303 * standard deviation of the statistic. The event should define the Statistic as the source and the current weighted
304 * population standard deviation as the content.
305 */
306 public static final EventType TIMED_WEIGHTED_POPULATION_STDEV_EVENT =
307 new EventType("TIMED_WEIGHTED_POPULATION_STDEV_EVENT",
308 new MetaData("Weighted population stdDev value", "Weighted population stdDev Double value",
309 new ObjectDescriptor("Weighted population stdDev value", "Weighted population stdDev Double value",
310 Double.class)));
311
312 /**
313 * TIMED_WEIGHTED_SUM_EVENT is fired whenever there is an observation that potentially updates the weighted sum value of the
314 * statistic. The event should define the Statistic as the source and the current weighted sum as the content.
315 */
316 public static final EventType TIMED_WEIGHTED_SUM_EVENT =
317 new EventType("TIMED_WEIGHTED_SUM_EVENT", new MetaData("Weighted sum value", "Weighted sum Double value",
318 new ObjectDescriptor("Weighted sum value", "Weighted sum Double value", Double.class)));
319
320 /**
321 * TIMED_WEIGHTED_SAMPLE_MEAN_EVENT is fired whenever there is an observation that potentially updates the weighted sample
322 * mean value of the statistic. The event should define the Statistic as the source and the current weighted sample mean as
323 * the content.
324 */
325 public static final EventType TIMED_WEIGHTED_SAMPLE_MEAN_EVENT = new EventType("TIMED_WEIGHTED_SAMPLE_MEAN_EVENT",
326 new MetaData("Weighted sample mean value", "Weighted sample mean Double value",
327 new ObjectDescriptor("Weighted sample mean value", "Weighted sample mean Double value", Double.class)));
328
329 /**
330 * TIMED_WEIGHTED_SAMPLE_VARIANCE_EVENT is fired whenever there is an observation that potentially updates the weighted
331 * sample variance of the statistic. The event should define the Statistic as the source and the current weighted sample
332 * variance as the content.
333 */
334 public static final EventType TIMED_WEIGHTED_SAMPLE_VARIANCE_EVENT =
335 new EventType("TIMED_WEIGHTED_SAMPLE_VARIANCE_EVENT",
336 new MetaData("Weighted sample variance value", "Weighted sample variance Double value",
337 new ObjectDescriptor("Weighted sample variance value", "Weighted sample variance Double value",
338 Double.class)));
339
340 /**
341 * TIMED_WEIGHTED_SAMPLE_STDEV_EVENT is fired whenever there is an observation that potentially updates the weighted sample
342 * standard deviation of the statistic. The event should define the Statistic as the source and the current weighted sample
343 * standard deviation as the content.
344 */
345 public static final EventType TIMED_WEIGHTED_SAMPLE_STDEV_EVENT = new EventType("TIMED_WEIGHTED_SAMPLE_STDEV_EVENT",
346 new MetaData("Weighted sample stdDev value", "Weighted sample stdDev Double value",
347 new ObjectDescriptor("Weighted sample stdDev value", "Weighted sample stdDev Double value", Double.class)));
348
349 }