Class NetworkReceiver<T>

A network receiver is a reactor handling a network input.

Type Parameters

  • T

Hierarchy

  • NetworkReactor
    • NetworkReceiver

Constructors

Properties

__dummy: Dummy

This reactor's dummy action.

_active: boolean = false

Indicates 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).

_dependencyGraph: PrecedenceGraph<Reaction<Variable[]> | Port<unknown>> = ...

This graph has in it all the dependencies implied by this container's ports, reactions, and connections.

_key: symbol = ...

A symbol that identifies this component, and it also used to selectively grant access to its privileged functions.

lastKnownStatusTag: Tag

Last known status of the port, either via a timed message, a port absent, or a TAG from the RTI.

shutdown: Shutdown

This reactor's shutdown action.

startup: Startup

This reactor's startup action.

tpoLevel?: number
util: UtilityFunctions

Collection of utility functions for this reactor and its subclasses.

pathSeparator: string = "."

Methods

  • Connect 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.

    Type Parameters

    • R
    • S

    Parameters

    • src: IOPort<S>

      The source port to connect.

    • dst: IOPort<R>

      The destination port to connect.

    Returns void

  • Remove the given reactor and its connections from this container if the key matches.

    Parameters

    Returns void

  • Delete the connection between the source and destination nodes. If the destination node is not specified, all connections from the source node to any other node are deleted.

    Type Parameters

    • R
    • S

    Parameters

    • src: IOPort<S>

      Source port of connection to be disconnected.

    • Optionaldst: IOPort<R>

      Destination port of connection to be disconnected. If undefined, disconnect all connections from the source port.

    Returns void

  • Return a dependency graph consisting of only this reactor's own ports and the dependencies between them.

    Returns PrecedenceGraph<Port<unknown>>

  • Return a string that identifies this component. The name is a path constructed as [App]/[..]/[Container]/[This].

    Returns string

  • If 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.

    Parameters

    • component: Trigger

      The component to look up the key for.

    • Optionalkey: symbol

      The key that verifies the containment relation between this reactor and the component, with at most one level of indirection.

    Returns undefined | symbol

  • Return the last mutation of this reactor. All contained reactors must have their reactions depend on this.

    Returns undefined | Mutation<Variable[]>

  • Return the last reaction or mutation of this reactor.

    Returns undefined | Reaction<Variable[]>

  • Return a list of reactions owned by this reactor.

    The returned list is a copy of the list kept inside of the reactor, so changing it will not affect this reactor.

    Returns Reaction<Variable[]>[]

  • Return a string that identifies this component within its container. If no such string was found, return the name of the constructor.

    Returns string

  • Recursively 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 first reaction or mutation has a dependency on the last mutation of this reactor's container; and
    • RPCs occur in a deterministic order.

    Parameters

    • depth: number = -1

      The depth of recursion.

    Returns PrecedenceGraph<Reaction<Variable[]> | Port<unknown>>

  • Return the index of the reaction given as an argument.

    Parameters

    Returns number

  • Returns void

  • Returns void

  • Confirm whether or not this component is contained by the given reactor.

    Parameters

    • reactor: Reactor

      The presumptive container of this component.

    Returns boolean

  • Confirm whether or not this component is contained by the container of the given reactor.

    Parameters

    • reactor: Reactor

      The container presumptive container of the container of this component.

    Returns boolean

  • 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.

    Parameters

    Returns boolean

  • 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.

    Returns boolean

  • 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.

    Parameters

    Returns boolean

  • Request the container to pass down its runtime object to this component. This function is to be called once and only once upon the construction of an object that subclasses Component. If it is called more than once a runtime error results.

    Returns void

  • Receive the runtime object from the container of this reactor. Invoking this method in any user-written code will result in a runtime error.

    Parameters

    • runtime: Runtime

      The runtime object handed down from the container.

    Returns void

  • Add a component to this container.

    A component that is created as part of this reactor invokes this method upon creation.

    Parameters

    • component: Component

      The component to register.

    • key: symbol

      The component's key.

    Returns void

  • Parameters

    Returns void

  • Remove this reactor from its container and sever any connections it may still have. This reactor will become defunct and is ready for garbage collection.

    Returns void

  • Report a timer to the app so that it gets unscheduled.

    Parameters

    • timer: Timer

      The timer to report to the app.

    Returns void

  • Unset all the timers of this reactor.

    Returns void

  • Add 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.

    Type Parameters

    Parameters

    Returns void

  • 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:

    • A port cannot connect to itself;
    • Unless the connection is between a caller and callee, the destination can only be connected to one source;
    • ...

    Type Parameters

    • R
    • S

    Parameters

    • src: IOPort<S>

      The start point of a new connection.

    • dst: IOPort<R>

      The end point of a new connection.

    Returns boolean

  • Return the location of the reactor instance in a bank, if it is a member of one; return -1 otherwise.

    Returns number

  • This function returns this network reactor's own reactions. The edges of those reactions (e.g. port absent reactions, port present reactions, ...) should be added to the dependency graph according to TPO levels.

    Returns Reaction<Variable[]>[]

  • Getter for the TPO level of this NetworkReactor.

    Returns undefined | number

  • Handle a timed message being received from the RTI. This function is for NetworkReceiver reactors.

    Parameters

    • value: T

      The payload of the message.

    Returns void

  • Handle a timed message being received from the RTI.

    Parameters

    • value: T

      The payload of the message.

    • intendedTag: Tag

    Returns void

  • Given a reaction, return the reaction within this reactior that directly succeeds it, or undefined if there is none.

    Parameters

    Returns undefined | Reaction<Variable[]>

  • Given a reaction, return the reaction within this reactor that directly precedes it, or undefined if there is none.

    Parameters

    Returns undefined | Reaction<Variable[]>

  • Register a federate port's action with the network receiver.

    Parameters

    Returns void

  • Return the fully qualified name of this reactor.

    Returns string

  • Parameters

    Returns string

  • Given a component and its container (the global object if the component is an App), return the key of the entry that matches the component.

    Parameters

    • component: Component

      a component of which the object is assumed to be its container

    • object: object

      the assumed container of the component

    Returns string

    the key of the entry that matches the component

  • Given a port and its containing reactor, return the key of the entry that matches a multiport found in the reactor that matches the port.

    Parameters

    • port: Component

      a port that is assumed to be a constituent of a multiport declared on the given reactor

    • reactor: Reactor

      a reactor that is assumed to have a multiport of which one of the constituents is the given port

    Returns string

    an identifier for the port based on its location in a matching multiport