Simulator class

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.
read-onlyinherited
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited

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.
read-only
logger Logger
A global logger object for the Simulator.
final
phase SimulatorPhase
Gets the current SimulatorPhase of the Simulator.
read-only
postTick Stream<void>
Emits an event after all events are completed.
read-only
preTick Stream<void>
Emits an event before any other actions take place on the tick.
read-only
simulationEnded Future<void>
Completes when the simulation has completed.
read-only
simulationHasEnded bool
Returns true iff the simulation has completed.
read-only
startTick Stream<void>
Emits an event at the start of actions within a tick.
read-only
time int
The current time in the Simulator.
read-only

Static Methods

endSimulation() → 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().