Class CodeDelegate

    • Constructor Detail

      • CodeDelegate

        public CodeDelegate()
    • Method Detail

      • log

        public final void log​(LogLevel level,
                              String msg)
        Send a log message.
        Parameters:
        level -
        msg -
      • log

        public final void log​(LogLevel level,
                              Exception ex)
        Send a log message with associated Exception type.
        Parameters:
        level -
        ex -
      • log

        public final void log​(LogLevel level,
                              Exception ex,
                              String msg)
        Send a log message with associated Exception.
        Parameters:
        level -
        ex -
        msg -
      • log

        public final void log​(LogLevel level,
                              Class<? extends Exception> type,
                              String msg)
        Send a log message with associated Exception type.
        Parameters:
        level -
        type -
        msg -
      • isLoggable

        public final boolean isLoggable​(LogLevel level)
        Check whether the messages at the given log level are being sent.
        Parameters:
        level -
        Returns:
      • transmit

        public final void transmit​(String componentID,
                                   String portID,
                                   String value)
        Send a value to a port on another component. The other component must have the same parent.
        Parameters:
        componentID - ID of the other component
        portID - ID of the port on the other component
        value -
      • transmit

        public final void transmit​(String componentID,
                                   String portID,
                                   Value value)
        Send a value to a port on another component. The other component must have the same parent.
        Parameters:
        componentID - ID of the other component
        portID - ID of the port on the other component
        value -
      • transmit

        public final void transmit​(String componentID,
                                   String portID,
                                   double value)
        Send a value to a port on another component. The other component must have the same parent.
        Parameters:
        componentID - ID of the other component
        portID - ID of the port on the other component
        value -
      • tell

        public final void tell​(ControlAddress destination,
                               String value)
        Send a message to a Control.
        Parameters:
        destination - address of control
        value - message value
      • tell

        public final void tell​(ControlAddress destination,
                               double value)
        Send a message to a Control.
        Parameters:
        destination - address of control
        value - message value
      • tell

        public final void tell​(ControlAddress destination,
                               Value value)
        Send a message to a Control.
        Parameters:
        destination - address of control
        value - message value
      • tellIn

        public final void tellIn​(double seconds,
                                 ControlAddress destination,
                                 String value)
        Send a message to a Control in the given number of seconds or fractions of second from now.
        Parameters:
        seconds - from now
        destination - address of control
        value - message value
      • tellIn

        public final void tellIn​(double seconds,
                                 ControlAddress destination,
                                 double value)
        Send a message to a Control in the given number of seconds or fractions of second from now.
        Parameters:
        seconds - from now
        destination - address of control
        value - message value
      • tellIn

        public final void tellIn​(double seconds,
                                 ControlAddress destination,
                                 Value value)
        Send a message to a Control in the given number of seconds or fractions of second from now.
        Parameters:
        seconds - from now
        destination - address of control
        value - message value
      • self

        public final ComponentAddress self()
        Get this component's address.
        Returns:
        address of self
      • self

        public final ControlAddress self​(String control)
        Get the address of a control on this component.
        Parameters:
        control - id of control
        Returns:
        address of control
      • getLookup

        public Lookup getLookup()
        Return a Lookup for finding instances of features.
        Returns:
        Lookup context
      • find

        public <T> Optional<T> find​(Class<T> type)
        Search for an instance of the given type.
        Type Parameters:
        T -
        Parameters:
        type - class to search for
        Returns:
        Optional wrapping the result if found, or empty if not
      • time

        public final long time()
        The current clocktime in nanoseconds. May only be used relatively to itself, and may be negative.
        Returns:
      • millis

        public final long millis()
        The current time in milliseconds since the root was started.
        Returns: