Package modelarium.attributes
Class Events
java.lang.Object
modelarium.attributes.Attributes
modelarium.attributes.Events
- All Implemented Interfaces:
DeepCopyable<Attributes>
A concrete collection class for managing
Event attributes.
Each event is uniquely named and stored internally. During each simulation tick,
the run() method checks whether each event is triggered before executing its logic.
This class extends Attributes and uses the underlying storage and indexing mechanisms
provided there.
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class modelarium.attributes.Attributes
addAttribute, getAssociatedModelElement, getAttribute, getAttribute, setAssociatedModelElement, size
-
Constructor Details
-
Events
public Events()
-
-
Method Details
-
add
Adds a single event to the collection.- Parameters:
event- the event to add
-
add
Adds a list of events to the collection.- Parameters:
events- a list ofEventinstances
-
get
Retrieves an event by name.- Parameters:
name- the name of the event- Returns:
- the matching
Event, or null if not found
-
get
Retrieves an event by index.- Parameters:
index- the index of the event- Returns:
- the
Eventat the given index
-
run
public void run()Executes all triggered events in the collection.Each event is first checked with
isTriggered()before being run. This allows events to conditionally execute based on internal or external logic.- Specified by:
runin classAttributes
-
deepCopy
-