Class AttributeSetCollection

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

public class AttributeSetCollection extends Object implements DeepCopyable<AttributeSetCollection>
Represents a collection of AttributeSet instances associated with a single model element (either an agent or the environment).

This class is responsible for:

  • Managing named access to attribute sets
  • Initialising and recording simulation results
  • Executing all attribute sets each simulation tick
  • Constructor Details

    • AttributeSetCollection

      public AttributeSetCollection()
  • Method Details

    • setAssociatedModelElement

      public void setAssociatedModelElement(ModelElement associatedModelElement)
      Sets the ModelElement associated with the collection's attributes.
      Parameters:
      associatedModelElement - the associated model element to add
    • add

      public void add(AttributeSet attributeSet)
      Adds a single attribute set to the collection.
      Parameters:
      attributeSet - the attribute set to add
    • add

      public void add(List<AttributeSet> attributeSets)
      Adds multiple attribute sets to the collection.
      Parameters:
      attributeSets - a list of attribute sets to add
    • get

      public AttributeSet get(String name)
      Retrieves an attribute set by name.
      Parameters:
      name - the name of the attribute set
      Returns:
      the corresponding AttributeSet
    • get

      public AttributeSet get(int index)
      Retrieves an attribute set by its index.
      Parameters:
      index - the index in the list
      Returns:
      the AttributeSet at the specified position
    • size

      public int size()
      Returns:
      the number of attribute sets in the collection
    • setup

      public void setup(String modelElementName)
      Sets up this collection for simulation by assigning a model element name and preparing the results structure for recording.
      Parameters:
      modelElementName - the name of the agent or environment this collection belongs to
    • getModelElementName

      public String getModelElementName()
      Returns:
      the name of the model element this attribute set collection is associated with
    • getResults

      public AttributeSetCollectionResults getResults()
      Returns:
      the results object responsible for recording outputs from each attribute set
    • run

      public void run()
      Executes all attribute sets in the collection for a single simulation tick. Results are recorded into the corresponding AttributeSetCollectionResults.
    • deepCopy

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