Package at.jku.ssw.fp.sect05_2.workflow
Interface Step<I,O>
-
- Type Parameters:
I
- the type of the input of the stepO
- the type of the result of the step
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface Step<I,O>
Functional interface for steps in a workflow.- Author:
- Herbert Praehofer
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default <P> Step<I,Pair<O,P>>
both(Step<? super I,? extends P> that)
Creates a combined step which executes this step and the step given as a parameter and combines the result of both in aPair
.default <P,R>
Step<I,R>combine(Step<? super I,? extends P> that, BiFunction<? super O,? super P,R> combiner)
Creates a combined step which executes this step and the step given as a parameter and combines the result by the given binary function.default Step<I,O>
either(Step<? super I,? extends O> that, Predicate<? super I> pred)
Creates a combined step which executes either this step or the step given as parameter.default O
exec()
Executes the step without an input (input isnull
)O
exec(I i)
Executes this step.static <O> Step<O,O>
repeat(int n, Step<? super O,? extends O> step)
Creates a step which executes the given stepn
times.default <R> Step<I,R>
then(Step<? super O,? extends R> next)
Combines this step with the step given as parameter.
-
-
-
Method Detail
-
exec
O exec(I i)
Executes this step.- Parameters:
i
- the input of the step- Returns:
- the result of the step
-
exec
default O exec()
Executes the step without an input (input isnull
)- Returns:
- the result of the step
-
then
default <R> Step<I,R> then(Step<? super O,? extends R> next)
Combines this step with the step given as parameter.- Type Parameters:
R
- the result of executing both steps- Parameters:
next
- the second step- Returns:
- the combined step
-
either
default Step<I,O> either(Step<? super I,? extends O> that, Predicate<? super I> pred)
Creates a combined step which executes either this step or the step given as parameter. The decision which step to execute is based on a test of the input by the given predicate.- Parameters:
that
- the other steppred
- the predicate to test the input- Returns:
- the combined step
-
both
default <P> Step<I,Pair<O,P>> both(Step<? super I,? extends P> that)
Creates a combined step which executes this step and the step given as a parameter and combines the result of both in aPair
.- Type Parameters:
P
- the result type of the second step- Parameters:
that
- the second step- Returns:
- the combined step
-
combine
default <P,R> Step<I,R> combine(Step<? super I,? extends P> that, BiFunction<? super O,? super P,R> combiner)
Creates a combined step which executes this step and the step given as a parameter and combines the result by the given binary function.- Type Parameters:
P
- the result type of the second stepR
- the type of the combined result- Parameters:
that
- the second stepcombiner
- the combiner binary function- Returns:
- the combined step
-
repeat
static <O> Step<O,O> repeat(int n, Step<? super O,? extends O> step)
Creates a step which executes the given stepn
times.- Type Parameters:
O
- the type of the input and output (which are the same)- Parameters:
n
- the number of times to execute the stepstep
- the step to repeat- Returns:
- the combined step with the repetitions
-
-