new module:Simulation(appInstance)
Parameters:
Name | Type | Description |
---|---|---|
appInstance |
App | instance of App |
Classes
Members
-
appInstance :App
-
instance of App this Simulation belongs to
-
cycledConnectors :Map
-
maps cycled connector id to set of states this connector was in
-
predecessors :Map
-
maps each affected output connector to it's directly preceeding output connectors
-
resolvedCycledConnectors :Set
-
set of cycled connectors that have been already resolved
-
waves :Map
-
maps waveId to an array of affected outputConnectors
Methods
-
addPredecessor(connectorId, predecessorConnectorId)
-
mark a predecessorConnectorId as a predecessor of connectorId
Parameters:
Name Type Description connectorId
string ID of a connector
predecessorConnectorId
string predecessor of
connectorId
-
getAllPredecessors(connectorId) → {Set}
-
get set of all output connectors that are before this output connector
Parameters:
Name Type Description connectorId
string ID of a connector
Returns:
Set -set of connector ids that are before this output connector
-
notifyChange(connectorId, state)
-
Notify a change in the network. This function adds the changed connector to the next wave
Parameters:
Name Type Description connectorId
string ID of the changed connector
state
Logic.state new Logic.state of the connector
-
run()
-
run the simulation
-
step()
-
one step/wave of the simulation
determines states of the connectors in the current wave, detects cycles