Simulation

interface Simulation<T, P : Position<out P>?> : Runnable(source)

This interface forces simulations to be independent threads, and make them controllable from an external console.

Parameters

<T>

Concentration type

<P>

Position Type

Functions

Link copied to clipboard
abstract fun addOutputMonitor(op: OutputMonitor<T, P>)
Adds an OutputMonitor to this simulation.
Link copied to clipboard
abstract fun getEnvironment(): Environment<T, P>
Allows to access the current environment.
Link copied to clipboard
abstract fun getError(): Optional<Throwable>
Link copied to clipboard
Allows to access a list of all the OutputMonitor currently attached to this simulation.
Link copied to clipboard
abstract fun getStatus(): Status
Allows to access the current status.
Link copied to clipboard
abstract fun getStep(): Long
Allows to access the current simulation step.
Link copied to clipboard
abstract fun getTime(): Time
Allows to know which is the current simulation time.
Link copied to clipboard
abstract fun goToStep(steps: Long): CompletableFuture<Void>
Executes a certain number of steps, then pauses it.
Link copied to clipboard
abstract fun goToTime(t: Time): CompletableFuture<Void>
Executes the simulation until the target time is reached, then pauses it.
Link copied to clipboard
abstract fun neighborAdded(node: Node<T>, n: Node<T>)
This method must get called in case a communication link connecting two nodes gets created during the simulation.
Link copied to clipboard
abstract fun neighborRemoved(node: Node<T>, n: Node<T>)
This method must get called in case a a communication link connecting two nodes gets broken during the simulation.
Link copied to clipboard
abstract fun nodeAdded(node: Node<T>)
This method must get called in case a node is added to the environment during the simulation and after its neighborhood has been computed (or can be consistently computed by the simulated environment).
Link copied to clipboard
abstract fun nodeMoved(node: Node<T>)
This method must get called in case a node is moved in the environment during the simulation and after its neighborhood has been computed (or can be consistently computed by the simulated environment).
Link copied to clipboard
abstract fun nodeRemoved(node: Node<T>, oldNeighborhood: Neighborhood<T>)
This method must get called in case a node is removed from the environment during the simulation and after its neighborhood has been computed (or can be consistently computed by the simulated environment).
Link copied to clipboard
abstract fun pause(): CompletableFuture<Void>
Sends a pause command to the simulation.
Link copied to clipboard
abstract fun play(): CompletableFuture<Void>
Sends a play command to the simulation.
Link copied to clipboard
abstract fun reactionAdded(reactionToAdd: Actionable<T>)
Adds a reaction during the simulation to the scheduler and start to execute it.
Link copied to clipboard
abstract fun reactionRemoved(reactionToRemove: Actionable<T>)
Removes a reaction during the simulation from the scheduler and stop to execute it.
Link copied to clipboard
abstract fun removeOutputMonitor(op: OutputMonitor<T, P>)
Removes an OutputMonitor to this simulation.
Link copied to clipboard
abstract fun run()
Link copied to clipboard
abstract fun schedule(r: CheckedRunnable)
Schedules a runnable to be executed by the Simulation thread, useful for synchronization purposes (e.g.
Link copied to clipboard
Sends a terminate command to the simulation.
Link copied to clipboard
abstract fun waitFor(s: Status, timeout: Long, timeunit: TimeUnit): Status
Suspends the caller until the simulation reaches the selected Status or the timeout ends.