program

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.

The block, if provided, is executed in a scope where:

  • the reaction is available as a context receiver, and

  • ActionableContext is the receiver, enabling the addition of actions and conditions.

After the configuration block is executed, the reaction is added to the current node via Node.addReaction.

Parameters

reaction

the reaction to configure and register.

block

an optional configuration block for actions and conditions.


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.

The program parameter is forwarded to Incarnation.createReaction and its meaning depends on the concrete incarnation in use. A null descriptor delegates the choice of the program to the incarnation.

The created reaction uses the current timeDistribution context receiver, and is created within the current environment, using the provided randomGenerator, and targeting the current node.

The optional block is applied as described in program(Reaction, block) before the reaction is added to the node.

Parameters

program

the incarnation-specific reaction/program descriptor, possibly null.

block

an optional configuration block for actions and conditions.