ContentContext

DSL utilities for defining the initial contents of a Node.

This context provides helpers to:

  • build concentrations using the current Incarnation;

  • assign concentrations to a Node using the unary minus operator.

The API is based on Kotlin context receivers: the required Incarnation and/or Node are expected to be available in the current context.

Functions

Link copied to clipboard
context(incarnation: Incarnation<T, *>)
fun <T> concentrationOf(origin: Any?): T

Creates a concentration value using the current Incarnation.

Link copied to clipboard
context(incarnation: Incarnation<T, *>, node: Node<T>)
operator fun <T> Molecule.invoke(concentration: T = incarnation.createConcentration())

Assigns the given concentration to this Molecule on the current Node.

context(incarnation: Incarnation<T, *>, node: Node<T>)
operator fun <T> String.invoke(concentration: T = incarnation.createConcentration())

Create the Molecule identified by this string using the current Incarnation and assign it the provided concentration on the current Node.

Link copied to clipboard
context(incarnation: Incarnation<T, *>, _: Node<T>)
operator fun <T> Molecule.unaryMinus()

Assigns a default concentration for this Molecule to the current Node.

context(incarnation: Incarnation<T, *>, _: Node<T>)
operator fun <T> String.unaryMinus()

Create a Molecule using its name and assign a default concentration to the current Node.