Class MemoryBasedAttributeSetLogDatabase
java.lang.Object
modelarium.entities.logging.databases.AttributeSetLogDatabase
modelarium.entities.logging.databases.MemoryBasedAttributeSetLogDatabase
An in-memory implementation of
AttributeSetLogDatabase.
This class stores all simulation results directly in RAM, using Java collections. It is useful for lightweight simulations, unit tests, or post-processing before output.
Unlike DiskBasedAttributeSetLogDatabase, this class does not persist results to disk.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new in-memory attribute set log database. -
Method Summary
Modifier and TypeMethodDescription<T> voidaddAttributeValue(String attributeName, T attributeValue) Appends a value to the named attribute's stored series, checking that it matches the type of the values already stored.voidconnect()Opens this database for reading and writing.voidClears all stored series and recorded value types.getAttributeColumnAsList(String attributeName) Retrieves the named attribute's stored series.voidsetAttributeColumn(String attributeName, List<Object> attributeValues) Replaces the named attribute's stored series with a copy of the given values, inferring the attribute's value type from the first non-null value.Methods inherited from class modelarium.entities.logging.databases.AttributeSetLogDatabase
getDatabasePath
-
Constructor Details
-
MemoryBasedAttributeSetLogDatabase
public MemoryBasedAttributeSetLogDatabase()Constructs a new in-memory attribute set log database.
-
-
Method Details
-
connect
public void connect()Opens this database for reading and writing.- Specified by:
connectin classAttributeSetLogDatabase
-
disconnect
public void disconnect()Clears all stored series and recorded value types.- Specified by:
disconnectin classAttributeSetLogDatabase
-
addAttributeValue
Appends a value to the named attribute's stored series, checking that it matches the type of the values already stored.- Specified by:
addAttributeValuein classAttributeSetLogDatabase- Type Parameters:
T- the type of the value being appended- Parameters:
attributeName- the name of the attribute the value belongs toattributeValue- the value to append
-
setAttributeColumn
Replaces the named attribute's stored series with a copy of the given values, inferring the attribute's value type from the first non-null value.- Specified by:
setAttributeColumnin classAttributeSetLogDatabase- Parameters:
attributeName- the name of the attribute the values belong toattributeValues- the values to store as the attribute's series
-
getAttributeColumnAsList
Retrieves the named attribute's stored series.- Specified by:
getAttributeColumnAsListin classAttributeSetLogDatabase- Parameters:
attributeName- the name of the attribute whose series to retrieve- Returns:
- a detached list containing the attribute's stored values in insertion order, or an empty list when the series does not exist
-