1
2
3
4
5
6
7 package nl.tudelft.simulation.event;
8
9 /***
10 * The Event class forms the reference implementation for the EventInterface.
11 * <p>
12 * (c) copyright 2002-2005 <a href="http://www.simulation.tudelft.nl">Delft
13 * University of Technology </a>, the Netherlands.
14 * <p>
15 * See for project information <a
16 * href="http://www.simulation.tudelft.nl/dsol/event">www.simulation.tudelft.nl/event
17 * </a> <br>
18 * License of use: <a href="http://www.gnu.org/copyleft/lesser.html">Lesser
19 * General Public License (LGPL) </a>, no warranty
20 *
21 * @author <a href="http://www.peter-jacobs.com/index.htm">Peter Jacobs </a>
22 * @version $Revision: 1.6 $ $Date: 2005/08/04 12:08:32 $
23 * @since 1.5
24 */
25 public class Event implements EventInterface
26 {
27 /*** type is the type of the event */
28 protected EventType type;
29
30 /*** content refers to the content of the event */
31 protected Object content;
32
33 /*** the source of an event */
34 protected Object source;
35
36 /***
37 * constructs a new Event.
38 *
39 * @param type the name of the Event.
40 * @param source the source of the sender.
41 * @param content the content of the event.
42 */
43 public Event(final EventType type, final Object source, final Object content)
44 {
45 this.type = type;
46 this.source = source;
47 this.content = content;
48 }
49
50 /***
51 * @see nl.tudelft.simulation.event.EventInterface#getSource()
52 */
53 public Object getSource()
54 {
55 return this.source;
56 }
57
58 /***
59 * @see nl.tudelft.simulation.event.EventInterface#getContent()
60 */
61 public Object getContent()
62 {
63 return this.content;
64 }
65
66 /***
67 * @see nl.tudelft.simulation.event.EventInterface#getType()
68 */
69 public EventType getType()
70 {
71 return this.type;
72 }
73
74 /***
75 * @see java.lang.Object#toString()
76 */
77 @Override
78 public String toString()
79 {
80 return "[" + this.getClass().getName() + ";" + this.getType() + ";"
81 + this.getSource() + ";" + this.getContent() + "]";
82 }
83 }