Create a new top-level reactor.
Optional parameter to let the execution of the app time out.
Optional parameter, if true allows execution to continue with an empty event queue.
Optional parameter, if true does not wait for physical time to catch up to logical time.
Optional callback to be used to indicate a successful execution.
Optional callback to be used to indicate a failed execution.
Readonly
__dummyThis reactor's dummy action.
Protected
_activeIndicates whether this reactor is active (meaning it has reacted to a startup action), or not (in which case it either never started up or has reacted to a shutdown action).
Readonly
_alarmProtected
_dependencyThis graph has in it all the dependencies implied by this container's ports, reactions, and connections.
Protected
_erroredProtected
Optional
_errorProtected
_immediateReference to "immediate" invocation of next.
Protected
_isStores whether the last received TAG (Tag Advance Grant) was provisional. Every federate starts out assuming that it has been granted a PTAG at the start time, or if it has no upstream federates, a TAG.
Protected
_keepIndicates whether the program should continue running once the event queue is empty.
Protected
_keyA symbol that identifies this component, and it also used to selectively grant access to its privileged functions.
Readonly
_nameProtected
Readonly
_reactionQPriority set that keeps track of reactions at the current Logical time.
Readonly
_uuidOptional callback to be used to indicate a failed execution.
Readonly
shutdownThis reactor's shutdown action.
Readonly
startupThis reactor's startup action.
Optional callback to be used to indicate a successful execution.
Protected
utilInner class that provides access to utilities that are safe to expose to reaction code.
Static
pathProtected
_addAdd a dummy event to the event queue. Currently, the sole usage of this is to ensure LET to be sent to the RTI when there is any physical action triggering output port(s) in federated execution.
The tag at which this dummy event occurs.
Protected
_advanceSet the current tag to be the next tag.
Protected
_analyzeAnalyze the dependencies between reactions in this app.
Assign priorities that encode the precedence relations between reactions. If there exist circular dependencies, throw an exception. This method should only be invoked prior to the start of execution, never during execution.
Protected
_cancelProtected
_canCheck whether the next event can be handled or not.
In a non-federated context this method always returns true.
The next event to be processed.
Protected
_connectConnect a source port to a downstream destination port. If a source is a regular port, then the type variable of the source has to be a subtype of the type variable of the destination. If the source is a caller port, then the destination has to be a callee port that is effectively a subtype of the caller port. Because functions have a contra-variant subtype relation, the arguments of the caller side must be a subtype of the callee's, and the return value of the callee's must be a subtype of the caller's.
Protected
_connectProtected
_connectRemove the given reactor and its connections from this container if the key matches.
Protected
_determineSet the logical start time of the execution according to the given time value. If an execution timeout is defined, also determine the end of execution is as the start time plus the execution timeout. This method also marks the app as "active" and initializes any timers that may have been created during the course of this app's instantiation.
The beginning of this app's execution. The end of execution is determined relative to this TimeValue is a timeout has been set.
Protected
_disconnectProtected
_finishProtected
_getReturn a dependency graph consisting of only this reactor's own ports and the dependencies between them.
Protected
_getProtected
_getProtected
_getIf the given component is owned by this reactor, look up its key and return it. Otherwise, if a key has been provided, and it matches the key of this reactor, also look up the component's key and return it. Otherwise, if the component is owned by a reactor that is owned by this reactor, request the component's key from that reactor and return it. If the component is an action, this request is not honored because actions are never supposed to be accessed across levels of hierarchy.
The component to look up the key for.
Optional
key: symbolThe key that verifies the containment relation between this reactor and the component, with at most one level of indirection.
Protected
_getProtected
_getProtected
_getProtected
_getRecursively collect the local dependency graph of each contained reactor and merge them all in one graph.
The recursion depth can be limited via the depth parameter. A depth of 0 will only return the local dependency graph of this reactor, a depth of 1 will merge the local graph only with this reactor's immediate children, etc. The default dept is -1, which will let this method recurse until it has reached a reactor with no children.
Some additional constraits are added to guarantee the following:
The depth of recursion.
Protected
_getProtected
_getProtected
_initializeProtected
_initializeConfirm whether or not this component is contained by the given reactor.
The presumptive container of this component.
Confirm whether or not this component is contained by the container of the given reactor.
The container presumptive container of the container of this component.
Report whether the given port is downstream of this reactor. If so, the given port can be connected to with an output port of this reactor.
Report whether this component has been registered with its container or not. In principle, all components should have a container, but at the time of their construction there is a brief period where they are not. This is the only moment that a component is allowed register with its container.
Report whether the given port is upstream of this reactor. If so, the given port can be connected to an input port of this reactor.
Protected
_iterationProtected
_linkProtected
_loadProtected
_reactReceive the runtime object from the container of this reactor. Invoking this method in any user-written code will result in a runtime error.
The runtime object handed down from the container.
Add a component to this container.
A component that is created as part of this reactor invokes this method upon creation.
The component to register.
The component's key.
Protected
_requestProtected
_setProtected
_setSetter for _endOfExecution to be used used by the subclass, FederatedApp.
Protected
_shutdownProtected
_startProtected
_startProtected
_unplugProtected
_unsetReport a timer to the app so that it gets unscheduled.
The timer to report to the app.
Protected
_unsetProtected
addRest
...args: ArgList<T>Optional
deadline: TimeValueRest
...args: ArgList<T>Protected
addAdd a reaction to this reactor. Each newly added reaction will acquire a dependency either on the previously added reaction, or on the last added mutation (in case no reactions had been added prior to this one). A reaction is specified by a list of triggers, a list of arguments, a react function, an optional deadline, and an optional late function (which represents the reaction body of the deadline). All triggers a reaction needs access must be included in the arguments.
Rest
...args: ArgList<T>Optional
deadline: TimeValueRest
...args: ArgList<T>Returns true if a given source port can be connected to the given destination port, false otherwise. Valid connections must: (1) adhere to the scoping rules and connectivity constraints of reactors; and (2) not introduce cycles.
The scoping rules of reactors can be summarized as follows:
Protected
nextProtected
prevProtected
schedulableProtected
sendRTIMessageSend an (untimed) message to the designated federate port through the RTI. This function throws an error if it isn't called on a FederatedApp.
The data that contain the body of the message.
The federate ID that is the destination of this message.
The port ID that is the destination of this message.
Protected
sendRTIPortSend a port absent message to the destination port. This function throws an error if it isn't called on a FederatedApp.
The ID of the receiving port.
Protected
sendRTITimedSend a (timed) message to the designated federate port through the RTI. This function throws an error if it isn't called on a FederatedApp.
Static
keyStatic
keyGiven a component and its container (the global object if the component
is an App
), return the key of the entry that matches the component.
a component of which the object is assumed to be its container
the assumed container of the component
the key of the entry that matches the component
Static
key
A reactor is a software component that reacts to input events, timer events, and action events. It has private state variables that are not visible to any other reactor. Its reactions can consist of altering its own state, sending messages to other reactors, or affecting the environment through some kind of actuation or side effect.