public class Selection<T,V,R> extends Suspension<T>
Suspension subclass that selects the suspension result from one or
more of multiple continuations based on certain criteria. If a child
continuation fails the selection step will also fail. If a child continuation
is cancelled, it will simply be ignored.| Modifier and Type | Method and Description |
|---|---|
void |
add(Continuation<? extends V> rContinuation)
Adds a continuation to this group.
|
void |
cancel()
Cancels this suspension.
|
static <T,V> Selection<T,V,java.util.Collection<V>> |
ofMultipleValues(CoroutineStep<?,T> rSuspendingStep,
CoroutineStep<java.util.Collection<V>,?> rResumeStep,
Continuation<?> rContinuation,
java.util.function.Predicate<Continuation<?>> pComplete,
java.util.function.Predicate<Continuation<?>> pSelect)
Creates a new instance for the selection of multiple values.
|
static <T> Selection<T,T,T> |
ofSingleValue(CoroutineStep<?,T> rSuspendingStep,
CoroutineStep<T,?> rResumeStep,
Continuation<?> rContinuation,
java.util.function.Predicate<Continuation<?>> pSelect)
Creates a new instance for the selection of a single value.
|
void |
seal()
Seals this instance so that no more coroutines can be added with
add(Continuation). |
java.lang.String |
toString() |
continuation, fail, ifNotCancelled, isCancelled, resume, resume, suspendingStep, value, withValuepublic static <T,V> Selection<T,V,java.util.Collection<V>> ofMultipleValues(CoroutineStep<?,T> rSuspendingStep, CoroutineStep<java.util.Collection<V>,?> rResumeStep, Continuation<?> rContinuation, java.util.function.Predicate<Continuation<?>> pComplete, java.util.function.Predicate<Continuation<?>> pSelect)
rSuspendingStep - The step that initiated the suspensionrResumeStep - The step to resume the execution withrContinuation - The continuation of the executionpComplete - The condition for the termination of the
selectionpSelect - The condition for the selection of resultspublic static <T> Selection<T,T,T> ofSingleValue(CoroutineStep<?,T> rSuspendingStep, CoroutineStep<T,?> rResumeStep, Continuation<?> rContinuation, java.util.function.Predicate<Continuation<?>> pSelect)
rSuspendingStep - The step that initiated the suspensionrResumeStep - The step to resume the execution withrContinuation - The continuation of the executionpSelect - The condition for the selection of resultspublic void add(Continuation<? extends V> rContinuation)
rContinuation - The continuationpublic void cancel()
cancel
the continuation. Tries to resuming a cancelled suspension will be
ignored.cancel in class Suspension<T>public void seal()
add(Continuation). Sealing is necessary to allow the adding of further
coroutines even if previously added coroutines have already finished
execution.public java.lang.String toString()
toString in class Suspension<T>