Package modelarium.attributes
Class Attribute
java.lang.Object
modelarium.attributes.Attribute
- All Implemented Interfaces:
Serializable,DeepCopyable<Attribute>
Represents a named attribute associated with a model element such as an agent or environment.
Attributes define a unit of state or behaviour that is executed during a simulation tick
via the run() method. Attributes may optionally be marked as "recorded" to indicate
that their output should be included in simulation results.
Each attribute may be associated with a specific ModelElement (e.g. an agent or
environment) to provide context during execution.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ModelElementRetrieves the model element this attribute is associated with.getName()booleanabstract voidrun()Executes the logic associated with this attribute.voidsetAssociatedModelElement(ModelElement associatedModelElement) Associates this attribute with a specific model element.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface utils.DeepCopyable
deepCopy
-
Constructor Details
-
Attribute
Constructs an attribute with the given name and recording flag.- Parameters:
name- the name of the attributeisRecorded- whether the attribute should be included in recorded output
-
-
Method Details
-
setAssociatedModelElement
Associates this attribute with a specific model element. Typically set internally by the simulation engine.- Parameters:
associatedModelElement- the model element to associate with
-
getAssociatedModelElement
Retrieves the model element this attribute is associated with.- Returns:
- the associated
ModelElement, or null if not set
-
getName
- Returns:
- the name of the attribute
-
isRecorded
public boolean isRecorded()- Returns:
- true if the attribute should be recorded in simulation results
-
run
public abstract void run()Executes the logic associated with this attribute. Called once per simulation tick.
-