com.io7m.r2.core

## Class R2Watchable<T>

- java.lang.Object
- - com.io7m.r2.core.R2Watchable<T>

- Type Parameters:
    `T` - The type of watched values
  All Implemented Interfaces:
    R2WatchableType<T>

      public final class R2Watchable<T>
      extends Object
      implements R2WatchableType<T>

  The default implementation of the `R2WatchableType` interface.

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <T> R2WatchableType<T>` | `newWatchable(T initial)` Create a new watchable with the given initial value.
    `void` | `watchableAdd(Consumer<T> w)` Add a watcher.
    `void` | `watchableChanged()` Notify all watchers that the value has changed.
    `void` | `watchableRemove(Consumer<T> w)` Remove a watcher.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### newWatchable

          public static <T> R2WatchableType<T> newWatchable(T initial)

      Create a new watchable with the given initial value.
      Type Parameters:
        `T` - The type of value
      Parameters:
        `initial` - The value
      Returns:
        A new watchable

    - #### watchableAdd

          public void watchableAdd(Consumer<T> w)

      Description copied from interface: `R2WatchableType`
      Add a watcher. The watcher will be notified every time `R2WatchableType.watchableChanged()` is called.
      Specified by:
        `watchableAdd` in interface `R2WatchableType<T>`
      Parameters:
        `w` - The watcher

    - #### watchableRemove

          public void watchableRemove(Consumer<T> w)

      Description copied from interface: `R2WatchableType`
      Remove a watcher.
      Specified by:
        `watchableRemove` in interface `R2WatchableType<T>`
      Parameters:
        `w` - The watcher

    - #### watchableChanged

          public void watchableChanged()

      Description copied from interface: `R2WatchableType`
      Notify all watchers that the value has changed.
      Specified by:
        `watchableChanged` in interface `R2WatchableType<T>`

Copyright © 2016 <code@io7m.com> http://io7m.com