Class Routine<C extends Context>

java.lang.Object
modelarium.entities.attributes.AttributeBase<C>
modelarium.entities.attributes.routines.Routine<C>
Type Parameters:
C - the type of context this routine is given
All Implemented Interfaces:
Attribute
Direct Known Subclasses:
AgentRoutine, EnvironmentRoutine

public abstract sealed class Routine<C extends Context> extends AttributeBase<C> permits AgentRoutine, EnvironmentRoutine
Abstract class for representing an attribute whose behaviour runs unconditionally every tick.

Routines carry no value and are never logged; they exist purely to perform behaviour. This class is extended by AgentRoutine and EnvironmentRoutine.

  • Method Details

    • run

      public void run()
      Runs this routine's behaviour for the current tick.
    • run

      protected abstract void run(C context)
      Runs this routine's behaviour. Must be implemented by subclasses.
      Parameters:
      context - the context the routine can use in its behaviour
    • getAsImmutable

      public ReadOnlyRoutine getAsImmutable()
      Creates and returns an immutable version of this attribute.
      Returns:
      the new ReadOnlyRoutine instance