|
org.codehaus.gpars | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object groovyx.gpars.dataflow.operator.Pipeline
public final class Pipeline
A builder for operator pipelines. The greatest benefit of using the Pipeline class compared to chaining the channels directly is the ease with which a custom thread pool/group can be applied to all the operators along the constructed chain.
Field Summary | |
---|---|
private boolean |
complete
|
private PGroup |
group
|
private DataflowReadChannel |
output
|
Constructor Summary | |
Pipeline(DataflowReadChannel output)
|
|
Pipeline(Pool pool, DataflowReadChannel output)
|
|
Pipeline(PGroup group, DataflowReadChannel output)
|
Method Summary | |
---|---|
void
|
binaryChoice(DataflowWriteChannel trueBranch, DataflowWriteChannel falseBranch, groovy.lang.Closure code)
Directs the output to one of the two output channels depending on the boolean result of the provided closure. |
void
|
binaryChoice(java.util.Map params, DataflowWriteChannel trueBranch, DataflowWriteChannel falseBranch, groovy.lang.Closure code)
Directs the output to one of the output channels depending on the int result of the provided closure. |
Pipeline
|
chainWith(groovy.lang.Closure closure)
Creates and attaches a new operator |
Pipeline
|
chainWith(java.util.Map params, groovy.lang.Closure closure)
Creates and attaches a new operator |
private void
|
checkState()
|
void
|
choice(java.util.List outputs, groovy.lang.Closure code)
Directs the output to one of the output channels depending on the int result of the provided closure. |
void
|
choice(java.util.Map params, java.util.List outputs, groovy.lang.Closure code)
Allows the closure to output different values to different output channels. |
Pipeline
|
filter(groovy.lang.Closure closure)
Creates and attaches a new operator that will filter data using the provided closure |
Pipeline
|
filter(java.util.Map params, groovy.lang.Closure closure)
Makes the output of the pipeline to be an input for the specified channel |
PGroup
|
getGroup()
|
DataflowReadChannel
|
getOutput()
|
void
|
into(DataflowWriteChannel target)
Makes the output of the pipeline to be an input for the specified channel |
void
|
into(java.util.Map params, DataflowWriteChannel target)
Makes the output of the pipeline to be an input for the specified channel |
boolean
|
isComplete()
|
Pipeline
|
merge(DataflowReadChannel other, groovy.lang.Closure closure)
Merges channels together as inputs for a single dataflow operator. |
Pipeline
|
merge(java.util.List others, groovy.lang.Closure closure)
Merges channels together as inputs for a single dataflow operator. |
Pipeline
|
merge(java.util.Map params, DataflowReadChannel other, groovy.lang.Closure closure)
Merges channels together as inputs for a single dataflow operator. |
Pipeline
|
merge(java.util.Map params, java.util.List others, groovy.lang.Closure closure)
Directs the output to one of the two output channels depending on the boolean result of the provided closure. |
Pipeline
|
or(groovy.lang.Closure closure)
Creates and attaches a new operator that will filter data using the provided closure |
void
|
or(DataflowWriteChannel target)
Splits the output of the pipeline to be an input for the specified channels |
void
|
separate(java.util.List outputs, groovy.lang.Closure code)
Allows the closure to output different values to different output channels. |
void
|
separate(java.util.Map params, java.util.List outputs, groovy.lang.Closure code)
|
void
|
split(DataflowWriteChannel target1, DataflowWriteChannel target2)
Makes the output of the pipeline to be an input for the specified channels |
void
|
split(java.util.List targets)
Splits the output of the pipeline to be an input for the specified channels |
void
|
split(java.util.Map params, DataflowWriteChannel target1, DataflowWriteChannel target2)
Makes the output of the pipeline to be an input for the specified channels |
void
|
split(java.util.Map params, java.util.List targets)
Taps into the pipeline at the current position, sending all data that pass through the pipeline also to the channel specified. |
Pipeline
|
tap(DataflowWriteChannel target)
Taps into the pipeline at the current position, sending all data that pass through the pipeline also to the channel specified. |
Pipeline
|
tap(java.util.Map params, DataflowWriteChannel target)
Merges channels together as inputs for a single dataflow operator. |
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Field Detail |
---|
private boolean complete
private final PGroup group
private DataflowReadChannel output
Constructor Detail |
---|
public Pipeline(DataflowReadChannel output)
public Pipeline(Pool pool, DataflowReadChannel output)
public Pipeline(PGroup group, DataflowReadChannel output)
Method Detail |
---|
public void binaryChoice(DataflowWriteChannel trueBranch, DataflowWriteChannel falseBranch, groovy.lang.Closure code)
params
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)trueBranch
- The channel to send data to if the closure returns truefalseBranch
- The channel to send data to if the closure returns truecode
- A closure directing data to either the true or the false output branch
public void binaryChoice(java.util.Map params, DataflowWriteChannel trueBranch, DataflowWriteChannel falseBranch, groovy.lang.Closure code)
outputs
- The channels to send data to.code
- A closure returning an index of the output channel to direct the data to
public Pipeline chainWith(groovy.lang.Closure closure)
params
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)closure
- The function to invoke on all incoming values as part of the new operator's body
- The type of values returned from the supplied closure
public Pipeline chainWith(java.util.Map params, groovy.lang.Closure closure)
closure
- The function to invoke on all incoming values as part of the new operator's body
- The type of values returned from the supplied closure
private void checkState()
public void choice(java.util.List outputs, groovy.lang.Closure code)
params
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)outputs
- The channels to send data to.code
- A closure returning an index of the output channel to direct the data to
public void choice(java.util.Map params, java.util.List outputs, groovy.lang.Closure code)
outputs
- The channels to send data to.code
- A closure returning a list of values to pass to the output channels. Values are output to the output channels with identical index.
public Pipeline filter(groovy.lang.Closure closure)
params
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)closure
- The filter function to invoke on all incoming values to decide whether to pass the value on or not
public Pipeline filter(java.util.Map params, groovy.lang.Closure closure)
target
- The channel to copy data into
- The type of values passed between the channels
public PGroup getGroup()
public DataflowReadChannel getOutput()
public void into(DataflowWriteChannel target)
params
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)target
- The channel to copy data into
- The type of values passed between the channels
public void into(java.util.Map params, DataflowWriteChannel target)
target
- The channel to copy data into
- The type of values passed between the channels
public boolean isComplete()
Pipeline merge(DataflowReadChannel other, groovy.lang.Closure closure)
others
- The channels to merge withclosure
- The function to invoke on all incoming values as part of the new operator's body. The number of arguments to the closure must match the number of input channels.
Pipeline merge(java.util.List others, groovy.lang.Closure closure)
params
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)other
- The channel to merge withclosure
- The function to invoke on all incoming values as part of the new operator's body. The number of arguments to the closure must match the number of input channels.
Pipeline merge(java.util.Map params, DataflowReadChannel other, groovy.lang.Closure closure)
params
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)others
- The channels to merge withclosure
- The function to invoke on all incoming values as part of the new operator's body. The number of arguments to the closure must match the number of input channels.
Pipeline merge(java.util.Map params, java.util.List others, groovy.lang.Closure closure)
trueBranch
- The channel to send data to if the closure returns truefalseBranch
- The channel to send data to if the closure returns truecode
- A closure directing data to either the true or the false output branch
public Pipeline or(groovy.lang.Closure closure)
closure
- The filter function to invoke on all incoming values to decide whether to pass the value on or not
public void or(DataflowWriteChannel target)
target1
- The first channel to copy data intotarget2
- The second channel to copy data into
- The type of values passed between the channels
public void separate(java.util.List outputs, groovy.lang.Closure code)
params
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)outputs
- The channels to send data to.code
- A closure returning a list of values to pass to the output channels. Values are output to the output channels with identical index.
public void separate(java.util.Map params, java.util.List outputs, groovy.lang.Closure code)
public void split(DataflowWriteChannel target1, DataflowWriteChannel target2)
targets
- The channels to copy data into
- The type of values passed between the channels
public void split(java.util.List targets)
params
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)target1
- The first channel to copy data intotarget2
- The second channel to copy data into
- The type of values passed between the channels
public void split(java.util.Map params, DataflowWriteChannel target1, DataflowWriteChannel target2)
params
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)targets
- The channels to copy data into
- The type of values passed between the channels
public void split(java.util.Map params, java.util.List targets)
target
- The channel to tap data into
- The type of values passed between the channels
public Pipeline tap(DataflowWriteChannel target)
params
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)target
- The channel to tap data into
- The type of values passed between the channels
public Pipeline tap(java.util.Map params, DataflowWriteChannel target)
other
- The channel to merge withclosure
- The function to invoke on all incoming values as part of the new operator's body. The number of arguments to the closure must match the number of input channels.
Copyright © 2008–2013 Václav Pech. All Rights Reserved.