Simulator class abstract

A functional event-based static simulator for logic behavior.

Each tick of the simulator steps through the following events and phases:

Functional behavior modelling subscribes to Simulator events and/or queries the SimulatorPhase.

Constructors

Simulator()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

clkStable Stream<void>
Emits an event when most events are complete, and clocks are stable.
no setter
logger Logger
A global logger object for the Simulator.
final
phase SimulatorPhase
Gets the current SimulatorPhase of the Simulator.
no setter
postTick Stream<void>
Emits an event after all events are completed.
no setter
preTick Stream<void>
Emits an event before any other actions take place on the tick.
no setter
resetRequested Future<void>
Completes when reset is called after the Simulator has completed any actions it needs to perform to prepare for the next simulation.
no setter
simulationEnded Future<void>
Completes when the simulation has completed.
no setter
simulationHasEnded bool
Returns true iff the simulation has completed.
no setter
startTick Stream<void>
Emits an event at the start of actions within a tick.
no setter
time int
The current time in the Simulator.
no setter

Static Methods

cancelAction(int timestamp, dynamic action()) bool
Cancels an action previously scheduled for timestamp.
endSimulation() Future<void>
Halts the simulation. Allows the current tick to finish, if there is one.
hasStepsRemaining() bool
Returns true iff there are more steps for the Simulator to tick through.
injectAction(dynamic action()) → void
Adds an arbitrary action to be executed as soon as possible, during the current simulation tick if possible.
registerAction(int timestamp, dynamic action()) → void
Registers an abritrary action to be executed at timestamp time.
registerEndOfSimulationAction(dynamic action()) → void
Registers an arbitrary action to be executed at the end of the simulation.
reset() Future<void>
Resets the entire Simulator back to its initial state.
run() Future<void>
Starts the simulation, executing all pending actions in time-order until it finishes or is stopped.
setMaxSimTime(int newMaxSimTime) → void
Sets a time, after which, the Simulator will halt processing of new actions.
throwException(Exception exception, StackTrace stackTrace) → void
Collects an exception and associated stackTrace triggered asynchronously during simulation to be thrown synchronously by run.
tick() Future<void>
A single simulation tick.
tickExecute(dynamic toExecute()) Future<void>
Performs the actual execution of a collection of actions for a tick().