Class AttributeSetResultsDatabase
java.lang.Object
modelarium.attributes.results.databases.AttributeSetResultsDatabase
- Direct Known Subclasses:
DiskBasedAttributeSetResultsDatabase,MemoryBasedAttributeSetResultsDatabase
Abstract base class representing a database for storing and retrieving simulation results
related to attribute sets, including properties and event values.
Concrete implementations may write to in-memory structures, files, or external systems. This class supports both tick-by-tick updates and full-column writes.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract <T> voidaddPostEventValue(String postEventName, T postEventValue) Adds a new post-event value (e.g. trigger status) for the current tick.abstract <T> voidaddPreEventValue(String preEventName, T preEventValue) Adds a new pre-event value (e.g. trigger status) for the current tick.abstract <T> voidaddPropertyValue(String propertyName, T propertyValue) Adds a new property value to the results database for the current tick.voidconnect()Opens the database or output stream for writing.voidCloses the database or output stream.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) Sets the path to the database used for output (e.g.abstract voidsetPostEventColumn(String postEventName, List<Object> postEventValues) Replaces or defines the full column of values for a post-event.abstract voidsetPreEventColumn(String preEventName, List<Object> preEventValues) Replaces or defines the full column of values for a pre-event.abstract voidsetPropertyColumn(String propertyName, List<Object> propertyValues) Replaces or defines the entire set of values for a given property.
-
Constructor Details
-
AttributeSetResultsDatabase
public AttributeSetResultsDatabase()
-
-
Method Details
-
setDatabasePath
Sets the path to the database used for output (e.g. CSV file, SQLite DB, etc.).- Parameters:
databasePath- a string identifying where the data will be stored
-
getDatabasePath
- Returns:
- the current path or identifier of the results database
-
connect
public void connect()Opens the database or output stream for writing.Default implementation does nothing. Subclasses should override if needed.
-
disconnect
public void disconnect()Closes the database or output stream.Default implementation does nothing. Subclasses should override if needed.
-
addPropertyValue
Adds a new property value to the results database for the current tick.- Type Parameters:
T- the value type- Parameters:
propertyName- the name of the propertypropertyValue- the value to record
-
addPreEventValue
Adds a new pre-event value (e.g. trigger status) for the current tick.- Type Parameters:
T- the value type- Parameters:
preEventName- the name of the pre-eventpreEventValue- the value to record
-
addPostEventValue
Adds a new post-event value (e.g. trigger status) for the current tick.- Type Parameters:
T- the value type- Parameters:
postEventName- the name of the post-eventpostEventValue- the value to record
-
setPropertyColumn
Replaces or defines the entire set of values for a given property.- Parameters:
propertyName- the name of the propertypropertyValues- the full list of property values
-
setPreEventColumn
Replaces or defines the full column of values for a pre-event.- Parameters:
preEventName- the name of the pre-eventpreEventValues- the full list of values
-
setPostEventColumn
Replaces or defines the full column of values for a post-event.- Parameters:
postEventName- the name of the post-eventpostEventValues- the full list of values
-
getPropertyColumnAsList
Retrieves the full column of recorded values for a property.- Parameters:
propertyName- the name of the property- Returns:
- a list of recorded property values
-
getPreEventColumnAsList
Retrieves the full column of recorded values for a pre-event.- Parameters:
preEventName- the name of the pre-event- Returns:
- a list of recorded pre-event values
-
getPostEventColumnAsList
Retrieves the full column of recorded values for a post-event.- Parameters:
postEventName- the name of the post-event- Returns:
- a list of recorded post-event values
-