io.reactors

IVar

class IVar[T] extends Signal[T]

An event stream that can be either completed, or unreacted at most once.

Assigning a value propagates an event to all the subscribers, and then propagates an unreaction. To assign a value:

val iv = new Events.IVar[Int]
iv := 5
assert(iv() == 5)

To unreact (i.e. seal, or close) an ivar without assigning a value:

val iv = new Events.IVar[Int]
iv.unreact()
assert(iv.isUnreacted)
T

type of the value in the IVar

Linear Supertypes
Signal[T], Subscription, Events[T], AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. IVar
  2. Signal
  3. Subscription
  4. Events
  5. AnyRef
  6. Any
Implicitly
  1. by any2stringadd
  2. by any2stringfmt
  3. by any2ArrowAssoc
  4. by any2Ensuring
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new IVar()

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 +(other: String): String

    Implicit information
    This member is added by an implicit conversion from IVar[T] to StringAdd performed by method any2stringadd in scala.Predef.
    Definition Classes
    StringAdd
  5. def ->[B](y: B): (IVar[T], B)

    Implicit information
    This member is added by an implicit conversion from IVar[T] to ArrowAssoc[IVar[T]] performed by method any2ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  6. def :=(x: T): Unit

    Assigns a value to the ivar if it is unassigned,

    Assigns a value to the ivar if it is unassigned,

    Throws an exception otherwise.

  7. final def ==(arg0: AnyRef): Boolean

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

    Definition Classes
    Any
  9. def after[S](that: Events[S]): Events[T]

    Creates a new event stream that produces events from this event stream only after that produces an event.

    Creates a new event stream that produces events from this event stream only after that produces an event.

    After that emits some event, all events from this are produced on the resulting event stream. If that unreacts before an event is produced on this, the resulting event\ stream unreacts. If this unreacts, the resulting event stream unreacts.

    S

    the type of that event stream

    that

    the event stream after whose first event the result can start propagating events

    returns

    the resulting event stream that emits only after that emits at least once

    Definition Classes
    Events
  10. def and(action: ⇒ Unit): Subscription

    Returns a new subscription that unsubscribes using this, and executes an action.

    Returns a new subscription that unsubscribes using this, and executes an action.

    Definition Classes
    Subscription
  11. def apply(): T

    Returns the value of the ivar if it was failed already assigned, and throws an exception otherwise.

    Returns the value of the ivar if it was failed already assigned, and throws an exception otherwise.

    returns

    the signal's value

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

    Definition Classes
    Any
  13. def changes: Events[T]

    An event stream that only emits events when the value of this signal changes.

    An event stream that only emits events when the value of this signal changes.

    time    --------------->
    this    --1---2--2--3-->
    changes --1---2-----3-->
    returns

    a subscription and the signal with changes of this

    Definition Classes
    Signal
  14. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  15. def collect[S <: AnyRef](pf: PartialFunction[T, S])(implicit evidence: <:<[T, AnyRef]): Events[S]

    Filters events from this event stream and maps them in the same time.

    Filters events from this event stream and maps them in the same time.

    The collect combinator uses a partial function pf to filter events from this event stream. Events for which the partial function is defined are mapped using the partial function, others are discarded.

    Note: This combinator is defined only for event streams that contain reference events. You cannot call it for event streams whose events are primitive values, such as Int. This is because the PartialFunction class is not itself specialized.

    S

    the type of the mapped event stream

    pf

    partial function used to filter and map events

    evidence

    evidence that T is a reference type

    returns

    an event stream with the partially mapped events

    Definition Classes
    Events
  16. def collectHint[W](pf: PartialFunction[Any, W]): Events[T]

    Collects values from the event stream by applying a partial function, if possible.

    Collects values from the event stream by applying a partial function, if possible.

    Definition Classes
    Events
  17. def concat[S](implicit evidence: <:<[T, Events[S]], a: Arrayable[S]): Events[S]

    Concatenates the events produced by all the event streams emitted by this.

    Concatenates the events produced by all the event streams emitted by this.

    This operation is only available for event stream values that emit other event streams as events. Once this and all the event streams unreact, this event stream unreacts.

    Use case:

    def concat[S](): Events[S]

    Note: This operation potentially buffers events from the nested event streams. Unless each event stream emitted by this is known to unreact eventually, this operation should not be called.

    S

    the type of the events in event streams emitted by this

    evidence

    evidence that events of type T produced by this are actually event stream values of type S

    a

    evidence that arrays can be created for type S

    returns

    the event stream that concatenates all the events from nested event streams

    Definition Classes
    Events
  18. def concat(that: Events[T])(implicit a: Arrayable[T]): Events[T]

    Creates a concatenation of this and that event stream.

    Creates a concatenation of this and that event stream.

    The resulting event stream produces all the events from this event stream until this unreacts, and then outputs all the events from that that happened before and after this unreacted. To do this, this operation potentially caches all the events from that. When that unreacts, the resulting event stream unreacts.

    Use case:

    def concat(that: Events[T]): Events[T]

    Note: This operation potentially caches events from that. Unless certain that this eventually unreacts, concat should not be used.

    that

    another event stream for the concatenation

    a

    evidence that arrays can be created for the type T

    returns

    event stream that concatenates events from this and that

    Definition Classes
    Events
  19. def count(implicit dummy: Spec[T]): Events[Int]

    Emits the total number of events produced by this event stream.

    Emits the total number of events produced by this event stream.

    The returned value is a scala.reactive.Signal that holds the total number of emitted events.

    time  ---------------->
    this  ---x---y--z--|
    count ---1---2--3--|
    returns

    an event stream that emits the total number of events emitted since card was called

    Definition Classes
    Events
  20. def diffPast[S](op: (T, T) ⇒ S): Events[S]

    A signal that produces difference events between the current and previous value of this signal.

    A signal that produces difference events between the current and previous value of this signal.

    time ---------------->
    this --1--3---6---7-->
    diff --z--2---3---1-->
    S

    the type of the difference event

    op

    the operator that computes the difference between consecutive events

    returns

    a subscription and a signal with the difference value

    Definition Classes
    Signal
  21. def drop(n: Int): Events[T]

    Drops n events from this event stream, and emits the rest.

    Drops n events from this event stream, and emits the rest.

    n

    number of events to drop

    returns

    event stream with the forwarded events

    Definition Classes
    Events
  22. def dropAfter(p: (T) ⇒ Boolean): Events[T]

    Drop all events after an event that satisfies a predicate.

    Drop all events after an event that satisfies a predicate.

    This is similar to takeWhile, but includes the event that satisfies the predicate.

    time                ------------------------>
    this                -0---1--2--3-4--1-5--2-->
    dropAfter(_ == 4)       -1--2--3-4|
    p

    the predicate that specifies whether to drop subsequent events

    returns

    event stream with the forwarded events

    Definition Classes
    Events
  23. def dropWhile(p: (T) ⇒ Boolean): Events[T]

    Returns a new event stream that forwards the events from this event stream as long as they satisfy the predicate p.

    Returns a new event stream that forwards the events from this event stream as long as they satisfy the predicate p.

    After an event that does not specify the predicate occurs, the resulting event stream unreacts.

    If the predicate throws an exception, the exceptions is propagated, and the resulting event stream unreacts.

    time             ------------------------>
    this             -0---1--2--3-4--1-5--2-->
    dropWhile(_ < 4)     ---------4--1-5--2-->
    p

    the predicate that specifies whether to take the element

    returns

    event stream with the forwarded events

    Definition Classes
    Events
  24. def ensuring(cond: (IVar[T]) ⇒ Boolean, msg: ⇒ Any): IVar[T]

    Implicit information
    This member is added by an implicit conversion from IVar[T] to Ensuring[IVar[T]] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  25. def ensuring(cond: (IVar[T]) ⇒ Boolean): IVar[T]

    Implicit information
    This member is added by an implicit conversion from IVar[T] to Ensuring[IVar[T]] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  26. def ensuring(cond: Boolean, msg: ⇒ Any): IVar[T]

    Implicit information
    This member is added by an implicit conversion from IVar[T] to Ensuring[IVar[T]] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  27. def ensuring(cond: Boolean): IVar[T]

    Implicit information
    This member is added by an implicit conversion from IVar[T] to Ensuring[IVar[T]] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  28. final def eq(arg0: AnyRef): Boolean

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

    Definition Classes
    AnyRef → Any
  30. def except(t: Throwable): Unit

  31. def failure: Throwable

    Returns the exception in the ivar if it was failed.

    Returns the exception in the ivar if it was failed.

    Throws an exception otherwise.

  32. def filter(p: (T) ⇒ Boolean): Events[T]

    Filters events from this event stream value using a specified predicate p.

    Filters events from this event stream value using a specified predicate p.

    Only events from this for which p returns true are emitted on the resulting event stream.

    p

    the predicate used to filter events

    returns

    an event streams with the filtered events

    Definition Classes
    Events
  33. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  34. def first[S](implicit evidence: <:<[T, Events[S]]): Events[S]

    Returns an event stream that forwards from the first active nested event stream.

    Returns an event stream that forwards from the first active nested event stream.

    Regardless of the order in which the nested event streams were emitted, only the nested event stream that is the first to emit an event gets chosen.

    This is illustrated in the following, where the second event stream in this is the first to emit an event.

    time   --------------------------->
    this       ------4--7---11-------->
                 --1------2-----3----->
                     --------0---5---->
    first  --------1------1-----3----->
    S

    the type of the events in event stream emitted by this

    evidence

    evidence that events of type T produced by this are actually event streams of type S

    returns

    event stream that concatenates all the events from nested event streams

    Definition Classes
    Events
  35. def formatted(fmtstr: String): String

    Implicit information
    This member is added by an implicit conversion from IVar[T] to StringFormat performed by method any2stringfmt in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  36. def get: T

    Returns the first event emitted by this event stream.

    Returns the first event emitted by this event stream.

    This method will return immediately and will not block.

    This method will return a value only if this event stream emits one or more values on subscription. Otherwise, this method throws a NoSuchElementException.

    Definition Classes
    Events
  37. final def getClass(): Class[_]

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

    Definition Classes
    AnyRef → Any
  39. def ignoreExceptions: Events[T]

    Returns an event stream that ignores all exceptions in this event stream.

    Returns an event stream that ignores all exceptions in this event stream.

    returns

    an event stream that forwards all events, and ignores all exceptions

    Definition Classes
    Events
  40. def isAssigned: Boolean

    Returns true iff the ivar has been assigned.

  41. def isCompleted: Boolean

    Returns true iff the ivar has been completed, i.

    Returns true iff the ivar has been completed, i.e. assigned or failed.

  42. def isEmpty: Boolean

    Returns true if this ivar is unassigned or failed.

    Returns true if this ivar is unassigned or failed.

    Definition Classes
    IVarSignal
  43. def isFailed: Boolean

    Returns true iff the ivar has been failed with an exception.

  44. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  45. def isUnassigned: Boolean

    Returns true iff the ivar is unassigned.

  46. def map[S](f: (T) ⇒ S): Events[S]

    Returns a new event stream that maps events from this event stream using the mapping function f.

    Returns a new event stream that maps events from this event stream using the mapping function f.

    time    --------------------->
    this    --e1------e2------|
    mapped  --f(e1)---f(e2)---|
    S

    the type of the mapped events

    f

    the mapping function

    returns

    event stream value with the mapped events

    Definition Classes
    Events
  47. def mutate[M1 >: Null <: AnyRef, M2 >: Null <: AnyRef, M3 >: Null <: AnyRef](m1: Mutable[M1], m2: Mutable[M2], m3: Mutable[M3])(f: (M1, M2, M3) ⇒ (T) ⇒ Unit)(implicit dummy: Spec[T]): Subscription

    Mutates multiple mutable event stream values m1, m2 and m3 each time that this event stream produces an event.

    Mutates multiple mutable event stream values m1, m2 and m3 each time that this event stream produces an event.

    Note that the objects m1, m2 and m3 are mutated simultaneously, and events are propagated after the mutation ends. This version of the mutate works on multiple event streams.

    M1

    the type of the first mutable event stream

    M2

    the type of the second mutable event stream

    M3

    the type of the third mutable event stream

    m1

    the first mutable stream

    m2

    the second mutable stream

    m3

    the second mutable stream

    f

    the function that modifies the mutables

    returns

    a subscription used to cancel this mutation

    Definition Classes
    Events
  48. def mutate[M1 >: Null <: AnyRef, M2 >: Null <: AnyRef](m1: Mutable[M1], m2: Mutable[M2])(f: (M1, M2) ⇒ (T) ⇒ Unit): Subscription

    Mutates multiple mutable event stream values m1 and m2 each time that this event stream produces an event.

    Mutates multiple mutable event stream values m1 and m2 each time that this event stream produces an event.

    Note that the objects m1 and m2 are mutated simultaneously, and events are propagated after the mutation ends. This version of the mutate works on multiple event streams.

    M1

    the type of the first mutable event stream

    M2

    the type of the second mutable event stream

    m1

    the first mutable stream

    m2

    the second mutable stream

    f

    the function that modifies the mutables

    returns

    a subscription used to cancel this mutation

    Definition Classes
    Events
  49. def mutate[M >: Null <: AnyRef](m: Mutable[M])(f: (M) ⇒ (T) ⇒ Unit): Subscription

    Mutates the target mutable event stream called mutable each time this event stream produces an event.

    Mutates the target mutable event stream called mutable each time this event stream produces an event.

    Here is an example, given an event stream of type r:

    val eventLog = new Events.Mutable(mutable.Buffer[String]())
    val eventLogMutations = r.mutate(eventLog) { buffer => event =>
      buffer += "at " + System.nanoTime + ": " + event
    } // <-- eventLog event propagated

    Whenever an event arrives on r, an entry is added to the buffer underlying eventLog. After the mutation completes, a modification event is produced by the eventLog and can be used subsequently:

    val uiUpdates = eventLog onEvent { b =>
    eventListWidget.add(b.last)
    }

    Note: No two events will ever be concurrently processed by different threads on the same event stream mutable, but an event that is propagated from within the mutation can trigger an event on this. The result is that mutation is invoked concurrently on the same thread. The following code is problematic has a feedback loop in the dataflow graph:

    val emitter = new Events.Emitter[Int]
    val mutable = new Events.Mutable[mutable.Buffer[Int]()]
    emitter.mutate(mutable) { buffer => n =>
      buffer += n
      if (n == 0)
        emitter.react(n + 1) // <-- event propagated
      assert(buffer.last == n)
    }
    emitter.react(0)

    The statement emitter.react(n + 1) in the mutate block suspends the current mutation, calls the mutation recursively and changes the value of cell, and the assertion fails when the first mutation resumes.

    Care must be taken to avoid f from emitting events in feedback loops.

    M

    the type of the event stream mutable value

    m

    the target mutable stream to be mutated with events from this stream

    f

    the function that modifies mutable given an event of type T

    returns

    a subscription used to cancel this mutation

    Definition Classes
    Events
  50. def mux[S](implicit evidence: <:<[T, Events[S]], ds: Spec[S]): Events[S]

    Returns events from the last event stream that this emitted as an event of its own, in effect multiplexing the nested reactives.

    Returns events from the last event stream that this emitted as an event of its own, in effect multiplexing the nested reactives.

    The resulting event stream only emits events from the event stream last emitted by this, the preceding event streams are ignored.

    This combinator is only available if this event stream emits events that are themselves event streams.

    Example:

    val currentEvents = new Events.Emitter[Events[Int]]
    val e1 = new Events.Emitter[Int]
    val e2 = new Events.Emitter[Int]
    val currentEvent = currentEvents.mux()
    val prints = currentEvent.onEvent(println)
    
    currentEvents.react(e1)
    e2.react(1) // nothing is printed
    e1.react(2) // 2 is printed
    currentEvents.react(e2)
    e2.react(6) // 6 is printed
    e1.react(7) // nothing is printed

    Shown on the diagram:

    time            ------------------->
    currentEvents   --e1------e2------->
    e1              --------2----6----->
    e2              -----1----------7-->
    currentEvent    --------2----6----->

    Use case:

    def mux[S](): Events[S]
    S

    the type of the events in the nested event stream

    evidence

    an implicit evidence that this event stream is nested -- it emits events of type T that is actually an Events[S]

    returns

    event stream of events from the event stream last emitted by this

    Definition Classes
    Events
  51. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  52. final def nonEmpty: Boolean

    Returns true iff this signal has a value.

    Returns true iff this signal has a value.

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

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

    Definition Classes
    AnyRef
  55. def on(observer: ⇒ Unit)(implicit dummy: Spec[T]): Subscription

    Registers a callback for react events, disregarding their values

    Registers a callback for react events, disregarding their values

    A shorthand for onReaction -- called whenever an event occurs.

    This method is handy when the precise event value is not important, or the type of the event is Unit.

    observer

    the callback invoked when an event arrives

    returns

    a subscription for unsubscribing from reactions

    Definition Classes
    Events
  56. def onDone(observer: ⇒ Unit)(implicit dummy: Spec[T]): Subscription

    Executes the specified block when this event stream unreacts.

    Executes the specified block when this event stream unreacts.

    observer

    the callback invoked when this unreacts

    returns

    a subscription for the unreaction notification

    Definition Classes
    Events
  57. def onEvent(observer: (T) ⇒ Unit): Subscription

    Registers callback for react events.

    Registers callback for react events.

    A shorthand for onReaction -- the specified function is invoked whenever there is an event.

    observer

    the callback for events

    returns

    a subcriptions for unsubscribing from reactions

    Definition Classes
    Events
  58. def onEventOrDone(reactFunc: (T) ⇒ Unit)(unreactFunc: ⇒ Unit): Subscription

    Registers callbacks for react and unreact events.

    Registers callbacks for react and unreact events.

    A shorthand for onReaction -- the specified functions are invoked whenever there is an event or an unreaction.

    reactFunc

    called when this event stream produces an event

    unreactFunc

    called when this event stream unreacts

    returns

    a subscription for unsubscribing from reactions

    Definition Classes
    Events
  59. def onExcept(pf: PartialFunction[Throwable, Unit]): Subscription

    Executes the specified block when this event stream forwards an exception.

    Executes the specified block when this event stream forwards an exception.

    pf

    the partial function used to handle the exception

    returns

    a subscription for the exception notifications

    Definition Classes
    Events
  60. def onMatch(observer: PartialFunction[T, Unit])(implicit sub: <:<[T, AnyRef]): Subscription

    Registers callback for events that match the specified patterns.

    Registers callback for events that match the specified patterns.

    A shorthand for onReaction -- the specified partial function is applied to only those events for which it is defined.

    This method only works for AnyRef values.

    Example:

    r onMatch {
    case s: String => println(s)
    case n: Int    => println("number " + s)
    }

    Use case:

    def onMatch(reactor: PartialFunction[T, Unit]): Subscription
    observer

    the callback for those events for which it is defined

    returns

    a subscription for unsubscribing from reactions

    Definition Classes
    Events
  61. def onReaction(obs: Observer[T]): Subscription

    Registers a new observer to this event stream.

    Registers a new observer to this event stream.

    The observer argument may be invoked multiple times -- whenever an event is produced, or an exception occurs, and at most once when the event stream is terminated. After the event stream terminates, no events or exceptions are propagated on this event stream any more.

    returns

    a subscription for unsubscribing from reactions

    Definition Classes
    IVarEvents
  62. def once: Events[T]

    Creates an event stream that forwards an event from this event stream only once.

    Creates an event stream that forwards an event from this event stream only once.

    The resulting event stream emits only a single event produced by this event stream after once is called, and then unreacts.

    time ----------------->
    this --1-----2----3--->
    once      ---2|
    returns

    an event stream with the first event from this

    Definition Classes
    Events
  63. def past2(init: T): Events[(T, T)]

    Creates a new signal that emits tuples of the current and the last event emitted by this signal.

    Creates a new signal that emits tuples of the current and the last event emitted by this signal.

    time  ---------------------->
    this  1----2------3----4---->
    past2 i,1--1,2----2,3--3,4-->
    init

    the initial previous value, i in the diagram above

    returns

    a subscription and a signal of tuples of the current and last event

    Definition Classes
    Signal
  64. def possibly(probability: Double): Events[T]

    Forwards an event from this event stream with some probability.

    Forwards an event from this event stream with some probability.

    The probability is specified as a real value from 0.0 to 1.0.

    probability

    the probability to forward an event

    returns

    the event stream that forwards events with some probability

    Definition Classes
    Events
  65. def react(x: T): Unit

  66. def recover[U >: T](pf: PartialFunction[Throwable, U])(implicit evid: <:<[U, AnyRef]): Events[U]

    Transforms emitted exceptions into an event stream.

    Transforms emitted exceptions into an event stream.

    If the specified partial function is defined for the exception, an event is emitted. Otherwise, the same exception is forwarded.

    U

    type of events exceptions are mapped to

    pf

    partial mapping from functions to events

    returns

    an event stream that emits events when an exception arrives

    Definition Classes
    Events
  67. def reducePast[S](z: S)(op: (S, T) ⇒ S): Events[S]

    Reduces all the events in this event stream.

    Reduces all the events in this event stream.

    Emits a single event *after* the event stream unreacts, and then it unreacts itself. For example, the event stream this.reducePast(0)(_ + _) graphically:

    time       ----------------->
    this       --1-----2----3-|
    reducePast ---------------6|
    S

    the type of the events in the resulting event stream

    z

    the initial value of the reduce past

    op

    the operator that combines the last event and the current one

    returns

    an event stream that emits the reduction of all events once

    Definition Classes
    Events
  68. def scanPast[S](z: S)(op: (S, T) ⇒ S): Events[S]

    Creates a new event stream s that produces events by consecutively applying the specified operator op to the previous event that s produced and the current event that this event stream value produced.

    Creates a new event stream s that produces events by consecutively applying the specified operator op to the previous event that s produced and the current event that this event stream value produced.

    The scanPast operation allows the current event from this event stream to be mapped into a different event by looking "into the past", i.e. at the event previously emitted by the resulting event stream.

    Example -- assume that an event stream r produces events 1, 2 and 3. The following s:

    val s = r.scanPast(0)((sum, n) => sum + n)

    will produce events 1, 3 (1 + 2) and 6 (3 + 3). Note: the initial value 0 is not emitted. Shown graphically:

    time     ----------------->
    this     --1-----2----3--->
    scanPast --1-----3----6--->|

    The scanPast can also be used to produce an event stream of a different type. The following produces a complete history of all the events seen so far:

    val s2 = r.scanPast(List[Int]()) {
    (history, n) => n :: history
    }

    The s2 will produce events 1 :: Nil, 2 :: 1 :: Nil and 3 :: 2 :: 1 :: Nil. Note: the initial value Nil is not emitted.

    This operation is closely related to a scanLeft on a collection -- if an event stream were a sequence of elements, then scanLeft would produce a new sequence whose elements correspond to the events of the resulting event stream.

    S

    the type of the events in the resulting event stream

    z

    the initial value of the scan past

    op

    the operator the combines the last produced and the current event into a new one

    returns

    an event stream that scans events from this event stream

    Definition Classes
    Events
  69. def sync[S, R](that: Events[S])(f: (T, S) ⇒ R)(implicit at: Arrayable[T], as: Arrayable[S]): Events[R]

    Syncs the arrival of events from this and that event stream.

    Syncs the arrival of events from this and that event stream.

    Ensures that pairs of events from this event stream and that event stream are emitted together. If the events produced in time by this and that, the sync will be as follows:

    time   --------------------------->
    this   ----1---------2-------4---->
    that   --1-----2--3--------------->
    sync   ----1,1-------2,2-----4,3-->

    Pairs of events produced from this and that are then transformed using specified function f. For example, clients that want to output tuples do:

    val synced = (a sync b) { (a, b) => (a, b) }

    Clients that, for example, want to create differences in pairs of events do:

    val diffs = (a sync b)(_ - _)

    The resulting event stream unreacts either when this unreacts and there are no more buffered events from this, or when that unreacts and there are no more buffered events from that.

    Use case:

    def sync[S, R](that: Events[S])(f: (T, S) => R): Events[R]

    Note: This operation potentially caches events from this and that. Unless certain that both this produces a bounded number of events before the that produces an event, and vice versa, this operation should not be called.

    S

    the type of the events in that event stream

    R

    the type of the events in the resulting event stream

    that

    the event stream to sync with

    f

    the mapping function for the pair of events

    at

    evidence that arrays can be created for the type T

    as

    evidence that arrays can be created for the type S

    returns

    the event stream with the resulting events

    Definition Classes
    Events
  70. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  71. def tail: Events[T]

    Emits all the events from this even stream except the first one.

    Emits all the events from this even stream except the first one.

    returns

    event stream with the forwarded events

    Definition Classes
    Events
  72. def takeWhile(p: (T) ⇒ Boolean): Events[T]

    Returns a new event stream that forwards the events from this event stream as long as they satisfy the predicate p.

    Returns a new event stream that forwards the events from this event stream as long as they satisfy the predicate p.

    After an event that does not specify the predicate occurs, the resulting event stream unreacts.

    If the predicate throws an exception, the exceptions is propagated, and the resulting event stream unreacts.

    time             ------------------------>
    this             -0---1--2--3-4--1-5--2-->
    takeWhile(_ < 4)     -1--2--3-|
    p

    the predicate that specifies whether to take the element

    returns

    event stream with the forwarded events

    Definition Classes
    Events
  73. def toCold(init: T): Signal[T]

    Given an initial event init, converts the event stream into a cold Signal.

    Given an initial event init, converts the event stream into a cold Signal.

    Cold signals emit events only when some observer is subscribed to them. As soon as there are no subscribers for the signal, the signal unsubscribes itself from its source event stream. While unsubscribed, the signal **does not update its value**, even if its event source (this event stream) emits events.

    If there is at least one subscription to the cold signal, the signal subscribes itself to its event source (this event stream) again.

    The unsubscribe method on the resulting signal does nothing -- the subscription of the cold signal unsubscribes only after all of the subscribers unsubscribe, or the source event stream unreacts.

    Definition Classes
    Events
  74. def toEmpty: Signal[T]

    Converts this event stream into a Signal.

    Converts this event stream into a Signal.

    The resulting signal initially does not contain an event, and subsequently contains any event that this event stream produces.

    returns

    the signal version of the current event stream

    Definition Classes
    Events
  75. def toIVar: IVar[T]

    Creates an IVar event stream value, completed with the first event from this event stream.

    Creates an IVar event stream value, completed with the first event from this event stream.

    After the IVar is assigned, all subsequent events are ignored. If the self event stream is unreacted before any event arrives, the IVar is closed.

    returns

    an IVar with the first event from this event stream

    Definition Classes
    Events
  76. def toSignal(init: T): Signal[T]

    Given an initial event init, converts this event stream into a Signal.

    Given an initial event init, converts this event stream into a Signal.

    The resulting signal initially contains the event init, and subsequently any event that this event stream produces.

    init

    an initial value for the signal

    returns

    the signal version of the current event stream

    Definition Classes
    Events
  77. def toString(): String

    Definition Classes
    AnyRef → Any
  78. def tryExcept(t: Throwable): Boolean

  79. def tryReact(x: T): Boolean

  80. def tryUnreact(): Boolean

    Tries to fail the ivar with the NoSuchElementException.

    Tries to fail the ivar with the NoSuchElementException.

    Returns false if the ivar is completed.

  81. def union[S](implicit evidence: <:<[T, Events[S]], ds: Spec[S]): Events[S]

    Unifies the events produced by all the event streams emitted by this.

    Unifies the events produced by all the event streams emitted by this.

    This operation is only available for event stream values that emit other event streams as events. The resulting event stream unifies events of all the event streams emitted by this. Once this and all the event streams emitted by this unreact, the resulting event stream terminates.

    Note: if the same event stream is emitted multiple times, it will be subscribed to multiple times.

    Example:

    time  -------------------------->
    this     --1----2--------3------>
                 ---------5----6---->
                   ---4----------7-->
    union -----1----2-4---5--3-6-7-->

    Use case:

    def union[S](): Events[S]
    S

    the type of the events in event streams emitted by this

    evidence

    evidence that events of type T produced by this are actually event stream values of type S

    returns

    the event stream with the union of all the events from the nested event streams

    Definition Classes
    Events
  82. def union(that: Events[T]): Events[T]

    Creates a union of this and that event stream.

    Creates a union of this and that event stream.

    The resulting event stream emits events from both this and that event stream. It unreacts when both this and that event stream unreact.

    that

    another event stream for the union

    returns

    the event stream with unified events from this and that

    Definition Classes
    Events
  83. def unreact(): Unit

    Fails the ivar with the NoSuchElementException if it is unassigned.

    Fails the ivar with the NoSuchElementException if it is unassigned.

    If completed, throws an exception.

  84. def unreacted(implicit ds: Spec[T]): Events[Unit]

    Returns a new event stream that emits an event when this event stream unreacts.

    Returns a new event stream that emits an event when this event stream unreacts.

    After the current event stream unreacts, the result event stream first emits an event of type Unit, and then unreacts itself.

    Exceptions from this event stream are propagated until the resulting event stream unreacts -- after that, this event stream is not allowed to produce exceptions.

    Shown on the diagram:

    time            ------------------->
    this            --1--2-----3-|
    currentEvent    -------------()-|
    returns

    the unreaction event stream and subscription

    Definition Classes
    Events
  85. def unsubscribe(): Unit

    Stops event propagation on the corresponding event stream.

    Stops event propagation on the corresponding event stream.

    Definition Classes
    IVarSubscription
  86. def until[S](that: Events[S]): Events[T]

    Creates a new event stream value that produces events from this event stream value until that produces an event.

    Creates a new event stream value that produces events from this event stream value until that produces an event.

    If this unreacts before that produces a value, the resulting event stream unreacts. Otherwise, the resulting event stream unreacts whenever that produces a value.

    S

    the type of that event stream

    that

    the event stream until whose first event the result propagates events

    returns

    the resulting event stream that emits only until that emits

    Definition Classes
    Events
  87. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  90. def withSubscription(s: Subscription): Signal[T]

    Returns another signal with the same value, and an additional subscription.

    Returns another signal with the same value, and an additional subscription.

    s

    the additional subscription to unsubscribe to

    returns

    a signal with the same events and value, and an additional subscription

    Definition Classes
    Signal
  91. def zip[S, R](that: Signal[S])(f: (T, S) ⇒ R): Events[R]

    Zips values of this and that signal using the specified function f.

    Zips values of this and that signal using the specified function f.

    Whenever either of the two signals change the resulting signal also changes. When this emits an event, the current value of that is used to produce a signal on that, and vice versa.

    time --------------------------------->
    this --1----2-----4----------8-------->
    that --a----------------b---------c--->
    zip  --1,a--2,a---4,a---4,b--8,b--8,c->

    The resulting tuple of events from this and that is mapped using the user-specified mapping function f. For example, to produce tuples:

    val tuples = (a zip b) { (a, b) => (a, b) }

    To produce the difference between two integer signals:

    val differences = (a zip b)(_ - _)

    Note:: clients looking into pairing incoming events from two signals you should use the sync method inherited from Events.

    S

    the type of that signal

    R

    the type of the resulting signal

    that

    the signal to zip this with

    f

    the function that maps a tuple of values into an outgoing event

    returns

    a subscription and the event stream that emits zipped events

    Definition Classes
    Signal
  92. def zipHint[S](f: (T, Any) ⇒ S): Events[S]

    Zips values from this event stream with the hint value.

    Zips values from this event stream with the hint value.

    Definition Classes
    Events
  93. def [B](y: B): (IVar[T], B)

    Implicit information
    This member is added by an implicit conversion from IVar[T] to ArrowAssoc[IVar[T]] performed by method any2ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Shadowed Implicit Value Members

  1. val self: Any

    Implicit information
    This member is added by an implicit conversion from IVar[T] to StringAdd performed by method any2stringadd in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (iVar: StringAdd).self
    Definition Classes
    StringAdd
  2. val self: Any

    Implicit information
    This member is added by an implicit conversion from IVar[T] to StringFormat performed by method any2stringfmt in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (iVar: StringFormat).self
    Definition Classes
    StringFormat

Deprecated Value Members

  1. def x: IVar[T]

    Implicit information
    This member is added by an implicit conversion from IVar[T] to ArrowAssoc[IVar[T]] performed by method any2ArrowAssoc in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (iVar: ArrowAssoc[IVar[T]]).x
    Definition Classes
    ArrowAssoc
    Annotations
    @deprecated
    Deprecated

    (Since version 2.10.0) Use leftOfArrow instead

  2. def x: IVar[T]

    Implicit information
    This member is added by an implicit conversion from IVar[T] to Ensuring[IVar[T]] performed by method any2Ensuring in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (iVar: Ensuring[IVar[T]]).x
    Definition Classes
    Ensuring
    Annotations
    @deprecated
    Deprecated

    (Since version 2.10.0) Use resultOfEnsuring instead

Inherited from Signal[T]

Inherited from Subscription

Inherited from Events[T]

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from IVar[T] to StringAdd

Inherited by implicit conversion any2stringfmt from IVar[T] to StringFormat

Inherited by implicit conversion any2ArrowAssoc from IVar[T] to ArrowAssoc[IVar[T]]

Inherited by implicit conversion any2Ensuring from IVar[T] to Ensuring[IVar[T]]

Ungrouped