Package org.reactfx
Interface Suspendable
-
- All Known Subinterfaces:
SuspendableEventStream<T>
,SuspendableList<E>
,SuspendableVal<T>
,SuspendableVar<T>
,Toggle
- All Known Implementing Classes:
AbstractReducibleEventStream
,AccumulativeEventStream
,BiSuspendable
,ForgetfulEventStream
,MultiSuspendable
,PausableEventStream
,ReducibleEventStream
,SuppressibleEventStream
,SuspendableBase
,SuspendableBoolean
,SuspendableEventStreamBase
,SuspendableListWrapper
,SuspendableNo
,SuspendableValWrapper
,SuspendableVarWrapper
,SuspendableYes
,ToggleFromVal
public interface Suspendable
Interface for objects that can be temporarily suspended, where the definition of "suspended" depends on the context. For example, when anObservable
is Suspendable, it means that its notification delivery can be suspended temporarily. In that case, what notifications are delivered when notifications are resumed depends on the concrete implementation. For example, notifications produced while suspended may be queued, accumulated, or ignored completely.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static Suspendable
combine(Suspendable... suspendables)
Returns a Suspendable that combines all the given Suspendables into one.Guard
suspend()
Suspends this suspendable object.default Subscription
suspendWhen(javafx.beans.value.ObservableValue<java.lang.Boolean> condition)
default void
suspendWhile(java.lang.Runnable r)
Runs the given computation while suspended.default <U> U
suspendWhile(java.util.function.Supplier<U> f)
Runs the given computation while suspended.
-
-
-
Method Detail
-
suspend
Guard suspend()
Suspends this suspendable object.In case of suspendable
Observable
, suspends notification delivery for this observable object. Notifications produced while suspended may be queued for later delivery, accumulated into a single cumulative notification, or discarded completely, depending on the concrete implementation.
-
suspendWhile
default void suspendWhile(java.lang.Runnable r)
Runs the given computation while suspended.Equivalent to
try(Guard g = suspend()) { r.run(); }
-
suspendWhile
default <U> U suspendWhile(java.util.function.Supplier<U> f)
Runs the given computation while suspended. The codeT t = this.suspendWhile(f);
is equivalent toT t; try(Guard g = suspend()) { t = f.get(); }
- Returns:
- the result produced by the given supplier
f
.
-
suspendWhen
default Subscription suspendWhen(javafx.beans.value.ObservableValue<java.lang.Boolean> condition)
- Returns:
- A Subscription that can be used to stop observing
condition
and stop suspending this Suspendable based oncondition
. If at the time of unsubscribing the returned Subscription this Suspendable was suspended due tocondition
beingtrue
, it will be resumed.
-
combine
static Suspendable combine(Suspendable... suspendables)
Returns a Suspendable that combines all the given Suspendables into one. When that combined Suspendable is suspended, all participating Suspendables are suspended, in the given order. When resumed, all participating Suspendables are resumed, in reverse order.
-
-