Class MemoryBasedAttributeSetResultsDatabase
java.lang.Object
modelarium.attributes.results.databases.AttributeSetResultsDatabase
modelarium.attributes.results.databases.MemoryBasedAttributeSetResultsDatabase
An in-memory implementation of
AttributeSetResultsDatabase.
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 DiskBasedAttributeSetResultsDatabase, this class does not persist results to disk.
-
Constructor Summary
Constructors -
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.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.protected voidsetDatabasePath(String databasePath) Overrides setDatabasePath but ignores the value, as memory-based storage does not require a file path.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
connect, disconnect, getDatabasePath
-
Constructor Details
-
MemoryBasedAttributeSetResultsDatabase
public MemoryBasedAttributeSetResultsDatabase()
-
-
Method Details
-
setDatabasePath
Overrides setDatabasePath but ignores the value, as memory-based storage does not require a file path.- Overrides:
setDatabasePathin classAttributeSetResultsDatabase- Parameters:
databasePath- ignored
-
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
-