P_OUT
- type of output elements from the pipelinepublic abstract class PipelineHelper<P_OUT> extends Object
A PipelineHelper
describes the initial segment of a stream pipeline,
including its source, intermediate operations, and may additionally
incorporate information about the terminal (or stateful) operation which
follows the last intermediate operation described by this
PipelineHelper
. The PipelineHelper
is passed to the
TerminalOp.evaluateParallel(PipelineHelper, java.util.Spliterator)
,
TerminalOp.evaluateSequential(PipelineHelper, java.util.Spliterator)
,
and AbstractPipeline.opEvaluateParallel(PipelineHelper, java.util.Spliterator,
java.util.function.IntFunction)
, methods, which can use the
PipelineHelper
to access information about the pipeline such as
head shape, stream flags, and size, and use the helper methods
such as wrapAndCopyInto(Sink, Spliterator)
,
copyInto(Sink, Spliterator)
, and wrapSink(Sink)
to execute
pipeline operations.
Constructor and Description |
---|
PipelineHelper() |
Modifier and Type | Method and Description |
---|---|
abstract <P_IN> Node<P_OUT> |
evaluate(Spliterator<P_IN> spliterator,
boolean flatten,
IntFunction<P_OUT[]> generator)
Collects all output elements resulting from applying the pipeline stages
to the source
Spliterator into a Node . |
abstract int |
getStreamAndOpFlags()
Gets the combined stream and operation flags for the output of the described
pipeline.
|
abstract <P_IN> Sink<P_IN> |
wrapSink(Sink<P_OUT> sink)
Takes a
Sink that accepts elements of the output type of the
PipelineHelper , and wrap it with a Sink that accepts
elements of the input type and implements all the intermediate operations
described by this PipelineHelper , delivering the result into the
provided Sink . |
public abstract int getStreamAndOpFlags()
StreamOpFlag
public abstract <P_IN> Sink<P_IN> wrapSink(Sink<P_OUT> sink)
Sink
that accepts elements of the output type of the
PipelineHelper
, and wrap it with a Sink
that accepts
elements of the input type and implements all the intermediate operations
described by this PipelineHelper
, delivering the result into the
provided Sink
.sink
- the Sink
to receive the resultsSink
that implements the pipeline stages and sends
results to the provided Sink
public abstract <P_IN> Node<P_OUT> evaluate(Spliterator<P_IN> spliterator, boolean flatten, IntFunction<P_OUT[]> generator)
Spliterator
into a Node
.spliterator
- the source Spliterator
flatten
- if true and the pipeline is a parallel pipeline then the
Node
returned will contain no children, otherwise the
Node
may represent the root in a tree that reflects the
shape of the computation tree.generator
- a factory function for array instancesNode
containing all output elements