Class FunctionalAgentEvent

All Implemented Interfaces:
AgentAttribute, Attribute

public class FunctionalAgentEvent extends AgentEvent
Class for representing an agent event whose logic is defined via functional interfaces.

This class is useful for defining simple event logic without requiring full subclassing, particularly when integrating with languages like Python.

  • Constructor Details

    • FunctionalAgentEvent

      public FunctionalAgentEvent(String name, boolean isLogged, AttributeAccessLevel accessLevel, AgentEventRunFunction runLogic, AgentEventIsTriggeredFunction triggerLogic)
      Constructs a new functional agent event with the specified logic functions.
      Parameters:
      name - the name of the event, used to identify it within its attribute set
      isLogged - whether the event's trigger state is logged as the model progresses
      accessLevel - the access level of the event, determining whether other entities may read it
      runLogic - the function defining the event's behaviour
      triggerLogic - the function defining the event's trigger condition
  • Method Details

    • isTriggered

      public boolean isTriggered(AgentContext context)
      Determines whether this event's trigger condition is met by applying the user-provided trigger function.
      Specified by:
      isTriggered in class Event<AgentContext>
      Parameters:
      context - the context the event can use in its trigger logic
      Returns:
      true if the event is triggered, false otherwise
    • run

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