1
2
3
4
5
6
7 package nl.tudelft.simulation.event;
8
9 /***
10 * The TimedEvent is the reference implementation for a timed event.
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">Peter Jacobs </a>
22 * @version $Revision: 1.6 $ $Date: 2005/08/04 12:08:32 $
23 * @since 1.5
24 */
25 public class TimedEvent extends Event
26 {
27 /*** timeStamp refers to the time stamp of the event */
28 private double timeStamp = Double.NaN;
29
30 /***
31 * constructs a new timed event.
32 *
33 * @param type the eventType of the event.
34 * @param source the source of the event.
35 * @param value the value of the event.
36 * @param timeStamp the timeStamp.
37 */
38 public TimedEvent(final EventType type, final Object source,
39 final Object value, final double timeStamp)
40 {
41 super(type, source, value);
42 this.timeStamp = timeStamp;
43 }
44
45 /***
46 * returns the timeStamp of this event.
47 *
48 * @return the timestamp as double.
49 */
50 public double getTimeStamp()
51 {
52 return this.timeStamp;
53 }
54
55 /***
56 * @see java.lang.Object#toString()
57 */
58 @Override
59 public String toString()
60 {
61 return super.toString().split("]")[0] + ";" + this.getTimeStamp() + "]";
62 }
63 }