GenericNode

open class GenericNode<T> @JvmOverloads constructor(val environment: Environment<T, *>, val id: Int = idFromEnv(environment), molecules: MutableMap<Molecule, T> = LinkedHashMap(), properties: MutableList<Capability<T>> = ArrayList()) : Node<T>

This class realizes an abstract node. You may extend it to realize your own nodes.

Parameters

concentration type

Inheritors

Constructors

Link copied to clipboard
constructor(environment: Environment<T, *>, id: Int = idFromEnv(environment), molecules: MutableMap<Molecule, T> = LinkedHashMap(), properties: MutableList<Capability<T>> = ArrayList())

Properties

Link copied to clipboard
Link copied to clipboard
open override val currentMoleculeCount: Int
Link copied to clipboard

The environment in which the node is places.

Link copied to clipboard
override val id: Int
Link copied to clipboard
open override val moleculeCount: Observable<Int>

Observes the count of different molecules in this node.

Link copied to clipboard
override val properties: List<Capability<T>>
Link copied to clipboard

This method allows to access all the reaction of the node.

Functions

Link copied to clipboard
override fun addProperty(capability: Capability<T>)

Adds a capability to the node. Properties are part of the node setup: adding one fails once the node is in an environment, so properties can be read without being observed.

Link copied to clipboard
override fun addReaction(reaction: Reaction<T>)

Registers reaction and notifies the running simulation when it was not already present. Fails if this is not the Reaction.host of reaction.

Link copied to clipboard
open fun <C : Capability<T>> asProperty(superType: Class<C>): C
open fun <C : Capability<T>> asProperty(superType: KClass<C>): C

returns a Capability of the provided superType.

Link copied to clipboard
inline fun <T, C : Capability<T>> Node<T>.asProperty(): C

Returns the node property of the reified type C.

Link copied to clipboard
open fun <C : Capability<T>> asPropertyOrNull(superType: Class<in C>): C?
open fun <C : Capability<T>> asPropertyOrNull(superType: KClass<in C>): C?

returns a Capability of the provided superType.

Link copied to clipboard
inline fun <T, C : Capability<T>> Node<T>.asPropertyOrNull(): C?

Returns the node property of the reified type C, or null if the node does not have a compatible property.

Link copied to clipboard
open override fun cloneNode(): Node<T>

Creates a new Node which is a clone of the current Node. The new Node will have all the current Node's properties, such as reactions and molecules, but it will also have a different ID. Its reactions are cloned through NodeReaction.cloneOnNewNode.

Link copied to clipboard
operator override fun compareTo(@Nonnull other: Node<T>): Int
Link copied to clipboard
open override fun concentrationOf(molecule: Molecule): Observable<Option<T>>

Observe the concentration calculated with the given molecule. The result of this computation is wrapped into an Option and some if the value is present, otherwise none.

Link copied to clipboard
open operator override fun contains(molecule: Molecule): Boolean

Tests whether a node contains a Molecule.

Link copied to clipboard
open override fun containsMolecule(molecule: Molecule): Observable<Boolean>

Observes whether a node contains a Molecule.

Link copied to clipboard
open override fun dispose()

Disposes and releases the resources held by this object.

Link copied to clipboard
operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open operator override fun get(molecule: Molecule): Option<T>

The concentration of a molecule, some if the molecule is present in this node, none otherwise.

Link copied to clipboard
override fun hashCode(): Int
Link copied to clipboard
open fun Reaction<T>.remove()

Unregisters this reaction from its host, see removeReaction.

Link copied to clipboard
open override fun removeAllConcentrationOf(moleculeToRemove: Molecule)
Link copied to clipboard
override fun removeReaction(reaction: Reaction<T>)

Unregisters reaction and notifies the running simulation when it was actually present.

Link copied to clipboard
open operator override fun set(molecule: Molecule, concentration: T)

Sets the concentration of mol to c.

Link copied to clipboard
infix fun Node<*>.shouldEqual(other: Node<*>)
Link copied to clipboard
Link copied to clipboard
fun <T, P : Position<out P>, TS : Any, PS : PositionSurrogate> Node<T>.toNodeSurrogate(environment: Environment<T, P>, toConcentrationSurrogate: (T) -> TS, toPositionSurrogate: (P) -> PS): NodeSurrogate<TS, PS>
Link copied to clipboard
open override fun toString(): String