Class AttributeSetResultsDatabase

java.lang.Object
modelarium.attributes.results.databases.AttributeSetResultsDatabase
Direct Known Subclasses:
DiskBasedAttributeSetResultsDatabase, MemoryBasedAttributeSetResultsDatabase

public abstract class AttributeSetResultsDatabase extends Object
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 Details

    • AttributeSetResultsDatabase

      public AttributeSetResultsDatabase()
  • Method Details

    • setDatabasePath

      protected void setDatabasePath(String databasePath)
      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

      public String 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

      public abstract <T> void addPropertyValue(String propertyName, T propertyValue)
      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 property
      propertyValue - the value to record
    • addPreEventValue

      public abstract <T> void addPreEventValue(String preEventName, T preEventValue)
      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-event
      preEventValue - the value to record
    • addPostEventValue

      public abstract <T> void addPostEventValue(String postEventName, T postEventValue)
      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-event
      postEventValue - the value to record
    • setPropertyColumn

      public abstract void setPropertyColumn(String propertyName, List<Object> propertyValues)
      Replaces or defines the entire set of values for a given property.
      Parameters:
      propertyName - the name of the property
      propertyValues - the full list of property values
    • setPreEventColumn

      public abstract void setPreEventColumn(String preEventName, List<Object> preEventValues)
      Replaces or defines the full column of values for a pre-event.
      Parameters:
      preEventName - the name of the pre-event
      preEventValues - the full list of values
    • setPostEventColumn

      public abstract void setPostEventColumn(String postEventName, List<Object> postEventValues)
      Replaces or defines the full column of values for a post-event.
      Parameters:
      postEventName - the name of the post-event
      postEventValues - the full list of values
    • getPropertyColumnAsList

      public abstract List<Object> getPropertyColumnAsList(String propertyName)
      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

      public abstract List<Object> getPreEventColumnAsList(String preEventName)
      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

      public abstract List<Object> getPostEventColumnAsList(String postEventName)
      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