Class ComponentAbstract

Base class for named objects embedded in a hierarchy of reactors. Each component can only be owned by a single reactor instance. All members of this class are prefixed with an underscore to avoid name collisions with ports, actions, timers, or reactor instances that may be part of the interface of a Reactor, which extends this class.

Marten Lohstroh (marten@berkeley.edu)

Hierarchy (view full)

Constructors

  • Create a new component and register it with the given container.

    Parameters

    • container: null | Reactor

      The reactor that will contain the new component, null if this is an instance of App, in which case the component will be designated as its own container.

      Note that each subclass implementation needs to call the method _linkToRuntimeObject immediately after calling this super constructor in order to establish a link with the runtime object.

    Returns Component

Properties

_key: symbol = ...

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

pathSeparator: string = "."

Methods

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

    Returns string

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

    Returns string

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

  • 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

  • Store a reference to the given runtime object as a private class member.

    Parameters

    Returns void

  • 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