Package it.unibo.alchemist.core
Class Engine
-
-
Field Summary
Fields Modifier and Type Field Description public final Environment<T, P>
environment
public volatile Status
status
public Optional<Throwable>
error
-
Constructor Summary
Constructors Constructor Description Engine(Environment<T, P> environment)
Builds a simulation for a given environment. Engine(Environment<T, P> environment, Scheduler<T> scheduler)
Builds a simulation for a given environment.
-
Method Summary
-
-
Constructor Detail
-
Engine
Engine(Environment<T, P> environment)
Builds a simulation for a given environment.- Parameters:
environment
- the environment at the initial time
-
Engine
Engine(Environment<T, P> environment, Scheduler<T> scheduler)
Builds a simulation for a given environment.- Parameters:
environment
- maxTime he environment at the initial timescheduler
- the scheduler implementation to be used
-
-
Method Detail
-
getEnvironment
Environment<T, P> getEnvironment()
- Returns:
environment
-
addOutputMonitor
void addOutputMonitor(OutputMonitor<T, P> op)
- Parameters:
op
- the OutputMonitor to add
-
getStep
synchronized long getStep()
thread-safe.
- Returns:
step
-
goToStep
CompletableFuture<Void> goToStep(long step)
- Parameters:
step
- the number of steps to execute
-
goToTime
CompletableFuture<Void> goToTime(Time t)
- Parameters:
t
- the target time
-
neighborAdded
void neighborAdded(Node<T> node, Node<T> n)
- Parameters:
node
- the noden
- the second node
-
neighborRemoved
void neighborRemoved(Node<T> node, Node<T> n)
- Parameters:
node
- the noden
- the second node
-
nodeRemoved
void nodeRemoved(Node<T> node, Neighborhood<T> oldNeighborhood)
- Parameters:
node
- the freshly removed nodeoldNeighborhood
- the neighborhood of the node as it was before it was removed (used to calculate reverse dependencies)
-
pause
CompletableFuture<Void> pause()
pause.
-
play
CompletableFuture<Void> play()
play.
-
reactionAdded
void reactionAdded(Actionable<T> reactionToAdd)
- Parameters:
reactionToAdd
- the reaction to add
-
reactionRemoved
void reactionRemoved(Actionable<T> reactionToRemove)
- Parameters:
reactionToRemove
- the reaction to remove
-
removeOutputMonitor
void removeOutputMonitor(OutputMonitor<T, P> op)
- Parameters:
op
- the OutputMonitor to add
-
run
void run()
run simulation.
-
schedule
void schedule(CheckedRunnable runnable)
- Parameters:
runnable
- the runnable to execute
-
terminate
CompletableFuture<Void> terminate()
terminate.
-
getOutputMonitors
List<OutputMonitor<T, P>> getOutputMonitors()
Returns output monitors.
- Returns:
output monitors
-
-
-
-