Package modelarium.attributes.functional
Class FunctionalEvent
java.lang.Object
modelarium.attributes.Attribute
modelarium.attributes.Event
modelarium.attributes.functional.FunctionalEvent
- All Implemented Interfaces:
Serializable,DeepCopyable<Attribute>
An event whose logic is defined via functional interfaces.
Useful for defining simple event logic without requiring full subclassing, particularly when integrating with languages like Python.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionFunctionalEvent(String name, boolean isRecorded, EventRunFunction runLogic, EventIsTriggeredFunction triggerLogic) Constructs a functional event with the given name, recording flag, and behaviour. -
Method Summary
Methods inherited from class modelarium.attributes.Attribute
getAssociatedModelElement, getName, isRecorded, setAssociatedModelElement
-
Constructor Details
-
FunctionalEvent
public FunctionalEvent(String name, boolean isRecorded, EventRunFunction runLogic, EventIsTriggeredFunction triggerLogic) Constructs a functional event with the given name, recording flag, and behaviour.- Parameters:
name- the name of the eventisRecorded- whether to record the event in outputrunLogic- logic to execute whenrun()is calledtriggerLogic- logic to evaluate whenisTriggered()is called
-
-
Method Details
-
isTriggered
public boolean isTriggered()Description copied from class:EventIndicates whether the event has been triggered during this tick.- Specified by:
isTriggeredin classEvent- Returns:
- true if triggered
-
run
public void run()Description copied from class:EventRuns this event's internal logic. -
deepCopy
- Specified by:
deepCopyin interfaceDeepCopyable<Attribute>- Overrides:
deepCopyin classEvent
-