AbstractEnvironment

abstract class AbstractEnvironment<T, P : Position<P>?> : Environment<T, P>

Very generic and basic implementation for an environment. Basically, only manages an internal set of nodes and their position.

Parameters

<T>

concentration type

<P>

Inheritors

Properties

Link copied to clipboard
val globalReactions: ListSet<GlobalReaction<T>>
Link copied to clipboard
Link copied to clipboard
val nodes: ListSet<Node<T>>
Link copied to clipboard
open var simulation: Simulation<T, P>

Functions

Link copied to clipboard
open fun addGlobalReaction(reaction: GlobalReaction<T>)
Link copied to clipboard
fun addLayer(molecule: Molecule, layer: Layer<T, P>)
Add a Layer to the Environment.
Link copied to clipboard
fun addNode(node: Node<T>, p: P): Boolean
This method allows to add a new node to this environment in a specific position.
Link copied to clipboard
open fun addTerminator(terminator: TerminationPredicate<T, P>)
Adds to the simulation a predicate that determines whether a simulation should be terminated.
Link copied to clipboard
fun forEach(action: Consumer<in Node<T>>)
Link copied to clipboard
abstract fun getDimensions(): Int

The number of dimensions of this environment.

Link copied to clipboard
Measures the distance between two nodes (n1, n2) in the environment.
Link copied to clipboard
abstract fun getGlobalReactions(): NonExistentClass
Link copied to clipboard
abstract fun getIncarnation(): Incarnation<T, P>

Return the Incarnation used to initialize the entities of this Environment, if it has been set.

Link copied to clipboard
fun getLayer(molecule: Molecule): Layer<T, P>
Get the Layer associate to the given molecule.
Link copied to clipboard
fun getLayers(): ListSet<Layer<T, P>>
Return all the Layers in this Environment.
Link copied to clipboard
Returns the current LinkingRule.
Link copied to clipboard
Given a node, this method returns its neighborhood.
Link copied to clipboard
fun getNodeByID(id: Int): Node<T>
Allows to access a Node in this Environment known its id.
Link copied to clipboard
Returns the number of Nodes currently in the Environment.
Link copied to clipboard
abstract fun getNodes(): NonExistentClass

Returns all the Nodes that exist in current Environment.

Link copied to clipboard
fun getNodesWithinRange(position: P, range: Double): ListSet<Node<T>>
Given a position this method returns a list of all the surroundings nodes within the given range.
fun getNodesWithinRange(node: Node<T>, range: Double): ListSet<Node<T>>
Given a node this method returns a list of all the surroundings nodes within the given range.
Link copied to clipboard
abstract fun getOffset(): Array<Double>

This method allows to know which are the smallest coordinates represented. Return an array of length dimensions containing the smallest coordinates for each dimension.

Link copied to clipboard
fun getPosition(node: Node<T>): P
Calculates the position of a node.
Link copied to clipboard
abstract fun getSimulation(): Simulation<T, P>

Return the current Simulation, if present, or throws an IllegalStateException otherwise.

Link copied to clipboard
Return the current Simulation, if present, or null otherwise.
Link copied to clipboard
abstract fun getSize(): Array<Double>

The size of the environment as an array of length getDimensions(). This method must return distance measured with the same unit used by the positions. No non-euclidean distance metrics are allowed.

Link copied to clipboard
Override this method if units measuring distance do not match with units used for coordinates.
Link copied to clipboard
Return true if all the terminators are true.
Link copied to clipboard
Link copied to clipboard
abstract fun makePosition(coordinates: Array<Number>): P

Given the coordinates of the point, returns a Position compatible with this environment.

Link copied to clipboard
abstract fun moveNodeToPosition(node: Node<T>, position: P)

This method moves a node in the environment to some position. If node move is unsupported, it does nothing.

Link copied to clipboard
fun <R> Iterable<R>.randomElement(randomGenerator: <Error class: unknown class>): R

Returns a random element of the Iterable using the provided randomGenerator.

Link copied to clipboard
Remove a GlobalReaction from the Environment.
Link copied to clipboard
fun removeNode(node: Node<T>)
This method allows to remove a node.
Link copied to clipboard
Returns the current LinkingRule.
Link copied to clipboard
abstract fun setSimulation(<set-?>: Simulation<T, P>)

Return the current Simulation, if present, or throws an IllegalStateException otherwise.

Link copied to clipboard
fun <R> Iterable<R>.shuffled(randomGenerator: <Error class: unknown class>): Iterable<R>

Fisher–Yates shuffle algorithm using a RandomGenerator. More information on Wikipedia.

Link copied to clipboard
Link copied to clipboard
fun <T, P : Position<out P>, TS : Any> Environment<T, P>.toEnvironmentSurrogate(toConcentrationSurrogate: (T) -> TS): EnvironmentSurrogate<TS, PositionSurrogate>

A function that maps an Environment to its surrogate class (EnvironmentSurrogate). Use the toSuitablePositionSurrogate strategy for PositionSurrogate mapping.

fun <T, P : Position<out P>, TS : Any, PS : PositionSurrogate> Environment<T, P>.toEnvironmentSurrogate(toConcentrationSurrogate: (T) -> TS, toPositionSurrogate: (P) -> PS): EnvironmentSurrogate<TS, PS>

A function that maps an Environment to its surrogate class (EnvironmentSurrogate).

Link copied to clipboard
open fun toString(): String
Not used internally.