1 package org.djutils.event;
2
3 import java.io.Serializable;
4
5 /**
6 * The Event class forms the reference implementation for the EventInterface. Because events are often sent over the network,
7 * the interface demands that source of the event and its content are serializable. It is the responsibility of the programmer,
8 * though, that the <b>fields</b> of the sourceId and content are serializable as well.
9 * <p>
10 * Copyright (c) 2002-2022 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>. This class was
14 * originally part of the DSOL project, see <a href="https://simulation.tudelft.nl/dsol/manual" target="_blank">
15 * https://simulation.tudelft.nl/dsol/manual</a>.
16 * </p>
17 * @author <a href="https://www.tudelft.nl/averbraeck">Alexander Verbraeck</a>
18 */
19 public class Event extends AbstractEvent
20 {
21 /** */
22 private static final long serialVersionUID = 20200505L;
23
24 /**
25 * Construct a new Event, where compliance with the metadata is verified.
26 * @param type EventTypeInterface; the name of the Event.
27 * @param sourceId Serializable; the source id of the sender
28 * @param content Serializable; the content of the event
29 */
30 public Event(final EventTypeInterface type, final Serializable sourceId, final Serializable content)
31 {
32 super(type, sourceId, content);
33 }
34
35 /**
36 * Construct a new Event, with a choice to verify compliance with metadata.
37 * @param type EventTypeInterface; the name of the Event.
38 * @param sourceId Serializable; the source id of the sender
39 * @param content Serializable; the content of the event
40 * @param verifyMetaData boolean; whether to verify the compliance with metadata or not
41 */
42 public Event(final EventTypeInterface type, final Serializable sourceId, final Serializable content,
43 final boolean verifyMetaData)
44 {
45 super(type, sourceId, content, verifyMetaData);
46 }
47
48 /** {@inheritDoc} */
49 @Override
50 public String toString()
51 {
52 return "[" + this.getClass().getName() + ";" + this.getType() + ";" + this.getSourceId() + ";" + this.getContent()
53 + "]";
54 }
55
56 }