AlchemistExecutionContext

Execution context that bridges the Alchemist simulation and the Protelis VM.

This class provides Protelis with the device identity, coordinates, timing and network-related information retrieved from the hosting Alchemist simulation objects.

Parameters

node

the local node hosting this execution context

protelisDevice

the device wrapper exposing node properties to Protelis

reaction

the reaction hosting the running Protelis program

networkManager

the network manager used to share state among neighbouring devices

Type Parameters

P

the position type used by the environment

Constructors

Link copied to clipboard
constructor(environmentAccess: Environment<Any, P>, node: Node<Any>, protelisDevice: ProtelisDevice<P>, reaction: Reaction<Any>, randomGenerator: RandomGenerator, networkManager: AlchemistNetworkManager)
constructor(environment: Environment<Any, P>, localNode: Node<Any>, reaction: Reaction<Any>, random: RandomGenerator, networkManager: AlchemistNetworkManager)

Types

Link copied to clipboard
object Companion

Internal constants.

Properties

Link copied to clipboard
open override val coordinates: Tuple
Link copied to clipboard
open override val currentTime: Double
Link copied to clipboard
open override val deltaTime: Number?
Link copied to clipboard

The device position, in form of Position.

Link copied to clipboard
open override val deviceUID: DeviceUID
Link copied to clipboard

Experimental access to the simulated environment, for building oracles.

Link copied to clipboard
Link copied to clipboard

The internal random generator used by the execution context.

Link copied to clipboard
override val storedState: Map<CodePath?, Any?>?

Functions

Link copied to clipboard
fun <T : Any?, R : Any?> buildField(computeValue: Function<T?, R?>?, localValue: T?): Field<R?>?
Link copied to clipboard
fun <T : Any?, R : Any?> buildFieldDeferred(computeValue: Function<T?, R?>?, currentLocal: T?, toBeSent: Supplier<T?>?): Field<R?>?
Link copied to clipboard
fun commit()
Link copied to clipboard
fun distanceTo(target: Int): Double
fun distanceTo(target: DeviceUID?): Double

Computes the distance between two nodes, through Environment.getDistanceBetweenNodes.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun getCoordinates(): Tuple
Link copied to clipboard
open override fun getCurrentTime(): Double
Link copied to clipboard
open fun getDeltaTime(): Number?
Link copied to clipboard
open override fun getDeviceUID(): DeviceUID
Link copied to clipboard
fun <P : Any?> getPersistent(ifAbsent: Supplier<P?>?): P?
Link copied to clipboard
fun getVariable(name: Reference?): Any?
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun nbrDelay(): Field<Number>
Link copied to clipboard
open override fun nbrLag(): Field<Number>
Link copied to clipboard
open override fun nbrRange(): Field<Double>
Link copied to clipboard
open override fun nbrVector(): Field<Tuple>
Link copied to clipboard
fun newCallStackFrame(vararg id: Byte)
fun newCallStackFrame(vararg id: Int)
Link copied to clipboard
open override fun nextRandomDouble(): Double
Link copied to clipboard
Link copied to clipboard
fun putVariable(name: Reference?, value: Any?)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Computes the distance along a map. Requires a MapEnvironment.

Link copied to clipboard
fun <T : Any?> runInNewStackFrame(id: Int, operation: Function<ExecutionContext?, T?>?): T?
Link copied to clipboard
fun setGloballyAvailableReferences(knownFunctions: Map<Reference?, *>?)
Link copied to clipboard
Link copied to clipboard
fun setup()