KSLDatabase

class KSLDatabase(db: Database, clearDataOption: Boolean = false) : DatabaseIOIfc

Constructors

Link copied to clipboard
constructor(dbName: String, dbDirectory: Path = dbDir, clearDataOption: Boolean = true)

This constructs a SQLite database on disk and configures it to hold KSL simulation data. The database will be empty.

constructor(db: Database, clearDataOption: Boolean = false)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

If true the underlying database was configured as a KSLDatabase

Link copied to clipboard
open override var defaultSchemaName: String?

Sets the name of the default schema

Link copied to clipboard

Returns the names of the experiments in the EXPERIMENT table.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override var label: String

identifying string representing the database. This has no relation to the name of the database on disk or in the dbms. The sole purpose is for labeling of output

Link copied to clipboard
open override var outputDirectory: OutputDirectory
Link copied to clipboard
open override val schemaNames: List<String>
Link copied to clipboard
open override val userDefinedTables: Map<String?, List<String>>

The returned map may have a null key because not all databases support the schema concept. There can be table names associated with null as the key.

Link copied to clipboard
open override val views: Map<String?, List<String>>

The returned map may have a null key because not all databases support the schema concept. There can be view names associated with null as the key.

Link copied to clipboard

Functions

Link copied to clipboard

Clears all data from user defined tables

Link copied to clipboard

Deletes all simulation data associated with the supplied model. In other words, the simulation run data associated with a simulation with the name and the experiment with the name.

Link copied to clipboard

The expName should be unique within the database. Many experiments can be run with different names for the same simulation. This method deletes the experiment record with the provided name AND all related data associated with that experiment. If an experiment record does not exist with the expName, then nothing occurs.

Link copied to clipboard

Checks if the supplied experiment name exists within the database. Experiment names should be unique within the database

Link copied to clipboard
open override fun exportAllTablesAsCSV(schemaName: String?, pathToOutPutDirectory: Path, header: Boolean)

Writes all tables as separate comma separated value files into the supplied directory. The files are written to text files using the same name as the tables in the database

Link copied to clipboard
open override fun exportAllTablesAsInsertQueries(schemaName: String?, out: PrintWriter)

Writes all table data as insert queries to the PrintWriter

Link copied to clipboard
open override fun exportAllViewsAsCSV(schemaName: String?, pathToOutPutDirectory: Path, header: Boolean)

Writes all tables as separate comma separated value files into the supplied directory. The files are written to text files using the same name as the tables in the database

Link copied to clipboard
open override fun exportInsertQueries(tableName: String, schemaName: String?, out: PrintWriter)

Writes the insert queries associated with the supplied table to the PrintWriter

Link copied to clipboard
open override fun exportTableAsCSV(tableName: String, schemaName: String?, out: PrintWriter, header: Boolean)

Writes the table as comma separated values

Link copied to clipboard
open override fun exportToExcel(schemaName: String?, wbName: String, wbDirectory: Path)

Writes each table in the schema to an Excel workbook with each table being placed in a new sheet with the sheet name equal to the name of the table. The column names for each table are written as the first row of each sheet.

open override fun exportToExcel(tableNames: List<String>, schemaName: String?, wbName: String, wbDirectory: Path)

Writes each table in the list to an Excel workbook with each table being placed in a new sheet with the sheet name equal to the name of the table. The column names for each table are written as the first row of each sheet.

Link copied to clipboard

Retrieves the data for the named experiment or null if an experiment with the provided expName name is not found in the database

Link copied to clipboard
open override fun importSheetToTable(sheet: Sheet, tableName: String, numColumns: Int, schemaName: String?, numRowsToSkip: Int, rowBatchSize: Int, unCompatibleRows: PrintWriter): Boolean

Copies the rows from the sheet to the table. The copy is assumed to start at row 1, column 1 (i.e. cell A1) and proceed to the right for the number of columns in the table and the number of rows of the sheet. The copy is from the perspective of the table. That is, all columns of a row of the table are attempted to be filled from a corresponding row of the sheet. If the row of the sheet does not have cell values for the corresponding column, then the cell is interpreted as a null value when being placed in the corresponding column. It is up to the client to ensure that the cells in a row of the sheet are data type compatible with the corresponding column in the table. Any rows that cannot be transfer in their entirety are logged to the supplied PrintWriter

Link copied to clipboard
open override fun importWorkbookToSchema(pathToWorkbook: Path, tableNames: List<String>, schemaName: String?, skipFirstRow: Boolean)

Opens the workbook for reading only and writes the sheets of the workbook into database tables. The list of names is the names of the sheets in the workbook and the names of the tables that need to be written. They are in the order that is required for entering data so that no integrity constraints are violated. The underlying workbook is closed after the operation.

Link copied to clipboard

This prepares a map that can be used with MultipleComparisonAnalyzer and returns the MultipleComparisonAnalyzer. If the set of simulation runs does not contain the provided experiment name, then an IllegalArgumentException occurs. If there are multiple simulation runs with the same experiment name, then an IllegalArgumentException occurs. In other words, when running the experiments, the user must make the experiment names unique in order for this map to be built.

Link copied to clipboard
open override fun printAllTablesAsInsertQueries(schemaName: String?)

Prints all table data as insert queries to the console

Link copied to clipboard
open override fun printAllTablesAsMarkdown(schemaName: String?)

Prints all tables as text to the console

Link copied to clipboard
open override fun printAllTablesAsText(schemaName: String?)

Prints all tables as text to the console

Link copied to clipboard
open override fun printInsertQueries(tableName: String, schemaName: String?)

Prints the insert queries associated with the supplied table to the console

Link copied to clipboard
open override fun printTableAsCSV(tableName: String, schemaName: String?, header: Boolean)

Prints the table as comma separated values to the console

Link copied to clipboard
open override fun printTableAsMarkdown(tableName: String, schemaName: String?)

Prints the table as prettified text to the console

Link copied to clipboard
open override fun printTableAsText(tableName: String, schemaName: String?)

Prints the table as prettified text to the console

Returns a map of maps. The outer map has the experiment name as its key. The inner map has the response's name as the key and the replication results as a double array. The array contains the observed replication statistic for the response variable or the final count for a counter for each replication.

Link copied to clipboard

Returns a map of maps. The outer map has the experiment name as its key. The inner map has the response's name as the key and the replication results as a list of double values. The list contains the observed replication statistic for the response variable or the final count for a counter for each replication.

Link copied to clipboard

Returns the observations for the named experiment and the named statistical response from the within replication data. If the experiment name expNameStr is not found, then an empty array is returned. If the experiment is found, but the response name statNameStr is not found, then an empty array is returned.

Link copied to clipboard

This prepares a map that can be used with MultipleComparisonAnalyzer. If the set of simulation runs does not contain the provided experiment names, then an IllegalArgumentException occurs. If there are multiple simulation runs with the same experiment name, then an IllegalArgumentException occurs. In other words, when running the experiments, the user must make the experiment names unique in order for this map to be built.

Link copied to clipboard

Returns a list containing the within replication data

Link copied to clipboard
fun withinRepViewStatistics(responseName: String): AnyFrame

Returns a data frame that has columns (exp_name, rep_id, responseName) where the values in the responseName column have the value of the response for the named experiments and the replication id (number) for the value.

Link copied to clipboard
open override fun writeAllTablesAsMarkdown(schemaName: String?, out: PrintWriter)

Writes all tables as text

Link copied to clipboard
open override fun writeAllTablesAsText(schemaName: String?, out: PrintWriter)

Writes all tables as text

Link copied to clipboard
open override fun writeAllViewsAsMarkdown(schemaName: String?, out: PrintWriter)

Writes all tables as text

Link copied to clipboard
open override fun writeTableAsMarkdown(tableName: String, schemaName: String?, out: PrintWriter)

Writes the table as prettified text.

Link copied to clipboard
open override fun writeTableAsText(tableName: String, schemaName: String?, out: PrintWriter)

Writes the table as prettified text.