public interface ValueView<T>
Value
, to which listeners may be added, but which one cannot update. This
can be used in combination with AbstractValue
to provide Value
semantics to an
entity which dispatches value changes in a custom manner (like over the network). Value
consumers should require only a view on a value, rather than a concrete value.Modifier and Type | Interface and Description |
---|---|
static interface |
ValueView.Listener<T>
Used to observe changes to a value.
|
Modifier and Type | Method and Description |
---|---|
SignalView<T> |
changes()
Returns a signal that is emitted whenever this value changes.
|
Connection |
connect(SignalView.Listener<? super T> listener)
Connects the supplied listener to this value, such that it will be notified when this value
changes.
|
Connection |
connect(Slot<? super T> listener)
Connects the supplied listener to this value, such that it will be notified when this value
changes.
|
Connection |
connect(ValueView.Listener<? super T> listener)
Connects the supplied listener to this value, such that it will be notified when this value
changes.
|
Connection |
connectNotify(SignalView.Listener<? super T> listener)
Connects the supplied listener to this value, such that it will be notified when this value
changes.
|
Connection |
connectNotify(Slot<? super T> listener)
Connects the supplied listener to this value, such that it will be notified when this value
changes.
|
Connection |
connectNotify(ValueView.Listener<? super T> listener)
Connects the supplied listener to this value, such that it will be notified when this value
changes.
|
void |
disconnect(ValueView.Listener<? super T> listener)
Disconnects the supplied listener from this value if it's connected.
|
<M> ValueView<M> |
flatMap(Function<? super T,? extends ValueView<M>> func)
Creates a value that flat maps (monadic binds) this value via a function.
|
T |
get()
Returns the current value.
|
<M> ValueView<M> |
map(Function<? super T,M> func)
Creates a value that maps this value via a function.
|
RFuture<T> |
when(Function<? super T,Boolean> cond)
Returns a future which is completed with this value when the value meeds
cond . |
T get()
<M> ValueView<M> map(Function<? super T,M> func)
<M> ValueView<M> flatMap(Function<? super T,? extends ValueView<M>> func)
SignalView<T> changes()
RFuture<T> when(Function<? super T,Boolean> cond)
cond
. If
the value meets cond
now, the future will be completed immediately, otherwise the
future will be completed when the value changes to a value which meets cond
.Connection connect(ValueView.Listener<? super T> listener)
Connection connectNotify(ValueView.Listener<? super T> listener)
void disconnect(ValueView.Listener<? super T> listener)
Connection connect(SignalView.Listener<? super T> listener)
Connection connectNotify(SignalView.Listener<? super T> listener)
Connection connect(Slot<? super T> listener)
Connection connectNotify(Slot<? super T> listener)
Copyright © 2017. All rights reserved.