TimeDistributionContext

DSL scope for defining one or more Reactions that share a common TimeDistribution.

This scope is meant to be used via Kotlin context receivers: a TimeDistribution (and, for some operations, additional objects such as Node, Incarnation, Environment, and RandomGenerator) must be available in the surrounding context.

The provided helpers support two common workflows:

  • registering an already-built Reaction on the current Node;

  • creating a Reaction from an incarnation-specific program descriptor and registering it on the current Node.

In both cases, an optional configuration block can be provided to attach it.unibo.alchemist.model.Actions and it.unibo.alchemist.model.Conditions via ActionableContext.

Properties

Link copied to clipboard
context(timeDistribution: TimeDistribution<T>)
open val timeDistribution: TimeDistribution<T>

Provides access to the current TimeDistribution context receiver.

Functions

Link copied to clipboard
context(incarnation: Incarnation<T, P>, randomGenerator: RandomGenerator, environment: Environment<T, P>, node: Node<T>, timeDistribution: TimeDistribution<T>)
open fun program(program: String?, block: context(Reaction<T>) ActionableContext.() -> Unit = { }): ERROR CLASS: Recursive implicit type

Creates a Reaction from an incarnation-specific program descriptor and registers it on the current Node.

context(node: Node<T>)
open fun <R : Reaction<T>> program(reaction: R, block: context(R) ActionableContext.() -> Unit = { })

Registers an existing reaction on the current Node and optionally configures it.