reactive

MappedSignal

class MappedSignal[T, U] extends ChildSignal[T, U, Unit]

Attributes
protected
Source
Signal.scala
Linear Supertypes
ChildSignal[T, U, Unit], Signal[U], Forwardable[U, Signal[U]], AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. MappedSignal
  2. ChildSignal
  3. Signal
  4. Forwardable
  5. AnyRef
  6. Any
Visibility
  1. Public
  2. All

Instance Constructors

  1. new MappedSignal(parent: Signal[T], f: (T) ⇒ U)

Value Members

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

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. def +=(thunk: (U) ⇒ Unit)(implicit observing: Observing): Signal[U]

    Apply a function for every value.

    Apply a function for every value. Same as =>>.

    Definition Classes
    Forwardable
  5. def ->>(block: ⇒ Unit)(implicit observing: Observing): Signal[U]

    Run a block of code for every value

    Run a block of code for every value

    Definition Classes
    Forwardable
  6. def <<:[U >: U, S](target: ⇒ S)(implicit canForward: CanForward[S, U], observing: Observing): S

    Forwards values from this Forwardable to a target, for whose type a CanForward exists (in the implicit scope).

    Forwards values from this Forwardable to a target, for whose type a CanForward exists (in the implicit scope). This operator is available for right associativity. For example: val time = Var(0) <<: timerTicks // equivalent to: val time = Var(0); timerTicks >> time

    returns

    the target

    Definition Classes
    Forwardable
  7. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  8. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  9. def =>>(thunk: (U) ⇒ Unit)(implicit observing: Observing): Signal[U]

    Apply a function for every value

    Apply a function for every value

    Definition Classes
    Forwardable
  10. def >>[U >: U, S](target: ⇒ S)(implicit canForward: CanForward[S, U], observing: Observing): Signal[U]

    Forwards values from this Forwardable to a target, for whose type a CanForward exists (in the implicit scope).

    Forwards values from this Forwardable to a target, for whose type a CanForward exists (in the implicit scope).

    returns

    the forwarding instance

    Definition Classes
    Forwardable
  11. def ?>>(pf: PartialFunction[U, Unit])(implicit observing: Observing): Signal[U]

    Apply a PartialFunction for every applicable value

    Apply a PartialFunction for every applicable value

    Definition Classes
    Forwardable
  12. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  13. val change: EventSource[U] { val ref: (T, Unit) => Unit }

    Returns an EventStream that, every time this signal's value changes, fires an event consisting of the new value.

    Returns an EventStream that, every time this signal's value changes, fires an event consisting of the new value.

    Definition Classes
    ChildSignalSignal
  14. def clone(): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  15. var current: U

    Attributes
    protected
    Definition Classes
    ChildSignal
  16. def debugName: String

    Definition Classes
    MappedSignalSignal
  17. def distinct: Signal[U]

    Returns a derived Signal that only fires change events that are not equal to the previous value.

    Returns a derived Signal that only fires change events that are not equal to the previous value. This can be used to prevent infinite recursion between multiple signals that are mutually dependent in a consistent manner.

    Definition Classes
    Signal
  18. final def eq(arg0: AnyRef): Boolean

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

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

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  21. def flatMap[FunRet, Ret](f: (U) ⇒ FunRet)(implicit canFlatMapSignal: CanFlatMapSignal[Signal, FunRet, Ret]): Ret

    Returns a new Signal or EventStream, that for every value of this parent signal, will correspond to the Signal or EventStream resulting from applying f to the value of the parent signal.

    Returns a new Signal or EventStream, that for every value of this parent signal, will correspond to the Signal or EventStream resulting from applying f to the value of the parent signal.

    If the function returns a Signal, then whenever this Signal's change EventStream fires, the resulting Signal's change EventStream will fire the value of the new signal, and subsequently will fire all change events fired by that signal. This can be used to build a signal that switches among several other signals. For example: val sa: Signal[Int] = ... def sb(a: Int): Signal[Int] = a.map(_ + 1) val sc = sa.flatMap(a => sb(a))

    If the function is typed to return a SeqSignal, its deltas and changes correspond to those of the SeqSignals returned by f, after each invocation of f. In addition, every change to the parent results in a change event as well as deltas reflecting the transition from the SeqSignal previously returned by f and the on returned by it now.

    If the function returns an EventStream, then this function returns a new EventStream that corresponds fires the events of whichever EventStream is returns by f for the Signal's current value.

    Definition Classes
    Signal
  22. def foldLeft[U](initial: U)(f: (U, U) ⇒ U): Signal[U]

    Return a new Signal whose initial value is f(initial, parent.

    Return a new Signal whose initial value is f(initial, parent.now). Whenever the parent's value changes, the signal's value changes to f(previous, parent.now)

    Definition Classes
    Signal
  23. def foreach(f: (U) ⇒ Unit)(implicit observing: Observing): Unit

    Definition Classes
    SignalForwardable
  24. final def getClass(): java.lang.Class[_]

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

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

    Definition Classes
    Any
  27. def map[U, S](f: (U) ⇒ U)(implicit canMapSignal: CanMapSignal[U, S]): S

    Return a new Signal whose value is computed from the value of this Signal, transformed by f.

    Return a new Signal whose value is computed from the value of this Signal, transformed by f. It fires change events whenever (and only when) the original Signal does, but the event values are transformed by f.

    For example:

    val a: Signal[Int] = ...
    val b = a.map(_ + 1)
    
    b represents a Signal whose value is always 1 greater than a. Whenever a fires an event of x, b fires an event of x+1.

    Definition Classes
    Signal
  28. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  29. def nonblocking: Signal[U]

    Returns a derived signal in which value propagation does not happen on the thread triggering the change and block it.

    Returns a derived signal in which value propagation does not happen on the thread triggering the change and block it. This is helpful when handling values can be time consuming. The implementation delegates propagation to an actor (scala standard library), so values are handled sequentially.

    Definition Classes
    Signal
  30. def nonrecursive: Signal[U]

    Returns a derived Signal that does not fire change events during a prior call to fire on the same thread, thus preventing infinite recursion between multiple signals that are mutually dependent in an inconsistent manner.

    Returns a derived Signal that does not fire change events during a prior call to fire on the same thread, thus preventing infinite recursion between multiple signals that are mutually dependent in an inconsistent manner. For instance, if two Vars have a bidirectionally-enforced mathematical relationship that can produce rounding errors.

    Definition Classes
    Signal
  31. final def notify(): Unit

    Definition Classes
    AnyRef
  32. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  33. def now: U

    Represents the current value.

    Represents the current value. Often, this value does not need to be (or should not be) used explicitly from the outside; instead you can pass functions that operate on the value, to the Signal.

    Definition Classes
    ChildSignalSignal
  34. def parentHandler: (T, Unit) ⇒ Unit

    Definition Classes
    MappedSignalChildSignal
  35. def reduceLeft[U >: U](f: (U, U) ⇒ U): Signal[U]

    Return a new Signal whose initial value is parent.

    Return a new Signal whose initial value is parent.now. Whenever the parent's value changes, the signal's value changes to f(previous, parent.now)

    Definition Classes
    Signal
  36. def self: Signal[U]

    Definition Classes
    SignalForwardable
  37. abstract def sequence[B]: Signal[List[B]]

    [use case] Only available if this is a Signal[Seq[Signal[B]]] for some B, or a subtype thereof.

    [use case]

    Only available if this is a Signal[Seq[Signal[B]]] for some B, or a subtype thereof. Merges all the signals (including this one) into a single Signal[List[B]].

    returns

    a signal whose value is a List of all the values of the signals contained in this signal, updated whenever either this signal changes or any of the contained signals change.

    Definition Classes
    Signal
  38. def sequence[B](implicit ev: <:<[U, Seq[Signal[B]]]): Signal[List[B]]

    Only available if this is a Signal[Seq[Signal[B]]] for some B, or a subtype thereof.

    Only available if this is a Signal[Seq[Signal[B]]] for some B, or a subtype thereof. Merges all the signals (including this one) into a single Signal[List[B]].

    returns

    a signal whose value is a List of all the values of the signals contained in this signal, updated whenever either this signal changes or any of the contained signals change.

    Definition Classes
    Signal
    Example:
    1. val prices = BufferSignal(Var(2.50), Var(3.75), Var(99.99))
      val totalCost = prices.sequence map (_.sum)
      
  39. var state: Unit

    Attributes
    protected
    Definition Classes
    ChildSignal
  40. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  41. def toString(): String

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

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws()
  45. def zip[U](that: Signal[U]): Signal[(U, U)]

    Returns a Tuple2-valued Signal that contains the values of this Signal and another Signal

    Returns a Tuple2-valued Signal that contains the values of this Signal and another Signal

    that

    the other Signal

    returns

    the Tuple2-valued Signal

    Definition Classes
    Signal
  46. def zipWithStaleness: Signal[(U, () ⇒ Boolean)]

    Returns a tuple-valued Signal whose value includes a function for testing staleness.

    Returns a tuple-valued Signal whose value includes a function for testing staleness. The signal will hold values of type (T, ()=>Boolean), where T is the type of the parent signal, and the value tuple will contain the parent's value at the last time it was received, as well as a function that can be used to test whether that value is outdated because the parent has received a new value. This is especially useful in conjunction with 'nonblocking', because its actor implementation means that a new value cannot be received until the previous value is finished being handled. The test function is useful because it may be desirable to abort time-consuming work if the value has been superseded Example usage: for((v, isSuperseded) <- signal.zipWithStaleness) { doSomework(); if(!isSuperseded()) doSomeMoreWork() }

    Definition Classes
    Signal

Inherited from ChildSignal[T, U, Unit]

Inherited from Signal[U]

Inherited from Forwardable[U, Signal[U]]

Inherited from AnyRef

Inherited from Any