Class CumulativeEvent
- java.lang.Object
-
- org.goplanit.utils.id.IdAbleImpl
-
- org.goplanit.utils.event.EventImpl
-
- org.goplanit.assignment.ltm.eltm.event.CumulativeEvent
-
- All Implemented Interfaces:
Cloneable
,Comparable<IdAble>
,Event
,IdAble
- Direct Known Subclasses:
ReleaseEvent
,TriggerEvent
public abstract class CumulativeEvent extends EventImpl
A cumulative event represents a cumulative pcu point in space-time with (potential) additional information. The content of the event is stored in a raw object array which is initialised here. The first two entries are populated with the unique id of the event and the cumulative information.- Author:
- markr
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
CumulativeEvent(EventType type, Serializable sourceId, CumulativePoint cumulativePoint, Serializable... additionalContent)
Constructor of an LTM cumulative event.protected
CumulativeEvent(EventType type, Object source, CumulativePoint cumulativePoint, Serializable singleParameter)
Constructor of an LTM cumulative event.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static long
generateEventId()
Event ids are generated with unique ids across all cumulative events in the JVMCumulativePoint
getCumulativePoint()
protected <T> T
getEventContentByIndex(int index)
Collect any entry from the event content object array by index and cast to generic type Tlong
getId()
Collect id of the entityprotected void
setEventContentByIndex(int index, Serializable contentEntry)
set content entry on the event explicitly-
Methods inherited from class org.goplanit.utils.event.EventImpl
clone, getContent, getSource, getType, toString
-
Methods inherited from class org.goplanit.utils.id.IdAbleImpl
equals, generateAndSetId, generateId, hashCode, setId
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.goplanit.utils.id.IdAble
compareTo, idEquals, idHashCode
-
-
-
-
Constructor Detail
-
CumulativeEvent
protected CumulativeEvent(EventType type, Object source, CumulativePoint cumulativePoint, Serializable singleParameter)
Constructor of an LTM cumulative event.- Parameters:
type
- of the eventsource
- of the event (where does it originate from)cumulativePoint
- contains the cumulative informationsingleParameter
- create room in the content array for additional content of derived event classes
-
CumulativeEvent
protected CumulativeEvent(EventType type, Serializable sourceId, CumulativePoint cumulativePoint, Serializable... additionalContent)
Constructor of an LTM cumulative event.- Parameters:
type
- of the eventsourceId
- of the event (where does it originate from)cumulativePoint
- contains the cumulative informationadditionalContent
- create room in the content array for additional content of derived event classes
-
-
Method Detail
-
generateEventId
protected static long generateEventId()
Event ids are generated with unique ids across all cumulative events in the JVM- Returns:
- geenerated event id
-
getEventContentByIndex
protected <T> T getEventContentByIndex(int index)
Collect any entry from the event content object array by index and cast to generic type T- Type Parameters:
T
- content type- Parameters:
index
- of the content object array to retrieve- Returns:
- entry type cast to T
-
setEventContentByIndex
protected void setEventContentByIndex(int index, Serializable contentEntry)
set content entry on the event explicitly- Parameters:
index
- location in the content object arraycontentEntry
- the entry
-
getId
public long getId()
Description copied from class:IdAbleImpl
Collect id of the entity- Specified by:
getId
in interfaceIdAble
- Overrides:
getId
in classIdAbleImpl
- Returns:
- the unique id
-
getCumulativePoint
public final CumulativePoint getCumulativePoint()
- Returns:
- the cumulative point
-
-