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
Constructors -
Method Summary
Modifier and TypeMethodDescription@NonNull EventGroupaddCollectionEvent(@NonNull Collection<?> elements, @NonNull Class<?> objectType, @NonNull String method) readOnlydefaults totrue.@NonNull EventGroupaddCollectionEvent(@NonNull Collection<?> elements, @NonNull Class<?> objectType, @NonNull String method, boolean readOnly) Creates a newCollectionTargetEventand adds the event to the list, using late binding method.@NonNull EventGroupaddCollectionEvent(@NonNull Collection<?> elements, @NonNull Enum<?> actionType) readOnlydefaults totrue.@NonNull EventGroupaddCollectionEvent(@NonNull Collection<?> elements, @NonNull Enum<?> actionType, boolean readOnly) Creates a newCollectionTargetEventand adds the event to the list, using early binding method.Creates a newSingleTargetEventand adds the event to the list, using early binding method.@NonNull EventGroupCreates a newSingleTargetEventand adds the event to the list, using late binding method.@NonNull EventGroupAdds an event to the list.addSystemEvent(@NonNull SimulationEngine engine, @NonNull SystemEventType actionType) Creates a newSystemEventand adds the event to the list.voidclear()Empties the event list.@NonNull Event @NonNull []Converts the list of actions to an array.voidFires each event into the list.voidremoveEvent(@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- AnEventobject.- Throws:
NullPointerException- whennewEventisnull.
-
addEvent
@NonNull public @NonNull EventGroup addEvent(@NonNull @NonNull Object object, @NonNull @NonNull String method) throws SimulationException Creates a newSingleTargetEventand adds the event to the list, using late binding method.- Parameters:
object- AnObject.method- The method name.- Throws:
SimulationException- when creation ofSingleTargetEventfails.NullPointerException- when any of the input parameters isnull.- See Also:
-
addEvent
Creates a newSingleTargetEventand 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 newSystemEventand adds the event to the list.- Parameters:
engine- ASimulationEngineobject.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 readOnlydefaults 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 newCollectionTargetEventand 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 makeselementsan immutable object.- Throws:
SimulationException- when creation ofCollectionTargetEventfails.NullPointerException- when any of the input object isnull.- See Also:
-
addCollectionEvent
@NonNull public @NonNull EventGroup addCollectionEvent(@NonNull @NonNull Collection<?> elements, @NonNull @NonNull Enum<?> actionType) readOnlydefaults totrue. -
addCollectionEvent
@NonNull public @NonNull EventGroup addCollectionEvent(@NonNull @NonNull Collection<?> elements, @NonNull @NonNull Enum<?> actionType, boolean readOnly) Creates a newCollectionTargetEventand 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 makeselementsan immutable object.- Throws:
NullPointerException- when any of the input objects isnull.- See Also:
-
removeEvent
Removes the given event from the list.- Parameters:
event- AnEventobject.- Throws:
NullPointerException- wheneventisnull.
-
fireEvent
Fires each event into the list.- Specified by:
fireEventin 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
Eventobjects.
-