View Javadoc

1   /*
2    * @(#)Event April 4, 2003
3    * 
4    * Copyright (c) 2003-2004 Delft University of Technology Jaffalaan 5, 2628 BX
5    * Delft, the Netherlands. All rights reserved.
6    * 
7    * This software is proprietary information of Delft University of Technology
8    * The code is published under the General Public License
9    */
10  package nl.tudelft.simulation.event;
11  
12  /***
13   * The Event class forms the reference implementation for the EventInterface.
14   * <p>
15   * (c) copyright 2003 <a href="http://www.simulation.tudelft.nl">Delft
16   * University of Technology </a>, the Netherlands. <br>
17   * See for project information <a
18   * href="http://www.simulation.tudelft.nl">www.simulation.tudelft.nl </a> <br>
19   * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
20   * License (GPL) </a>, no warranty <br>
21   * 
22   * @author <a href="http://www.tbm.tudelft.nl/webstaf/peterja/index.htm">Peter
23   *         Jacobs </a>
24   * @version 1.2 Apr 26, 2004
25   * @since 1.4
26   */
27  public class Event implements EventInterface
28  {
29  
30  	/***
31  	 * type is the type of the event
32  	 * 
33  	 * @uml.property name="type"
34  	 */
35  	protected EventType type;
36  
37  	/***
38  	 * content refers to the content of the event
39  	 * 
40  	 * @uml.property name="content"
41  	 */
42  	protected Object content;
43  
44  	/***
45  	 * the source of an event
46  	 * 
47  	 * @uml.property name="source"
48  	 */
49  	protected Object source;
50  
51  
52  	/***
53  	 * constructs a new Event.
54  	 * 
55  	 * @param type the name of the Event.
56  	 * @param source the source of the sender.
57  	 * @param content the content of the event.
58  	 */
59  	public Event(final EventType type, final Object source, final Object content)
60  	{
61  		this.type = type;
62  		this.source = source;
63  		this.content = content;
64  	}
65  
66  	/***
67  	 * @see nl.tudelft.simulation.event.EventInterface#getSource()
68  	 * 
69  	 * @uml.property name="source"
70  	 */
71  	public Object getSource()
72  	{
73  		return this.source;
74  	}
75  
76  	/***
77  	 * @see nl.tudelft.simulation.event.EventInterface#getContent()
78  	 * 
79  	 * @uml.property name="content"
80  	 */
81  	public Object getContent()
82  	{
83  		return this.content;
84  	}
85  
86  	/***
87  	 * @see nl.tudelft.simulation.event.EventInterface#getType()
88  	 * 
89  	 * @uml.property name="type"
90  	 */
91  	public EventType getType()
92  	{
93  		return this.type;
94  	}
95  
96  	/***
97  	 * @see java.lang.Object#toString()
98  	 */
99  	public String toString()
100 	{
101 		return "[" + this.getClass().getName() + ";" + this.getType() + ";"
102 				+ this.getSource() + ";" + this.getContent() + "]";
103 	}
104 }