Package microsim.event
Class EventGroup
java.lang.Object
microsim.event.Event
microsim.event.EventGroup
- All Implemented Interfaces:
Comparable<Event>
A special implementation of the
Event
family. It is not a real event, but a container for other events. When
fired this object automatically fires the events contained. Each contained event is fired at the group time, any
other time pointer is ignored.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@NonNull EventGroup
addCollectionEvent
(@NonNull Collection<?> elements, @NonNull Class<?> objectType, @NonNull String method) readOnly
defaults totrue
.@NonNull EventGroup
addCollectionEvent
(@NonNull Collection<?> elements, @NonNull Class<?> objectType, @NonNull String method, boolean readOnly) Creates a newCollectionTargetEvent
and adds the event to the list, using late binding method.@NonNull EventGroup
addCollectionEvent
(@NonNull Collection<?> elements, @NonNull Enum<?> actionType) readOnly
defaults totrue
.@NonNull EventGroup
addCollectionEvent
(@NonNull Collection<?> elements, @NonNull Enum<?> actionType, boolean readOnly) Creates a newCollectionTargetEvent
and adds the event to the list, using early binding method.Creates a newSingleTargetEvent
and adds the event to the list, using early binding method.@NonNull EventGroup
Creates a newSingleTargetEvent
and adds the event to the list, using late binding method.@NonNull EventGroup
Adds an event to the list.addSystemEvent
(@NonNull SimulationEngine engine, @NonNull SystemEventType actionType) Creates a newSystemEvent
and adds the event to the list.void
clear()
Empties the event list.@NonNull Event @NonNull []
Converts the list of actions to an array.void
Fires each event into the list.void
removeEvent
(@NonNull Event event) Removes the given event from the list.Methods inherited from class microsim.event.Event
compareTo, setTimeAtNextLoop, setTimeOrderingAndLoopPeriod
-
Constructor Details
-
EventGroup
public EventGroup()Builds a new group event.
-
-
Method Details
-
clear
public void clear()Empties the event list. -
addEvent
Adds an event to the list.- Parameters:
newEvent
- AnEvent
object.- Throws:
NullPointerException
- whennewEvent
isnull
.
-
addEvent
@NonNull public @NonNull EventGroup addEvent(@NonNull @NonNull Object object, @NonNull @NonNull String method) throws SimulationException Creates a newSingleTargetEvent
and adds the event to the list, using late binding method.- Parameters:
object
- AnObject
.method
- The method name.- Throws:
SimulationException
- when creation ofSingleTargetEvent
fails.NullPointerException
- when any of the input parameters isnull
.- See Also:
-
addEvent
Creates a newSingleTargetEvent
and adds the event to the list, using early binding method.- Parameters:
object
- AnObject
.actionType
- An action to invoke.- Throws:
NullPointerException
- when any of the input parameters isnull
.
-
addSystemEvent
public EventGroup addSystemEvent(@NonNull @NonNull SimulationEngine engine, @NonNull @NonNull SystemEventType actionType) Creates a newSystemEvent
and adds the event to the list.- Parameters:
engine
- ASimulationEngine
object.actionType
- An action to invoke.- Throws:
NullPointerException
- when any of the input parameters isnull
.
-
addCollectionEvent
@NonNull public @NonNull EventGroup addCollectionEvent(@NonNull @NonNull Collection<?> elements, @NonNull @NonNull Class<?> objectType, @NonNull @NonNull String method) throws SimulationException readOnly
defaults totrue
.- Throws:
SimulationException
- See Also:
-
addCollectionEvent
@NonNull public @NonNull EventGroup addCollectionEvent(@NonNull @NonNull Collection<?> elements, @NonNull @NonNull Class<?> objectType, @NonNull @NonNull String method, boolean readOnly) throws SimulationException Creates a newCollectionTargetEvent
and adds the event to the list, using late binding method.- Parameters:
elements
- A collection of elements of some nature.objectType
- The type ofelements
.method
- The method name.readOnly
- A boolean flag that makeselements
an immutable object.- Throws:
SimulationException
- when creation ofCollectionTargetEvent
fails.NullPointerException
- when any of the input object isnull
.- See Also:
-
addCollectionEvent
@NonNull public @NonNull EventGroup addCollectionEvent(@NonNull @NonNull Collection<?> elements, @NonNull @NonNull Enum<?> actionType) readOnly
defaults totrue
. -
addCollectionEvent
@NonNull public @NonNull EventGroup addCollectionEvent(@NonNull @NonNull Collection<?> elements, @NonNull @NonNull Enum<?> actionType, boolean readOnly) Creates a newCollectionTargetEvent
and adds the event to the list, using early binding method.- Parameters:
elements
- A collection of elements of some nature.actionType
- An action to invoke.readOnly
- A boolean flag that makeselements
an immutable object.- Throws:
NullPointerException
- when any of the input objects isnull
.- See Also:
-
removeEvent
Removes the given event from the list.- Parameters:
event
- AnEvent
object.- Throws:
NullPointerException
- whenevent
isnull
.
-
fireEvent
Fires each event into the list.- Specified by:
fireEvent
in classEvent
- Throws:
SimulationException
- when one of the events fails to do so.
-
eventsToArray
Converts the list of actions to an array.- Returns:
- an array of
Event
objects.
-