Class AttributeSet

java.lang.Object
modelarium.attributes.AttributeSet
All Implemented Interfaces:
DeepCopyable<AttributeSet>

public class AttributeSet extends Object implements DeepCopyable<AttributeSet>
Represents a named collection of attributes, organised into pre-events, properties, and post-events.

This class defines the execution order and data recording logic for all attributes linked to a model element such as an agent or environment. It is intended to be executed once per simulation tick, coordinating the flow of behaviour and conditionally recording attribute states.

  • Constructor Details

    • AttributeSet

      public AttributeSet(String name, Events preEvents, Properties properties, Events postEvents)
      Constructs an attribute set with a given name and specified components.
      Parameters:
      name - the name of the attribute set
      preEvents - the events to execute before properties
      properties - the properties in this attribute set
      postEvents - the events to execute after properties
    • AttributeSet

      public AttributeSet(String name)
      Constructs an attribute set with a given name and empty event/property collections.
      Parameters:
      name - the name of the attribute set
    • AttributeSet

      public AttributeSet()
      Constructs an attribute set with a generated default name and empty components.
  • Method Details

    • setAssociatedModelElement

      public void setAssociatedModelElement(ModelElement associatedModelElement)
      Associates all contained attributes with the specified model element. Typically called during initialisation.
      Parameters:
      associatedModelElement - the model element to associate with
    • getName

      public String getName()
      Returns:
      the name of this attribute set
    • getPreEvents

      public Events getPreEvents()
      Returns:
      the pre-event attributes of this set
    • getProperties

      public Properties getProperties()
      Returns:
      the property attributes of this set
    • getPostEvents

      public Events getPostEvents()
      Returns:
      the post-event attributes of this set
    • run

      public void run(AttributeSetResults attributeSetResults)
      Executes all attributes in the prescribed order:
      1. Pre-events (conditionally triggered)
      2. Properties (always executed)
      3. Post-events (conditionally triggered)

      If any attribute is marked for recording, its value or triggered state is stored in the provided AttributeSetResults container for this tick.

      Parameters:
      attributeSetResults - the results object used to collect recorded values
    • deepCopy

      public AttributeSet deepCopy()
      Specified by:
      deepCopy in interface DeepCopyable<AttributeSet>