Class AttributeSetLog<C extends SimulationContext>

java.lang.Object
modelarium.entities.logging.AttributeSetLog<C>
Type Parameters:
C - the simulation context type used by the owning attribute set

public class AttributeSetLog<C extends SimulationContext> extends Object
Stores and manages the logged results for a single AttributeSet, including properties and events marked for logging.

This class is responsible for writing tick-level data to the backing database, and for providing access to stored values after simulation.

  • Constructor Details

    • AttributeSetLog

      public AttributeSetLog(String ownerName, String attributeSetName, AttributeSetLogDatabaseFactory databaseFactory, List<AttributeBase<C>> attributeList)
      Constructs a new attribute set log, creating and connecting its backing database and registering the attributes marked for logging.
      Parameters:
      ownerName - the name of the agent or environment the logged attribute set belongs to
      attributeSetName - the name of the attribute set being logged
      databaseFactory - the factory used to create the log's backing database
      attributeList - the attribute set's attributes, from which the logged ones are registered
  • Method Details

    • getOwnerName

      public String getOwnerName()
      Returns the name of the model element this log belongs to.
      Returns:
      the name of the owning model element (agent/environment)
    • getAttributeSetName

      public String getAttributeSetName()
      Returns the name of the attribute set being logged.
      Returns:
      the name of the attribute set being logged
    • getAttributeNamesList

      public List<String> getAttributeNamesList()
      Returns the names of the attributes registered for logging.
      Returns:
      a new list of names of logged attributes
    • getPropertyType

      public Class<?> getPropertyType(String propertyName)
      Returns the recorded value type of a given property.
      Parameters:
      propertyName - the name of the property
      Returns:
      the class type of the property's values
    • attributeLogCount

      public int attributeLogCount()
      Returns the number of attributes registered for logging.
      Returns:
      the log's attribute count
    • attributeLogEntryCount

      public int attributeLogEntryCount()
      Returns the number of entries logged for an attribute so far.
      Returns:
      the attribute log's number of entries so far
    • record

      public void record(String attributeName, Object value)
      Records a value for the named attribute at the current tick.
      Parameters:
      attributeName - the name of the attribute the value belongs to
      value - the value to record
    • getValues

      public List<Object> getValues(String attributeName)
      Retrieves the values recorded for the named attribute across the model run.
      Parameters:
      attributeName - the name of the attribute whose values to retrieve
      Returns:
      a deep clone of the attribute's recorded values, one per tick
    • disconnectDatabase

      public void disconnectDatabase()
      Closes the underlying database and releases any held resources.