GraphQLMonitor

class GraphQLMonitor<T, P : Position<out P>> @JvmOverloads constructor(val environment: Environment<T, P>, host: String = DefaultGraphQLSettings.DEFAULT_HOST, port: Int = DefaultGraphQLSettings.DEFAULT_PORT, teardownOnSimulationTermination: Boolean = true, serverDispatcher: CoroutineDispatcher = Dispatchers.Default) : OutputMonitor<Any, Nothing>

An OutputMonitor observing the environment through a GraphQL server listening on host:port. The server is started in a new coroutine on the serverDispatcher dispatcher. By default, the server is stopped after the simulation terminates. This behavior can be changed by setting teardownOnSimulationTermination to false.

Constructors

Link copied to clipboard
constructor(environment: Environment<T, P>, host: String = DefaultGraphQLSettings.DEFAULT_HOST, port: Int = DefaultGraphQLSettings.DEFAULT_PORT, teardownOnSimulationTermination: Boolean = true, serverDispatcher: CoroutineDispatcher = Dispatchers.Default)

Properties

Link copied to clipboard

Functions

Link copied to clipboard
open override fun finished(environment: Environment<Any, Nothing>, time: Time, step: Long)

Called once the whole simulation has finished, either because it reached its latest point or because the user stopped it, with the environment, the final time, and the last step.

Link copied to clipboard
open override fun initialized(environment: Environment<Any, Nothing>)

Called as soon as the initialization phase of environment is completed.

Link copied to clipboard
open fun stepDone(environment: Environment<Any, Nothing>, reaction: Reaction<Any>?, time: Time, step: Long)

Called every time a simulation step is done, with the environment, the last executed reaction (if any), the current time, and the current step.