Class FunctionalAgentRoutine

All Implemented Interfaces:
AgentAttribute, Attribute

public class FunctionalAgentRoutine extends AgentRoutine
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 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 set
      accessLevel - the access level of the routine, determining whether other entities may read it
      runLogic - the function defining the routine's behaviour
  • Method Details

    • run

      protected void run(AgentContext context)
      Runs this routine's behaviour by applying the user-provided run function.
      Specified by:
      run in class Routine<AgentContext>
      Parameters:
      context - the context the routine can use in its behaviour