Package modelarium.entities.logging
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
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 Summary
ConstructorsConstructorDescriptionAttributeSetLog(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. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the number of attributes registered for logging.intReturns the number of entries logged for an attribute so far.voidCloses the underlying database and releases any held resources.Returns the names of the attributes registered for logging.Returns the name of the attribute set being logged.Returns the name of the model element this log belongs to.Class<?> getPropertyType(String propertyName) Returns the recorded value type of a given property.Retrieves the values recorded for the named attribute across the model run.voidRecords a value for the named attribute at the current tick.
-
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 toattributeSetName- the name of the attribute set being loggeddatabaseFactory- the factory used to create the log's backing databaseattributeList- the attribute set's attributes, from which the logged ones are registered
-
-
Method Details
-
getOwnerName
Returns the name of the model element this log belongs to.- Returns:
- the name of the owning model element (agent/environment)
-
getAttributeSetName
Returns the name of the attribute set being logged.- Returns:
- the name of the attribute set being logged
-
getAttributeNamesList
Returns the names of the attributes registered for logging.- Returns:
- a new list of names of logged attributes
-
getPropertyType
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
Records a value for the named attribute at the current tick.- Parameters:
attributeName- the name of the attribute the value belongs tovalue- the value to record
-
getValues
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.
-