package nl.tudelft.simulation.event; /** * The TimedEvent is the reference implementation for a timed event. *

* (c) copyright 2002-2014 Delft University of Technology.
* BSD-style license. See DSOL License.
* @author Peter Jacobs * @author Alexander Verbraeck * @param the object type of the timestamp * @since 1.5 */ public class TimedEvent> extends Event implements Comparable> { /** The default serial version UID for serializable classes. */ private static final long serialVersionUID = 20140826L; /** timeStamp refers to the time stamp of the event. */ private final T timeStamp; /** * constructs a new timed event. * @param type the eventType of the event. * @param source the source of the event. * @param value the value of the event. * @param timeStamp the timeStamp. */ public TimedEvent(final EventType type, final Object source, final Object value, final T timeStamp) { super(type, source, value); this.timeStamp = timeStamp; } /** * returns the timeStamp of this event. * @return the timestamp as double. */ public T getTimeStamp() { return this.timeStamp; } /** {@inheritDoc} */ @Override public int compareTo(TimedEvent o) { return this.timeStamp.compareTo(o.getTimeStamp()); } /** {@inheritDoc} */ @Override public String toString() { return super.toString().split("]")[0] + ";" + this.getTimeStamp() + "]"; } }