InMemoryComparisonSource

Test fixture implementation of ComparisonDataSourceIfc backed by an in-memory map. Used by the substrate's own tests and available to any host (Swing, web, CLI, headless) that wants to drive a comparison UI without spinning up a real run.

Construction is via the builder-style Builder helper so test setup reads naturally:

val source = InMemoryComparisonSource.builder("test")
.experiment("S1", model = "MM1") {
response("SystemTime", ResponseCategory.OBSERVATION, doubleArrayOf(1.0, 2.0))
response("NumBusy", ResponseCategory.TIME_WEIGHTED, doubleArrayOf(0.5, 0.6))
}
.build()

Types

Link copied to clipboard
class Builder(sourceLabel: String)

DSL-friendly builder.

Link copied to clipboard
object Companion
Link copied to clipboard

Properties

Link copied to clipboard
open override val sourceLabel: String

Human-readable label for the source — shown in the comparison-analyzer header. Free-form; typical values: "Scenario run · 2025-05-15 · 4 scenarios", "Designed experiment · 12 points", "KSL database · queue-study.db".

Functions

Link copied to clipboard

All experiments available for comparison from this source, in source-natural order (commit order for scenarios, execution order for design points, table order for DB loads). Empty when the source has no experiments.

Link copied to clipboard
open override fun observations(experimentName: String, responseName: String): DoubleArray?

Per-replication observations for the given experimentName / responseName pair. Returns null when the experiment did not record that response, when the experiment is unknown, or when no per-replication data is available (counters that record only an end-of-replication count are surfaced as last_value and still return a one-value-per-rep array). Empty array is reserved for "experiment recorded the response but produced no values" — vanishingly rare in practice but worth distinguishing from "no recording at all".