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-2023 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 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(TimedEvent<T> o)booleanequals(Object obj)TgetTimeStamp()Returns the timeStamp of this event.inthashCode()StringtoString()-
Methods inherited from class org.djutils.event.Event
getContent, getType
-
-
-
-
Constructor Detail
-
TimedEvent
public TimedEvent(EventType type, Serializable content, T timeStamp)
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
public TimedEvent(EventType type, Serializable content, T timeStamp, boolean verifyMetaData)
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 Detail
-
getTimeStamp
public T getTimeStamp()
Returns the timeStamp of this event.- Returns:
- T; the time stamp
-
compareTo
public int compareTo(TimedEvent<T> o)
- Specified by:
compareToin interfaceComparable<T extends Comparable<T> & Serializable>
-
-