Package org.djutils.event
Class TimedEvent<T extends Comparable<T> & Serializable>
java.lang.Object
org.djutils.event.Event
org.djutils.event.TimedEvent<T>
- Type Parameters:
T
- the Comparable type that represents time
- All Implemented Interfaces:
Serializable
,Comparable<TimedEvent<T>>
,EventInterface
public class TimedEvent<T extends Comparable<T> & Serializable> extends Event implements Comparable<TimedEvent<T>>
The TimedEvent is the reference implementation for a timed event. Because events are often sent over the network, the
interface demands that the event, its sourceId, content and timestamp are serializable. It is the repsonsibility of the
programmer, though, that the fields of the sourceId, content and timestamp are serializable as well.
Copyright (c) 2002-2020 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djutils.org. The DJUTILS project is distributed under a three-clause BSD-style license, which can be found at https://djutils.org/docs/license.html. This class was originally part of the DSOL project, see https://simulation.tudelft.nl/dsol/manual.
- Author:
- Peter Jacobs , Alexander Verbraeck
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description TimedEvent(EventType type, Serializable sourceId, Serializable content, T timeStamp)
Construct a new timed event. -
Method Summary
Modifier and Type Method Description int
compareTo(TimedEvent<T> o)
boolean
equals(Object obj)
T
getTimeStamp()
Returns the timeStamp of this event.int
hashCode()
String
toString()
-
Constructor Details
-
TimedEvent
Construct a new timed event.- Parameters:
type
- EventType; the eventType of the event.sourceId
- Serializable; the source of the event.content
- Serializable; the content of the event.timeStamp
- T; the timeStamp.
-
-
Method Details
-
getTimeStamp
Returns the timeStamp of this event.- Returns:
- T; the time stamp
-
hashCode
public int hashCode() -
equals
-
compareTo
- Specified by:
compareTo
in interfaceComparable<T extends Comparable<T> & Serializable>
-
toString
-