Package modelarium.attributes
Class AttributeSetCollection
java.lang.Object
modelarium.attributes.AttributeSetCollection
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(List<AttributeSet> attributeSets) Adds multiple attribute sets to the collection.voidadd(AttributeSet attributeSet) Adds a single attribute set to the collection.deepCopy()get(int index) Retrieves an attribute set by its index.Retrieves an attribute set by name.voidrun()Executes all attribute sets in the collection for a single simulation tick.voidsetAssociatedModelElement(ModelElement associatedModelElement) Sets theModelElementassociated with the collection's attributes.voidSets up this collection for simulation by assigning a model element name and preparing the results structure for recording.intsize()
-
Constructor Details
-
AttributeSetCollection
public AttributeSetCollection()
-
-
Method Details
-
setAssociatedModelElement
Sets theModelElementassociated with the collection's attributes.- Parameters:
associatedModelElement- the associated model element to add
-
add
Adds a single attribute set to the collection.- Parameters:
attributeSet- the attribute set to add
-
add
Adds multiple attribute sets to the collection.- Parameters:
attributeSets- a list of attribute sets to add
-
get
Retrieves an attribute set by name.- Parameters:
name- the name of the attribute set- Returns:
- the corresponding
AttributeSet
-
get
Retrieves an attribute set by its index.- Parameters:
index- the index in the list- Returns:
- the
AttributeSetat the specified position
-
size
public int size()- Returns:
- the number of attribute sets in the collection
-
setup
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
- Returns:
- the name of the model element this attribute set collection is associated with
-
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 correspondingAttributeSetCollectionResults. -
deepCopy
- Specified by:
deepCopyin interfaceDeepCopyable<AttributeSetCollection>
-