Simulator

sealed interface Simulator

Core simulation engine that orchestrates discrete event simulation.

The simulator maintains a priority queue of events and executes them in chronological order. It is responsible for advancing simulation time and invoking associated event handlers.

Types

Link copied to clipboard
object Companion

Companion object of the Simulator holding static constants

Properties

Link copied to clipboard
abstract val currentTime: Instant

Current simulation time.

Link copied to clipboard
abstract val isFinished: Boolean

Whether the simulation has finished (no more events scheduled).

Link copied to clipboard
abstract val nextEventTime: Instant?

Time of the next scheduled event, or null if the simulation has finished.

Functions

Link copied to clipboard
abstract fun log(message: () -> String)

Logs an arbitrary message with the current simulation time.

Link copied to clipboard
abstract fun nextStep()

Executes the next batch of events (all events at the same simulation time).

Link copied to clipboard
abstract fun runFor(events: Int)

Runs the simulation for a specified number of events.

abstract fun runFor(duration: Duration)

Runs the simulation for a specified duration of simulation time.