Object/Trait

io.reactors

Signal

Related Docs: trait Signal | package reactors

Permalink

object Signal

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Signal
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. class Const[T] extends Signal[T]

    Permalink

    Signal with a constant value.

  2. class Mutable[M >: Null <: AnyRef] extends Events.Mutable[M]

    Permalink

    Signal containing a mutable value.

    Signal containing a mutable value.

    Value can be accessed with the apply method. To modify the content, clients must use the mutate method on event streams.

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def aggregate[T](ss: Signal[T]*)(z: T)(op: (T, T) ⇒ T): Signal[T]

    Permalink

    A signal that is the aggregation of the values of other signals.

    A signal that is the aggregation of the values of other signals.

    At any point during execution this signal will contain an event obtained by applying op on the values of all the events in signals. This signal aggregate is called a static aggregate since the signals set is specified during aggregate creation and cannot be changed afterwards.

    The signal aggregate creates an aggregation tree data structure, so a value update in one of the signals requires only O(log n) steps to update the value of the aggregate signal.

    Example:

    val emitters = for (0 until 10) yield new Events.Emitter[Int]
    val ag = Signal.aggregate(emitters)(_ + _)

    The aggregation operator needs to be associative, but does not need to be commutative. For example, string concatenation for signals of strings or addition for integer signals are valid operators. Subtraction for integer signals, for example, is not associative and not allowed.

    The value z for the aggregation does not need to be a neutral element with respect to the aggregation operation.

    The resulting signal is hot, i.e. its value is updated even if there are no subscribers.

    T

    type of the aggregate signal

    ss

    signals for the aggregation

    z

    the zero value of the aggregation, used if the list is empty

    op

    the aggregation operator, must be associative

  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  9. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  11. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  12. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  13. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  14. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  15. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  16. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  17. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  18. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  20. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. def zip[T, S](ss: Signal[T]*)(f: (Seq[Signal[T]]) ⇒ () ⇒ S)(implicit s: Spec[T]): Signal[S]

    Permalink

    Zips the list of signals, and produces an output signal from their values.

    Zips the list of signals, and produces an output signal from their values.

    The output signal is updated whenever any of the input signals are updated. The value used for the output is given by the specified update function f. Assume that the update function returns the first uppercase character, or ? if there are no uppercase characters:

    Signal.zip(sig1, sig2, sig3) { ss => () =>
      ss.find(s => s().isUpper).map(_()).getOrElse('?'))
    }

    The values are produced as follows:

    time    ----------------------------->
    sig1    d------------g--B------h----->
    sig2    c----f----------------------->
    sig3    e---------A------------------>
    output  ?----?----A--A--B------A----->

    Above, the output returns ? each time any of the inputs is updated, until the signal-3 becomes A -- at this point, the output value changes to A. The output value is still A when signal-1 produces g, as the current values of the signals are (g, f, A) at this point. When signal-1 becomes B, the values of all the signals are (B, f, A), so the output becomes B, and so on.

    Note: traversing all of the signals in the specified function in order to update the value of the resulting signal takes O(n) time, where n is the number of signals specified, and can be potentially slow. If the update function is associative (e.g., adding integers of the input signals), then the output signal can be computed incrementally, and Signal.aggregate should be used instead.

    T

    type of the input signals

    S

    type of the output signal

    ss

    list of input signals

    f

    function used to produce the output from the input signals

    returns

    the output signal

Inherited from AnyRef

Inherited from Any

Ungrouped