View Javadoc

1   /*
2    * @(#)TimedEventInterface.java April 4, 2003
3    * 
4    * Copyright (c) 2003 Delft University of Technology Jaffalaan 5, 2628 BX Delft,
5    * 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 TimedEvent is the reference implementation for a timed event.
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 href="http://www.simulation.tudelft.nl">
18   * 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.simulation.tudelft.nl/people/jacobs.html">Peter
23   *         Jacobs </a>
24   * @version 1.7 2004-03-18
25   * @since 1.0
26   */
27  public class TimedEvent extends Event
28  {
29  
30  	/***
31  	 * timeStamp refers to the time stamp of the event
32  	 * 
33  	 * @uml.property name="timeStamp"
34  	 */
35  	private double timeStamp = Double.NaN;
36  
37  
38  	/***
39  	 * constructs a new timed event.
40  	 * 
41  	 * @param type the eventType of the event.
42  	 * @param source the source of the event.
43  	 * @param value the value of the event.
44  	 * @param timeStamp the timeStamp.
45  	 */
46  	public TimedEvent(final EventType type, final Object source,
47  			final Object value, final double timeStamp)
48  	{
49  		super(type, source, value);
50  		this.timeStamp = timeStamp;
51  	}
52  
53  	/***
54  	 * returns the timeStamp of this event.
55  	 * 
56  	 * @return the timestamp as double.
57  	 * 
58  	 * @uml.property name="timeStamp"
59  	 */
60  	public double getTimeStamp()
61  	{
62  		return this.timeStamp;
63  	}
64  
65  	/***
66  	 * @see java.lang.Object#toString()
67  	 */
68  	public String toString()
69  	{
70  		return super.toString().split("]")[0] + ";" + this.getTimeStamp() + "]";
71  	}
72  }