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>>
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, content and timestamp are serializable. It is the repsonsibility of the programmer, though,
that the fields of the content and timestamp are serializable as well.
Copyright (c) 2002-2024 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:
-
Constructor Summary
ConstructorDescriptionTimedEvent
(EventType type, Serializable content, T timeStamp) Construct a new timed event, where compliance with the metadata is verified.TimedEvent
(EventType type, Serializable content, T timeStamp, boolean verifyMetaData) Construct a new timed event, with a choice to verify compliance with metadata. -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(TimedEvent<T> o) boolean
Returns the timeStamp of this event.int
hashCode()
toString()
Methods inherited from class org.djutils.event.Event
getContent, getType
-
Constructor Details
-
TimedEvent
Construct a new timed event, where compliance with the metadata is verified.- Parameters:
type
- EventType; the eventType of the event.content
- Serializable; the content of the event.timeStamp
- T; the timeStamp.
-
TimedEvent
Construct a new timed event, with a choice to verify compliance with metadata.- Parameters:
type
- EventType; the eventType of the event.content
- Serializable; the content of the event.timeStamp
- T; the timeStamp.verifyMetaData
- boolean; whether to verify the compliance with metadata or not
-
-
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
-