Package org.djutils.event
Class Event
java.lang.Object
org.djutils.event.Event
- All Implemented Interfaces:
 Serializable,EventInterface
- Direct Known Subclasses:
 TimedEvent
public class Event extends Object implements EventInterface
The Event class forms the reference implementation for the EventInterface. Because events are often sent over the network,
 the interface demands that source of the event and its content are serializable. It is the responsibility of the programmer,
 though, that the fields of the sourceId and content 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 Event(EventType type, Serializable sourceId, Serializable content)Construct a new Event. - 
Method Summary
Modifier and Type Method Description booleanequals(Object obj)SerializablegetContent()Return the content (payload) of this event.SerializablegetSourceId()Return the id of the source of the event.EventTypegetType()Return the type of the event.inthashCode()StringtoString() 
- 
Constructor Details
- 
Event
Construct a new Event.- Parameters:
 type- EventType; the name of the Event.sourceId- Serializable; the source id of the sendercontent- Serializable; the content of the event
 
 - 
 - 
Method Details
- 
getSourceId
Return the id of the source of the event. The source is, or identifies the sender of the event- Specified by:
 getSourceIdin interfaceEventInterface- Returns:
 - Serializable; the id of the source of the event
 
 - 
getContent
Return the content (payload) of this event.- Specified by:
 getContentin interfaceEventInterface- Returns:
 - Serializable; the content (payload) of this event
 
 - 
getType
Return the type of the event.- Specified by:
 getTypein interfaceEventInterface- Returns:
 - EventType; the type of the event
 
 - 
toString
 - 
hashCode
public int hashCode() - 
equals
 
 -