Class DiskBasedAttributeSetResultsDatabase
java.lang.Object
modelarium.attributes.results.databases.AttributeSetResultsDatabase
modelarium.attributes.results.databases.DiskBasedAttributeSetResultsDatabase
Concrete implementation of
AttributeSetResultsDatabase that stores results
in a temporary SQLite database file.
Each run of the simulation creates a new SQLite database that is deleted on shutdown. Values are serialised to JSON strings to support flexible data types.
This class supports both incremental (`addXValue`) and bulk (`setXColumn`) writes.
-
Constructor Summary
ConstructorsConstructorDescriptionRegisters this instance for automatic disconnect on JVM shutdown -
Method Summary
Modifier and TypeMethodDescription<T> voidaddPostEventValue(String postEventName, T postEventValue) Adds a new post-event value (e.g. trigger status) for the current tick.<T> voidaddPreEventValue(String preEventName, T preEventValue) Adds a new pre-event value (e.g. trigger status) for the current tick.<T> voidaddPropertyValue(String propertyName, T propertyValue) Adds a new property value to the results database for the current tick.voidconnect()Establishes an SQLite connection and creates the required tables.voidCloses the SQLite connection and deletes the database file.getPostEventColumnAsList(String postEventName) Retrieves the full column of recorded values for a post-event.getPreEventColumnAsList(String preEventName) Retrieves the full column of recorded values for a pre-event.getPropertyColumnAsList(String propertyName) Retrieves the full column of recorded values for a property.voidsetPostEventColumn(String postEventName, List<Object> postEventValues) Replaces or defines the full column of values for a post-event.voidsetPreEventColumn(String preEventName, List<Object> preEventValues) Replaces or defines the full column of values for a pre-event.voidsetPropertyColumn(String propertyName, List<Object> propertyValues) Replaces or defines the entire set of values for a given property.Methods inherited from class modelarium.attributes.results.databases.AttributeSetResultsDatabase
getDatabasePath, setDatabasePath
-
Constructor Details
-
DiskBasedAttributeSetResultsDatabase
public DiskBasedAttributeSetResultsDatabase()Registers this instance for automatic disconnect on JVM shutdown
-
-
Method Details
-
connect
public void connect()Establishes an SQLite connection and creates the required tables.- Overrides:
connectin classAttributeSetResultsDatabase
-
disconnect
public void disconnect()Closes the SQLite connection and deletes the database file.- Overrides:
disconnectin classAttributeSetResultsDatabase
-
addPropertyValue
Description copied from class:AttributeSetResultsDatabaseAdds a new property value to the results database for the current tick.- Specified by:
addPropertyValuein classAttributeSetResultsDatabase- Type Parameters:
T- the value type- Parameters:
propertyName- the name of the propertypropertyValue- the value to record
-
addPreEventValue
Description copied from class:AttributeSetResultsDatabaseAdds a new pre-event value (e.g. trigger status) for the current tick.- Specified by:
addPreEventValuein classAttributeSetResultsDatabase- Type Parameters:
T- the value type- Parameters:
preEventName- the name of the pre-eventpreEventValue- the value to record
-
addPostEventValue
Description copied from class:AttributeSetResultsDatabaseAdds a new post-event value (e.g. trigger status) for the current tick.- Specified by:
addPostEventValuein classAttributeSetResultsDatabase- Type Parameters:
T- the value type- Parameters:
postEventName- the name of the post-eventpostEventValue- the value to record
-
setPropertyColumn
Description copied from class:AttributeSetResultsDatabaseReplaces or defines the entire set of values for a given property.- Specified by:
setPropertyColumnin classAttributeSetResultsDatabase- Parameters:
propertyName- the name of the propertypropertyValues- the full list of property values
-
setPreEventColumn
Description copied from class:AttributeSetResultsDatabaseReplaces or defines the full column of values for a pre-event.- Specified by:
setPreEventColumnin classAttributeSetResultsDatabase- Parameters:
preEventName- the name of the pre-eventpreEventValues- the full list of values
-
setPostEventColumn
Description copied from class:AttributeSetResultsDatabaseReplaces or defines the full column of values for a post-event.- Specified by:
setPostEventColumnin classAttributeSetResultsDatabase- Parameters:
postEventName- the name of the post-eventpostEventValues- the full list of values
-
getPropertyColumnAsList
Description copied from class:AttributeSetResultsDatabaseRetrieves the full column of recorded values for a property.- Specified by:
getPropertyColumnAsListin classAttributeSetResultsDatabase- Parameters:
propertyName- the name of the property- Returns:
- a list of recorded property values
-
getPreEventColumnAsList
Description copied from class:AttributeSetResultsDatabaseRetrieves the full column of recorded values for a pre-event.- Specified by:
getPreEventColumnAsListin classAttributeSetResultsDatabase- Parameters:
preEventName- the name of the pre-event- Returns:
- a list of recorded pre-event values
-
getPostEventColumnAsList
Description copied from class:AttributeSetResultsDatabaseRetrieves the full column of recorded values for a post-event.- Specified by:
getPostEventColumnAsListin classAttributeSetResultsDatabase- Parameters:
postEventName- the name of the post-event- Returns:
- a list of recorded post-event values
-