Engine

open class Engine<T, P : Position<out P>>(environment: Environment<T, P>, scheduler: Scheduler<T>) : Simulation<T, P> (source)

Represents a simulation engine that manages execution and scheduling. Provides multiple factory methods to simplify the creation process.

Parameters

T

the concentration type

P

the position type, extending Position

Inheritors

Constructors

Link copied to clipboard
constructor(environment: Environment<T, P>)

Constructs a simulation with a default scheduler.

constructor(environment: Environment<T, P>, scheduler: Scheduler<T>)

Functions

Link copied to clipboard
open override fun addOutputMonitor(op: OutputMonitor<T, P>)

Adds an output monitor to track simulation events.

Link copied to clipboard
open override fun getEnvironment(): Environment<T, P>
Link copied to clipboard
open override fun getError(): Optional<Throwable>
Link copied to clipboard
open override fun getOutputMonitors(): List<OutputMonitor<T, P>>
Link copied to clipboard
open override fun getStatus(): Status
Link copied to clipboard
open override fun getStep(): Long
Link copied to clipboard
open override fun getTime(): Time
Link copied to clipboard
open override fun goToStep(step: Long): CompletableFuture<Unit>

Moves the simulation forward until the given step is reached.

Link copied to clipboard
open override fun goToTime(t: Time): CompletableFuture<Unit>

Moves the simulation forward until the given time is reached.

Link copied to clipboard
open override fun neighborAdded(node: Node<T>, n: Node<T>)

Registers a newly added neighbor.

Link copied to clipboard
open override fun neighborRemoved(node: Node<T>, n: Node<T>)

Registers a removed neighbor.

Link copied to clipboard
open override fun nodeAdded(node: Node<T>)

Handles the addition of a new node.

Link copied to clipboard
open override fun nodeMoved(node: Node<T>)

Handles node movement.

Link copied to clipboard
open override fun nodeRemoved(node: Node<T>, oldNeighborhood: Neighborhood<T>)

Handles the removal of a node.

Link copied to clipboard
open override fun pause(): CompletableFuture<Unit>

Pauses the simulation.

Link copied to clipboard
open override fun play(): CompletableFuture<Unit>

Resumes the simulation.

Link copied to clipboard
open override fun reactionAdded(reactionToAdd: Actionable<T>)

Registers a newly added reaction.

Link copied to clipboard
open override fun reactionRemoved(reactionToRemove: Actionable<T>)

Registers a removed reaction.

Link copied to clipboard
open override fun removeOutputMonitor(op: OutputMonitor<T, P>)
Link copied to clipboard
open override fun run()

Runs the simulation.

Link copied to clipboard
open override fun schedule(runnable: CheckedRunnable)

Schedules a task for execution.

Link copied to clipboard
open override fun terminate(): CompletableFuture<Unit>

Terminates the simulation.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
open override fun waitFor(next: Status, timeout: Long, tu: TimeUnit): Status

Waits for the simulation to reach a given status.