ToggleMoleculeRandomly

open class ToggleMoleculeRandomly<T>(node: Node<T>, randomGenerator: RandomGenerator, molecule: Molecule, concentration: T, odds: Double) : ToggleMolecule<T>

Treats molecule as a probabilistic switch:

  • if it is present, then with probability odds it's removed from node;

  • otherwise, with probability odds it is inserted in node with the provided concentration.

Parameters

node

the node containing the molecule to toggle

molecule

the molecule to toggle

concentration

the concentration to use for the "on" state

Type Parameters

T

the concentration type

Constructors

Link copied to clipboard
constructor(node: Node<T>, randomGenerator: RandomGenerator, molecule: Molecule, concentration: T, odds: Double)

Properties

Link copied to clipboard
open override val context: Context
Link copied to clipboard

Functions

Link copied to clipboard
open override fun cloneAction(node: Node<T>, reaction: Reaction<T>): ToggleMoleculeRandomly<T>

This method allows to clone this action on a new node. It may result useful to support runtime creation of nodes with the same reaction programming, e.g. for morphogenesis.

Link copied to clipboard
open override fun execute()

Rolls the dice and toggles the molecule.

Link copied to clipboard
open override fun getContext(): Context
Link copied to clipboard
infix fun Action<*>.shouldEqual(other: Action<*>)