Class FunctionalAgentRoutine
java.lang.Object
modelarium.entities.attributes.AttributeBase<AgentContext>
modelarium.entities.attributes.routines.Routine<AgentContext>
modelarium.entities.attributes.routines.AgentRoutine
modelarium.entities.attributes.routines.functional.FunctionalAgentRoutine
- All Implemented Interfaces:
AgentAttribute,Attribute
Class for representing an agent 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
ConstructorsConstructorDescriptionFunctionalAgentRoutine(String name, AttributeAccessLevel accessLevel, AgentRoutineRunFunction runLogic) Constructs a new functional agent routine with the specified behaviour function. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidrun(AgentContext 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
-
FunctionalAgentRoutine
public FunctionalAgentRoutine(String name, AttributeAccessLevel accessLevel, AgentRoutineRunFunction runLogic) Constructs a new functional agent 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<AgentContext>- Parameters:
context- the context the routine can use in its behaviour
-