TargetMapWalker

open class TargetMapWalker<T, O : RoutingServiceOptions<O>, S : RoutingService<GeoPosition, O>> @JvmOverloads constructor(environment: MapEnvironment<T, O, S>, reaction: NodeReaction<T>, trackMolecule: Molecule, interactingMolecule: Molecule?, speed: Double = DEFAULT_SPEED, interaction: Double = DEFAULT_INTERACTION, range: Double = DEFAULT_RANGE) : MoveOnMap<T, O, S>

Walks on the streets of the map towards the target stored in a molecule of the node.

The target is read from trackMolecule whenever a new target is needed. A GeoPosition is used as-is; for an Iterable, its first two values, as numbers or numeric strings, become the coordinates; any other value is converted to a string and parsed for numbers. The rate of the owning reaction determines the distance walked at each step. If interaction is positive and interactingMolecule is not null, nodes within range that contain interactingMolecule slow this node down, the more the higher interaction is.

Type Parameters

T

concentration type

Constructors

Link copied to clipboard
constructor(environment: MapEnvironment<T, O, S>, reaction: NodeReaction<T>, trackMolecule: Molecule, interactingMolecule: Molecule?, speed: Double = DEFAULT_SPEED, interaction: Double = DEFAULT_INTERACTION, range: Double = DEFAULT_RANGE)
constructor(environment: MapEnvironment<T, O, S>, reaction: NodeReaction<T>, trackMolecule: String, interactingMolecule: String?, speed: Double, interaction: Double, range: Double)

Builds the walker from molecule names; a null interactingMolecule disables interactions.

constructor(environment: MapEnvironment<T, O, S>, reaction: NodeReaction<T>, trackMolecule: String, speed: Double = DEFAULT_SPEED)

Builds a walker without interactions from the name of the tracked molecule.

Types

Link copied to clipboard
object Companion

Default values of the walker.

Properties

Link copied to clipboard
override val environment: MapEnvironment<T, O, S>

the environment where the node moves

Link copied to clipboard
override val reaction: NodeReaction<T>

The NodeReaction owning this action, hosted by targetNode.

Link copied to clipboard

Functions

Link copied to clipboard
override fun cloneAction(newReaction: Reaction<T>): Action<T>

Creates an equivalent action owned by newReaction, such as a reaction cloned onto a new node. An action targeting the host of its reaction targets the host of newReaction, which must then be a Node; an action targeting any other node keeps its target.

Link copied to clipboard
open override fun execute()

Moves the node according to getNextPosition, in absolute or relative coordinates depending on isAbsolute.

Link copied to clipboard

The next position to reach, in absolute or relative coordinates depending on isAbsolute.

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