Dep

reactify.Dep
See theDep companion object
class Dep[T, R] extends Reactive[T], Stateful[T], Mutable[T]

Dep allows creation of a dependent Var on another Var allowing conversion between the two. This can be useful for different representations of the same value. For example, in a graphical environment left, center, and right are all different representations of the value (horizontal position). Maintaining three distinct values while keeping them in-sync is painful. With Dep you can simply define one Var and two Dep values like:

val left: Var[Double] = Var(0.0) val width: Var[Double] = Var(0.0) val center: Dep[Double, Double] = Dep(left)(_ + (width / 2.0), _ - (width / 2.0)) val right: Dep[Double, Double] = Dep(left)(_ + width, _ - width)

Now, modification to left, center, or right will maintain the appropriate value for each without any additional boilerplate.

Type parameters

R

the type that this Dep receives

T

the type of value this Reactive receives

Attributes

Companion
object
Graph
Supertypes
trait Mutable[T]
trait Stateful[T]
trait Reactive[T]
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

override def get: T

Gets the current value

Gets the current value

Attributes

Definition Classes
override def set(f: => T): Unit

Sets the function evaluation representing the new value for this mutable entity

Sets the function evaluation representing the new value for this mutable entity

Attributes

Definition Classes

Inherited methods

def !(future: Future[T])(implicit ec: ExecutionContext): Future[Unit]

Convenience functionality to assign the result of a future (upon completion) to this Channel

Convenience functionality to assign the result of a future (upon completion) to this Channel

Attributes

Inherited from:
Mutable
def &(that: Stateful[T]): Stateful[T]

Group multiple Statefuls together

Group multiple Statefuls together

Attributes

Inherited from:
Stateful
def :=(f: => T): Unit

Convenience alternative to "set"

Convenience alternative to "set"

Attributes

Inherited from:
Mutable
def @=(f: T): Unit

Convenience alternative to "static"

Convenience alternative to "static"

Attributes

Inherited from:
Mutable
def and(that: Stateful[T]): Stateful[T]

Group multiple Statefuls together

Group multiple Statefuls together

Attributes

Inherited from:
Stateful
def apply(): T

Convenience wrapper around get

Convenience wrapper around get

Attributes

Inherited from:
Stateful
def attach(f: T => Unit, priority: Double): Reaction[T]

Convenience method to create a Reaction to attach to this Reactive

Convenience method to create a Reaction to attach to this Reactive

Value parameters

f

the function reaction

priority

the priority in comparison to other reactions (Defaults to Priority.Normal)

Attributes

Returns

created Reaction[T]

Inherited from:
Reactive
def attachAndFire(f: T => Unit, priority: Double): Reaction[T]

Convenience functionality to attach a Reaction and immediately fire the current state on the Reaction.

Convenience functionality to attach a Reaction and immediately fire the current state on the Reaction.

Value parameters

f

the function reaction

priority

the priority in comparison to other reactions (Defaults to Priority.Normal)

Attributes

Returns

Reaction[T]

Inherited from:
Stateful
def changes(f: (T, T) => Unit, priority: Double): Reaction[T]

Convenience method to create a Reaction to monitor changes to this Reactive

Convenience method to create a Reaction to monitor changes to this Reactive

Value parameters

f

the function reaction to receive changes

priority

the priority in comparison to other reactions (Defaults to Priority.Normal)

Attributes

Returns

created Reaction[T]

Inherited from:
Reactive
def future(condition: T => Boolean): Future[T]

Convenience method to create a Future[T] that will complete upon the next reaction that meets to supplied condition.

Convenience method to create a Future[T] that will complete upon the next reaction that meets to supplied condition.

Value parameters

condition

optional condition that must be true for this to fire (Defaults to accept anything)

Attributes

Returns

Future[T]

Inherited from:
Reactive
def on(f: => Unit, priority: Double): Reaction[T]

Convenience method to create a Reaction to monitor changes to this Reactive when you don't care about the actual value.

Convenience method to create a Reaction to monitor changes to this Reactive when you don't care about the actual value.

Value parameters

f

the function reaction to invoke in reaction to a value received

priority

the priority in comparison to other reactions (Defaults to Priority.Normal)

Attributes

Returns

created Reaction[T]

Inherited from:
Reactive
def once(f: T => Unit, condition: T => Boolean, priority: Double): Reaction[T]

Convenience method to create a Reaction to monitor a single reaction based on an optional condition.

Convenience method to create a Reaction to monitor a single reaction based on an optional condition.

Value parameters

condition

optional condition that must be true for this to fire (Defaults to accept anything)

f

the function reaction

priority

the priority in comparison to other reactions (Defaults to Priority.Normal)

Attributes

Returns

created Reaction[T]

Inherited from:
Reactive
def static(f: T): Unit

Sets a static value representing the new value for this mutable entity

Sets a static value representing the new value for this mutable entity

Attributes

Inherited from:
Mutable
def status: Option[ReactionStatus]

If the current thread is reacting to a value currently, status represents the status of the reaction. This can be set to ReactionStatus.Stop in order to stop propagation. This can also be achieved via stopPropagation().

If the current thread is reacting to a value currently, status represents the status of the reaction. This can be set to ReactionStatus.Stop in order to stop propagation. This can also be achieved via stopPropagation().

Attributes

Inherited from:
Reactive
def status_=(status: ReactionStatus): Unit

Attributes

Inherited from:
Reactive
def stopPropagation(): Unit

Shortcut functionality to call status = ReactionStatus.Stop

Shortcut functionality to call status = ReactionStatus.Stop

Attributes

Inherited from:
Reactive
def update(f: => T): Unit

Convenience alternative to "set"

Convenience alternative to "set"

Attributes

Inherited from:
Mutable

Concrete fields

val owner: Var[R]

Inherited fields

lazy val reactions: Reactions[T]

Reactions currently associated with this Reactive

Reactions currently associated with this Reactive

Attributes

Inherited from:
Reactive