Class Attribute

java.lang.Object
modelarium.attributes.Attribute
All Implemented Interfaces:
Serializable, DeepCopyable<Attribute>
Direct Known Subclasses:
Event, Property

public abstract class Attribute extends Object implements 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 Details

    • Attribute

      public Attribute(String name, boolean isRecorded)
      Constructs an attribute with the given name and recording flag.
      Parameters:
      name - the name of the attribute
      isRecorded - whether the attribute should be included in recorded output
  • Method Details

    • setAssociatedModelElement

      public void setAssociatedModelElement(ModelElement associatedModelElement)
      Associates this attribute with a specific model element. Typically set internally by the simulation engine.
      Parameters:
      associatedModelElement - the model element to associate with
    • getAssociatedModelElement

      protected ModelElement getAssociatedModelElement()
      Retrieves the model element this attribute is associated with.
      Returns:
      the associated ModelElement, or null if not set
    • getName

      public String 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.