Class FunctionalEnvironmentRoutine
java.lang.Object
modelarium.entities.attributes.AttributeBase<EnvironmentContext>
modelarium.entities.attributes.routines.Routine<EnvironmentContext>
modelarium.entities.attributes.routines.EnvironmentRoutine
modelarium.entities.attributes.routines.functional.FunctionalEnvironmentRoutine
- All Implemented Interfaces:
Attribute,EnvironmentAttribute
Class for representing an environment routine whose behaviour is defined via a functional interface.
This class is useful for defining simple routine logic without requiring full subclassing, particularly when integrating with languages like Python.
-
Constructor Summary
ConstructorsConstructorDescriptionFunctionalEnvironmentRoutine(String name, AttributeAccessLevel accessLevel, EnvironmentRoutineRunFunction runLogic) Constructs a new functional environment routine with the specified behaviour function. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidrun(EnvironmentContext context) Runs this routine's behaviour by applying the user-provided run function.Methods inherited from class modelarium.entities.attributes.routines.Routine
getAsImmutable, runMethods inherited from class modelarium.entities.attributes.AttributeBase
accessLevel, context, isLogged, nameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface modelarium.entities.attributes.Attribute
accessLevel, getAsImmutable, isLogged, name, run
-
Constructor Details
-
FunctionalEnvironmentRoutine
public FunctionalEnvironmentRoutine(String name, AttributeAccessLevel accessLevel, EnvironmentRoutineRunFunction runLogic) Constructs a new functional environment routine with the specified behaviour function.- Parameters:
name- the name of the routine, used to identify it within its attribute setaccessLevel- the access level of the routine, determining whether other entities may read itrunLogic- the function defining the routine's behaviour
-
-
Method Details
-
run
Runs this routine's behaviour by applying the user-provided run function.- Specified by:
runin classRoutine<EnvironmentContext>- Parameters:
context- the context the routine can use in its behaviour
-