groovyx.gpars.dataflow.stream
Class DataflowStreamReadAdapter<T>

java.lang.Object
  extended by groovyx.gpars.dataflow.stream.DataflowStreamReadAdapter<T>
Type Parameters:
T - The type of messages to pass through the stream
All Implemented Interfaces:
DataflowReadChannel<T>
Direct Known Subclasses:
SyncDataflowStreamReadAdapter

public class DataflowStreamReadAdapter<T>
extends java.lang.Object
implements DataflowReadChannel<T>

Adapts a DataflowStream to accommodate for the DataflowReadChannel interface. To minimize the overhead and stay in-line with the DataflowStream semantics, the DataflowStreamReadAdapter class is not thread-safe and should only be used from within a single thread. If multiple threads need to read from a DataflowStream, they should each create their own wrapping DataflowStreamReadAdapter.

Author:
Vaclav Pech

Field Summary
private  StreamCore<T> asyncHead
           
private  DataflowChannelEventOrchestrator<T> eventManager
           
private  StreamCore<T> head
           
 
Constructor Summary
DataflowStreamReadAdapter(StreamCore<T> stream)
          Creates a new adapter
 
Method Summary
protected  java.util.List<DataflowVariable<T>> allUnprocessedDFVs()
           
 void binaryChoice(DataflowWriteChannel<T> trueBranch, DataflowWriteChannel<T> falseBranch, groovy.lang.Closure<java.lang.Boolean> 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<java.lang.String,java.lang.Object> params, DataflowWriteChannel<T> trueBranch, DataflowWriteChannel<T> falseBranch, groovy.lang.Closure<java.lang.Boolean> code)
          Directs the output to one of the two output channels depending on the boolean result of the provided closure.
 void binaryChoice(PGroup group, DataflowWriteChannel<T> trueBranch, DataflowWriteChannel<T> falseBranch, groovy.lang.Closure<java.lang.Boolean> code)
          Directs the output to one of the two output channels depending on the boolean result of the provided closure.
 void binaryChoice(PGroup group, java.util.Map<java.lang.String,java.lang.Object> params, DataflowWriteChannel<T> trueBranch, DataflowWriteChannel<T> falseBranch, groovy.lang.Closure<java.lang.Boolean> code)
          Directs the output to one of the two output channels depending on the boolean result of the provided closure.
 void binaryChoice(Pool pool, DataflowWriteChannel<T> trueBranch, DataflowWriteChannel<T> falseBranch, groovy.lang.Closure<java.lang.Boolean> code)
          Directs the output to one of the two output channels depending on the boolean result of the provided closure.
 void binaryChoice(Pool pool, java.util.Map<java.lang.String,java.lang.Object> params, DataflowWriteChannel<T> trueBranch, DataflowWriteChannel<T> falseBranch, groovy.lang.Closure<java.lang.Boolean> code)
          Directs the output to one of the two output channels depending on the boolean result of the provided closure.
 DataflowReadChannel<T> filter(groovy.lang.Closure<java.lang.Boolean> closure)
          Creates and attaches a new operator that will filter data using the provided closure
 DataflowReadChannel<T> filter(java.util.Map<java.lang.String,java.lang.Object> params, groovy.lang.Closure<java.lang.Boolean> closure)
          Creates and attaches a new operator that will filter data using the provided closure
 DataflowReadChannel<T> filter(PGroup group, groovy.lang.Closure<java.lang.Boolean> closure)
          Creates and attaches a new operator that will filter data using the provided closure
 DataflowReadChannel<T> filter(PGroup group, java.util.Map<java.lang.String,java.lang.Object> params, groovy.lang.Closure<java.lang.Boolean> closure)
          Creates and attaches a new operator that will filter data using the provided closure
 DataflowReadChannel<T> filter(Pool pool, groovy.lang.Closure<java.lang.Boolean> closure)
          Creates and attaches a new operator that will filter data using the provided closure
 DataflowReadChannel<T> filter(Pool pool, java.util.Map<java.lang.String,java.lang.Object> params, groovy.lang.Closure<java.lang.Boolean> closure)
          Creates and attaches a new operator that will filter data using the provided closure
private  void fireOnMessage(T value)
           
 DataflowChannelEventListenerManager<T> getEventManager()
          Retrieves the event manager object of this channel
 T getVal()
          Reads the current value of the channel.
 T getVal(long timeout, java.util.concurrent.TimeUnit units)
          Reads the current value of the channel.
 void getValAsync(MessageStream callback)
          Asynchronously retrieves the value from the channel.
 void getValAsync(java.lang.Object attachment, MessageStream callback)
          Asynchronously retrieves the value from the channel.
<V> DataflowReadChannel<V>
chainWith(groovy.lang.Closure<V> closure)
          Creates and attaches a new operator processing values from the channel
<V> DataflowReadChannel<V>
chainWith(java.util.Map<java.lang.String,java.lang.Object> params, groovy.lang.Closure<V> closure)
          Creates and attaches a new operator processing values from the channel
<V> DataflowReadChannel<V>
chainWith(PGroup group, groovy.lang.Closure<V> closure)
          Creates and attaches a new operator processing values from the channel
<V> DataflowReadChannel<V>
chainWith(PGroup group, java.util.Map<java.lang.String,java.lang.Object> params, groovy.lang.Closure<V> closure)
          Creates and attaches a new operator processing values from the channel
<V> DataflowReadChannel<V>
chainWith(Pool pool, groovy.lang.Closure<V> closure)
          Creates and attaches a new operator processing values from the channel
<V> DataflowReadChannel<V>
chainWith(Pool pool, java.util.Map<java.lang.String,java.lang.Object> params, groovy.lang.Closure<V> closure)
          Creates and attaches a new operator processing values from the channel
 void choice(java.util.List<DataflowWriteChannel<T>> outputs, groovy.lang.Closure<java.lang.Integer> code)
          Directs the output to one of the output channels depending on the int result of the provided closure.
 void choice(java.util.Map<java.lang.String,java.lang.Object> params, java.util.List<DataflowWriteChannel<T>> outputs, groovy.lang.Closure<java.lang.Integer> code)
          Directs the output to one of the output channels depending on the int result of the provided closure.
 void choice(PGroup group, java.util.List<DataflowWriteChannel<T>> outputs, groovy.lang.Closure<java.lang.Integer> code)
          Directs the output to one of the output channels depending on the int result of the provided closure.
 void choice(PGroup group, java.util.Map<java.lang.String,java.lang.Object> params, java.util.List<DataflowWriteChannel<T>> outputs, groovy.lang.Closure<java.lang.Integer> code)
          Directs the output to one of the output channels depending on the int result of the provided closure.
 void choice(Pool pool, java.util.List<DataflowWriteChannel<T>> outputs, groovy.lang.Closure<java.lang.Integer> code)
          Directs the output to one of the output channels depending on the int result of the provided closure.
 void choice(Pool pool, java.util.Map<java.lang.String,java.lang.Object> params, java.util.List<DataflowWriteChannel<T>> outputs, groovy.lang.Closure<java.lang.Integer> code)
          Directs the output to one of the output channels depending on the int result of the provided closure.
 void into(DataflowWriteChannel<T> target)
          Makes the output of the current channel to be an input for the specified channel
 void into(java.util.Map<java.lang.String,java.lang.Object> params, DataflowWriteChannel<T> target)
          Makes the output of the current channel to be an input for the specified channel
 void into(PGroup group, DataflowWriteChannel<T> target)
          Makes the output of the current channel to be an input for the specified channel
 void into(PGroup group, java.util.Map<java.lang.String,java.lang.Object> params, DataflowWriteChannel<T> target)
          Makes the output of the current channel to be an input for the specified channel
 void into(Pool pool, DataflowWriteChannel<T> target)
          Makes the output of the current channel to be an input for the specified channel
 void into(Pool pool, java.util.Map<java.lang.String,java.lang.Object> params, DataflowWriteChannel<T> target)
          Makes the output of the current channel to be an input for the specified channel
 boolean isBound()
          Check if value has been set already for this expression
 java.util.Iterator<T> iterator()
           
 int length()
          Returns the current size of the buffer
<V> DataflowReadChannel<V>
merge(DataflowReadChannel<java.lang.Object> other, groovy.lang.Closure<V> closure)
          Merges channels together as inputs for a single dataflow operator.
<V> DataflowReadChannel<V>
merge(java.util.List<DataflowReadChannel<java.lang.Object>> others, groovy.lang.Closure<V> closure)
          Merges channels together as inputs for a single dataflow operator.
<V> DataflowReadChannel<V>
merge(java.util.Map<java.lang.String,java.lang.Object> params, DataflowReadChannel<java.lang.Object> other, groovy.lang.Closure<V> closure)
          Merges channels together as inputs for a single dataflow operator.
<V> DataflowReadChannel<V>
merge(java.util.Map<java.lang.String,java.lang.Object> params, java.util.List<DataflowReadChannel<java.lang.Object>> others, groovy.lang.Closure<V> closure)
          Merges channels together as inputs for a single dataflow operator.
<V> DataflowReadChannel<V>
merge(PGroup group, DataflowReadChannel<java.lang.Object> other, groovy.lang.Closure<V> closure)
          Merges channels together as inputs for a single dataflow operator.
<V> DataflowReadChannel<V>
merge(PGroup group, java.util.List<DataflowReadChannel<java.lang.Object>> others, groovy.lang.Closure<V> closure)
          Merges channels together as inputs for a single dataflow operator.
<V> DataflowReadChannel<V>
merge(PGroup group, java.util.Map<java.lang.String,java.lang.Object> params, DataflowReadChannel<java.lang.Object> other, groovy.lang.Closure<V> closure)
          Merges channels together as inputs for a single dataflow operator.
<V> DataflowReadChannel<V>
merge(PGroup group, java.util.Map<java.lang.String,java.lang.Object> params, java.util.List<DataflowReadChannel<java.lang.Object>> others, groovy.lang.Closure<V> closure)
          Merges channels together as inputs for a single dataflow operator.
<V> DataflowReadChannel<V>
merge(Pool pool, DataflowReadChannel<java.lang.Object> other, groovy.lang.Closure<V> closure)
          Merges channels together as inputs for a single dataflow operator.
<V> DataflowReadChannel<V>
merge(Pool pool, java.util.List<DataflowReadChannel<java.lang.Object>> others, groovy.lang.Closure<V> closure)
          Merges channels together as inputs for a single dataflow operator.
<V> DataflowReadChannel<V>
merge(Pool pool, java.util.Map<java.lang.String,java.lang.Object> params, DataflowReadChannel<java.lang.Object> other, groovy.lang.Closure<V> closure)
          Merges channels together as inputs for a single dataflow operator.
<V> DataflowReadChannel<V>
merge(Pool pool, java.util.Map<java.lang.String,java.lang.Object> params, java.util.List<DataflowReadChannel<java.lang.Object>> others, groovy.lang.Closure<V> closure)
          Merges channels together as inputs for a single dataflow operator.
private  void moveAsyncHead()
           
private  void moveHead()
           
<V> DataflowReadChannel<V>
or(groovy.lang.Closure<V> closure)
          Creates and attaches a new operator processing values from the channel
 void or(DataflowWriteChannel<T> target)
          Makes the output of the current channel to be an input for the specified channel
 DataflowExpression<T> poll()
          Retrieves the value at the head of the buffer.
<V> Promise<V>
rightShift(groovy.lang.Closure<V> closure)
          Schedule closure to be executed after data became available.
 void separate(java.util.List<DataflowWriteChannel<?>> outputs, groovy.lang.Closure<java.util.List<java.lang.Object>> code)
          Allows the closure to output different values to different output channels.
 void separate(java.util.Map<java.lang.String,java.lang.Object> params, java.util.List<DataflowWriteChannel<?>> outputs, groovy.lang.Closure<java.util.List<java.lang.Object>> code)
          Allows the closure to output different values to different output channels.
 void separate(PGroup group, java.util.List<DataflowWriteChannel<?>> outputs, groovy.lang.Closure<java.util.List<java.lang.Object>> code)
          Allows the closure to output different values to different output channels.
 void separate(PGroup group, java.util.Map<java.lang.String,java.lang.Object> params, java.util.List<DataflowWriteChannel<?>> outputs, groovy.lang.Closure<java.util.List<java.lang.Object>> code)
          Allows the closure to output different values to different output channels.
 void separate(Pool pool, java.util.List<DataflowWriteChannel<?>> outputs, groovy.lang.Closure<java.util.List<java.lang.Object>> code)
          Allows the closure to output different values to different output channels.
 void separate(Pool pool, java.util.Map<java.lang.String,java.lang.Object> params, java.util.List<DataflowWriteChannel<?>> outputs, groovy.lang.Closure<java.util.List<java.lang.Object>> code)
          Allows the closure to output different values to different output channels.
private  boolean shouldReportTimeout()
           
 void split(DataflowWriteChannel<T> target1, DataflowWriteChannel<T> target2)
          Splits the output of the current channel to be an input for the specified channels
 void split(java.util.List<DataflowWriteChannel<T>> targets)
          Makes the output of the current channel to be an input for the specified channels
 void split(java.util.Map<java.lang.String,java.lang.Object> params, DataflowWriteChannel<T> target1, DataflowWriteChannel<T> target2)
          Splits the output of the current channel to be an input for the specified channels
 void split(java.util.Map<java.lang.String,java.lang.Object> params, java.util.List<DataflowWriteChannel<T>> targets)
          Makes the output of the current channel to be an input for the specified channels
 void split(PGroup group, DataflowWriteChannel<T> target1, DataflowWriteChannel<T> target2)
          Splits the output of the current channel to be an input for the specified channels
 void split(PGroup group, java.util.List<DataflowWriteChannel<T>> targets)
          Makes the output of the current channel to be an input for the specified channels
 void split(PGroup group, java.util.Map<java.lang.String,java.lang.Object> params, DataflowWriteChannel<T> target1, DataflowWriteChannel<T> target2)
          Splits the output of the current channel to be an input for the specified channels
 void split(PGroup group, java.util.Map<java.lang.String,java.lang.Object> params, java.util.List<DataflowWriteChannel<T>> targets)
          Makes the output of the current channel to be an input for the specified channels
 void split(Pool pool, DataflowWriteChannel<T> target1, DataflowWriteChannel<T> target2)
          Splits the output of the current channel to be an input for the specified channels
 void split(Pool pool, java.util.List<DataflowWriteChannel<T>> targets)
          Makes the output of the current channel to be an input for the specified channels
 void split(Pool pool, java.util.Map<java.lang.String,java.lang.Object> params, DataflowWriteChannel<T> target1, DataflowWriteChannel<T> target2)
          Splits the output of the current channel to be an input for the specified channels
 void split(Pool pool, java.util.Map<java.lang.String,java.lang.Object> params, java.util.List<DataflowWriteChannel<T>> targets)
          Makes the output of the current channel to be an input for the specified channels
 DataflowReadChannel<T> tap(DataflowWriteChannel<T> target)
          Taps into the pipeline.
 DataflowReadChannel<T> tap(java.util.Map<java.lang.String,java.lang.Object> params, DataflowWriteChannel<T> target)
          Taps into the pipeline.
 DataflowReadChannel<T> tap(PGroup group, DataflowWriteChannel<T> target)
          Taps into the pipeline.
 DataflowReadChannel<T> tap(PGroup group, java.util.Map<java.lang.String,java.lang.Object> params, DataflowWriteChannel<T> target)
          Taps into the pipeline.
 DataflowReadChannel<T> tap(Pool pool, DataflowWriteChannel<T> target)
          Taps into the pipeline.
 DataflowReadChannel<T> tap(Pool pool, java.util.Map<java.lang.String,java.lang.Object> params, DataflowWriteChannel<T> target)
          Taps into the pipeline.
<V> Promise<V>
then(groovy.lang.Closure<V> closure)
          Schedule closure to be executed after data became available.
<V> Promise<V>
then(PGroup group, groovy.lang.Closure<V> closure)
          Schedule closure to be executed after data becomes available.
<V> Promise<V>
then(Pool pool, groovy.lang.Closure<V> closure)
          Schedule closure to be executed after data becomes available.
 java.lang.String toString()
           
<V> void
whenBound(groovy.lang.Closure<V> closure)
          Schedule closure to be executed after data becomes available.
 void whenBound(MessageStream stream)
          Send the bound data to provided stream when it becomes available
<V> void
whenBound(PGroup group, groovy.lang.Closure<V> closure)
          Schedule closure to be executed after data becomes available.
<V> void
whenBound(Pool pool, groovy.lang.Closure<V> closure)
          Schedule closure to be executed by pooled actor after data becomes available.
<V> void
wheneverBound(groovy.lang.Closure<V> closure)
          Send all pieces of data bound in the future to the provided stream when it becomes available
 void wheneverBound(MessageStream stream)
          Send all pieces of data bound in the future to the provided stream when it becomes available.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

head

private StreamCore<T> head

asyncHead

private StreamCore<T> asyncHead

eventManager

private volatile DataflowChannelEventOrchestrator<T> eventManager
Constructor Detail

DataflowStreamReadAdapter

public DataflowStreamReadAdapter(StreamCore<T> stream)
Creates a new adapter

Parameters:
stream - The stream to wrap
Method Detail

iterator

public java.util.Iterator<T> iterator()

toString

public final java.lang.String toString()
Overrides:
toString in class java.lang.Object

getVal

public T getVal()
         throws java.lang.InterruptedException
Description copied from interface: DataflowReadChannel
Reads the current value of the channel. Blocks, if the value has not been assigned yet.

Specified by:
getVal in interface DataflowReadChannel<T>
Returns:
The actual value
Throws:
java.lang.InterruptedException - If the current thread gets interrupted while waiting for the channel to be bound

getVal

public T getVal(long timeout,
                java.util.concurrent.TimeUnit units)
         throws java.lang.InterruptedException
Description copied from interface: DataflowReadChannel
Reads the current value of the channel. Blocks up to given timeout, if the value has not been assigned yet.

Specified by:
getVal in interface DataflowReadChannel<T>
Parameters:
timeout - The timeout value
units - Units for the timeout
Returns:
The actual value
Throws:
java.lang.InterruptedException - If the current thread gets interrupted while waiting for the channel to be bound

shouldReportTimeout

private boolean shouldReportTimeout()

getValAsync

public void getValAsync(MessageStream callback)
Description copied from interface: DataflowReadChannel
Asynchronously retrieves the value from the channel. Sends the actual value of the channel as a message back the the supplied actor once the value has been bound. The actor can perform other activities or release a thread back to the pool by calling react() waiting for the message with the value of the Dataflow channel.

Specified by:
getValAsync in interface DataflowReadChannel<T>
Parameters:
callback - An actor to send the bound value to.

getValAsync

public void getValAsync(java.lang.Object attachment,
                        MessageStream callback)
Description copied from interface: DataflowReadChannel
Asynchronously retrieves the value from the channel. Sends a message back the the supplied MessageStream with a map holding the supplied attachment under the 'attachment' key and the actual value of the channel under the 'result' key once the value has been bound. Attachment is an arbitrary value helping the actor.operator match its request with the reply. The actor/operator can perform other activities or release a thread back to the pool by calling react() waiting for the message with the value of the Dataflow channel.

Specified by:
getValAsync in interface DataflowReadChannel<T>
Parameters:
attachment - arbitrary non-null attachment if reader needs better identification of result
callback - An actor to send the bound value plus the supplied index to.

rightShift

public <V> Promise<V> rightShift(groovy.lang.Closure<V> closure)
Description copied from interface: DataflowReadChannel
Schedule closure to be executed after data became available. It is important to notice that even if the expression is already bound the execution of closure will not happen immediately but will be scheduled

rightShift() redefines the >> operator so you can write df >> {println it} instead of df.whenBound{println it}

Specified by:
rightShift in interface DataflowReadChannel<T>
Parameters:
closure - closure to execute when data becomes available. The closure should take at most one argument.
Returns:
A promise for the results of the supplied closure. This allows for chaining of then() method calls.

whenBound

public <V> void whenBound(groovy.lang.Closure<V> closure)
Description copied from interface: DataflowReadChannel
Schedule closure to be executed after data becomes available. It is important to notice that even if the expression is already bound the execution of closure will not happen immediately but will be scheduled.

Specified by:
whenBound in interface DataflowReadChannel<T>
Parameters:
closure - closure to execute when data becomes available. The closure should take at most one argument.

whenBound

public <V> void whenBound(Pool pool,
                          groovy.lang.Closure<V> closure)
Schedule closure to be executed by pooled actor after data becomes available. It is important to notice that even if the expression is already bound the execution of closure will not happen immediately but will be scheduled.

Specified by:
whenBound in interface DataflowReadChannel<T>
Parameters:
pool - The thread pool to use for task scheduling for asynchronous message delivery
closure - closure to execute when data becomes available. The closure should take at most one argument.

whenBound

public <V> void whenBound(PGroup group,
                          groovy.lang.Closure<V> closure)
Description copied from interface: DataflowReadChannel
Schedule closure to be executed after data becomes available. It is important to notice that even if the expression is already bound the execution of closure will not happen immediately but will be scheduled.

Specified by:
whenBound in interface DataflowReadChannel<T>
Parameters:
group - The PGroup to use for task scheduling for asynchronous message delivery
closure - closure to execute when data becomes available. The closure should take at most one argument.

whenBound

public void whenBound(MessageStream stream)
Description copied from interface: DataflowReadChannel
Send the bound data to provided stream when it becomes available

Specified by:
whenBound in interface DataflowReadChannel<T>
Parameters:
stream - stream where to send result

then

public final <V> Promise<V> then(groovy.lang.Closure<V> closure)
Schedule closure to be executed after data became available. It is important to notice that even if the expression is already bound the execution of closure will not happen immediately but will be scheduled

Specified by:
then in interface DataflowReadChannel<T>
Parameters:
closure - closure to execute when data becomes available. The closure should take at most one argument.
Returns:
A promise for the results of the supplied closure. This allows for chaining of then() method calls.

then

public <V> Promise<V> then(Pool pool,
                           groovy.lang.Closure<V> closure)
Schedule closure to be executed after data becomes available. It is important to notice that even if the expression is already bound the execution of closure will not happen immediately but will be scheduled.

Specified by:
then in interface DataflowReadChannel<T>
Parameters:
pool - The thread pool to use for task scheduling for asynchronous message delivery
closure - closure to execute when data becomes available. The closure should take at most one argument.
Returns:
A promise for the results of the supplied closure. This allows for chaining of then() method calls.

then

public <V> Promise<V> then(PGroup group,
                           groovy.lang.Closure<V> closure)
Schedule closure to be executed after data becomes available. It is important to notice that even if the expression is already bound the execution of closure will not happen immediately but will be scheduled.

Specified by:
then in interface DataflowReadChannel<T>
Parameters:
group - The PGroup to use for task scheduling for asynchronous message delivery
closure - closure to execute when data becomes available. The closure should take at most one argument.
Returns:
A promise for the results of the supplied closure. This allows for chaining of then() method calls.

wheneverBound

public <V> void wheneverBound(groovy.lang.Closure<V> closure)
Description copied from interface: DataflowReadChannel
Send all pieces of data bound in the future to the provided stream when it becomes available. *

Specified by:
wheneverBound in interface DataflowReadChannel<T>
Parameters:
closure - closure to execute when data becomes available. The closure should take at most one argument.

wheneverBound

public void wheneverBound(MessageStream stream)
Description copied from interface: DataflowReadChannel
Send all pieces of data bound in the future to the provided stream when it becomes available.

Specified by:
wheneverBound in interface DataflowReadChannel<T>
Parameters:
stream - stream where to send result

chainWith

public final <V> DataflowReadChannel<V> chainWith(groovy.lang.Closure<V> closure)
Description copied from interface: DataflowReadChannel
Creates and attaches a new operator processing values from the channel

Specified by:
chainWith in interface DataflowReadChannel<T>
Type Parameters:
V - The type of values returned from the supplied closure
Parameters:
closure - The function to invoke on all incoming values as part of the new operator's body
Returns:
A channel of the same type as this channel, which the new operator will output into.

chainWith

public final <V> DataflowReadChannel<V> chainWith(Pool pool,
                                                  groovy.lang.Closure<V> closure)
Description copied from interface: DataflowReadChannel
Creates and attaches a new operator processing values from the channel

Specified by:
chainWith in interface DataflowReadChannel<T>
Type Parameters:
V - The type of values returned from the supplied closure
Parameters:
pool - The thread pool to use
closure - The function to invoke on all incoming values as part of the new operator's body
Returns:
A channel of the same type as this channel, which the new operator will output into.

chainWith

public <V> DataflowReadChannel<V> chainWith(PGroup group,
                                            groovy.lang.Closure<V> closure)
Description copied from interface: DataflowReadChannel
Creates and attaches a new operator processing values from the channel

Specified by:
chainWith in interface DataflowReadChannel<T>
Type Parameters:
V - The type of values returned from the supplied closure
Parameters:
group - The PGroup to use
closure - The function to invoke on all incoming values as part of the new operator's body
Returns:
A channel of the same type as this channel, which the new operator will output into.

chainWith

public final <V> DataflowReadChannel<V> chainWith(java.util.Map<java.lang.String,java.lang.Object> params,
                                                  groovy.lang.Closure<V> closure)
Description copied from interface: DataflowReadChannel
Creates and attaches a new operator processing values from the channel

Specified by:
chainWith in interface DataflowReadChannel<T>
Type Parameters:
V - The type of values returned from the supplied closure
Parameters:
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
Returns:
A channel of the same type as this channel, which the new operator will output into.

chainWith

public final <V> DataflowReadChannel<V> chainWith(Pool pool,
                                                  java.util.Map<java.lang.String,java.lang.Object> params,
                                                  groovy.lang.Closure<V> closure)
Description copied from interface: DataflowReadChannel
Creates and attaches a new operator processing values from the channel

Specified by:
chainWith in interface DataflowReadChannel<T>
Type Parameters:
V - The type of values returned from the supplied closure
Parameters:
pool - The thread pool to use
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
Returns:
A channel of the same type as this channel, which the new operator will output into.

chainWith

public <V> DataflowReadChannel<V> chainWith(PGroup group,
                                            java.util.Map<java.lang.String,java.lang.Object> params,
                                            groovy.lang.Closure<V> closure)
Description copied from interface: DataflowReadChannel
Creates and attaches a new operator processing values from the channel

Specified by:
chainWith in interface DataflowReadChannel<T>
Type Parameters:
V - The type of values returned from the supplied closure
Parameters:
group - The PGroup to use
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
Returns:
A channel of the same type as this channel, which the new operator will output into.

or

public <V> DataflowReadChannel<V> or(groovy.lang.Closure<V> closure)
Description copied from interface: DataflowReadChannel
Creates and attaches a new operator processing values from the channel

Specified by:
or in interface DataflowReadChannel<T>
Type Parameters:
V - The type of values returned from the supplied closure
Parameters:
closure - The function to invoke on all incoming values as part of the new operator's body
Returns:
A channel of the same type as this channel, which the new operator will output into.

filter

public DataflowReadChannel<T> filter(groovy.lang.Closure<java.lang.Boolean> closure)
Description copied from interface: DataflowReadChannel
Creates and attaches a new operator that will filter data using the provided closure

Specified by:
filter in interface DataflowReadChannel<T>
Parameters:
closure - The filter function to invoke on all incoming values to decide whether to pass the value on or not
Returns:
A channel of the same type as this channel, which the new operator will output into.

filter

public DataflowReadChannel<T> filter(Pool pool,
                                     groovy.lang.Closure<java.lang.Boolean> closure)
Description copied from interface: DataflowReadChannel
Creates and attaches a new operator that will filter data using the provided closure

Specified by:
filter in interface DataflowReadChannel<T>
Parameters:
pool - The thread pool to use
closure - The filter function to invoke on all incoming values to decide whether to pass the value on or not
Returns:
A channel of the same type as this channel, which the new operator will output into.

filter

public DataflowReadChannel<T> filter(PGroup group,
                                     groovy.lang.Closure<java.lang.Boolean> closure)
Description copied from interface: DataflowReadChannel
Creates and attaches a new operator that will filter data using the provided closure

Specified by:
filter in interface DataflowReadChannel<T>
Parameters:
group - The PGroup to use
closure - The filter function to invoke on all incoming values to decide whether to pass the value on or not
Returns:
A channel of the same type as this channel, which the new operator will output into.

filter

public DataflowReadChannel<T> filter(java.util.Map<java.lang.String,java.lang.Object> params,
                                     groovy.lang.Closure<java.lang.Boolean> closure)
Description copied from interface: DataflowReadChannel
Creates and attaches a new operator that will filter data using the provided closure

Specified by:
filter in interface DataflowReadChannel<T>
Parameters:
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
Returns:
A channel of the same type as this channel, which the new operator will output into.

filter

public DataflowReadChannel<T> filter(Pool pool,
                                     java.util.Map<java.lang.String,java.lang.Object> params,
                                     groovy.lang.Closure<java.lang.Boolean> closure)
Description copied from interface: DataflowReadChannel
Creates and attaches a new operator that will filter data using the provided closure

Specified by:
filter in interface DataflowReadChannel<T>
Parameters:
pool - The thread pool to use
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
Returns:
A channel of the same type as this channel, which the new operator will output into.

filter

public DataflowReadChannel<T> filter(PGroup group,
                                     java.util.Map<java.lang.String,java.lang.Object> params,
                                     groovy.lang.Closure<java.lang.Boolean> closure)
Description copied from interface: DataflowReadChannel
Creates and attaches a new operator that will filter data using the provided closure

Specified by:
filter in interface DataflowReadChannel<T>
Parameters:
group - The PGroup to use
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
Returns:
A channel of the same type as this channel, which the new operator will output into.

into

public void into(DataflowWriteChannel<T> target)
Description copied from interface: DataflowReadChannel
Makes the output of the current channel to be an input for the specified channel

Specified by:
into in interface DataflowReadChannel<T>
Parameters:
target - The channel to copy data into

into

public void into(Pool pool,
                 DataflowWriteChannel<T> target)
Description copied from interface: DataflowReadChannel
Makes the output of the current channel to be an input for the specified channel

Specified by:
into in interface DataflowReadChannel<T>
Parameters:
pool - The thread pool to use
target - The channel to copy data into

into

public void into(PGroup group,
                 DataflowWriteChannel<T> target)
Description copied from interface: DataflowReadChannel
Makes the output of the current channel to be an input for the specified channel

Specified by:
into in interface DataflowReadChannel<T>
Parameters:
group - The PGroup to use
target - The channel to copy data into

into

public void into(java.util.Map<java.lang.String,java.lang.Object> params,
                 DataflowWriteChannel<T> target)
Description copied from interface: DataflowReadChannel
Makes the output of the current channel to be an input for the specified channel

Specified by:
into in interface DataflowReadChannel<T>
Parameters:
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
target - The channel to copy data into

into

public void into(Pool pool,
                 java.util.Map<java.lang.String,java.lang.Object> params,
                 DataflowWriteChannel<T> target)
Description copied from interface: DataflowReadChannel
Makes the output of the current channel to be an input for the specified channel

Specified by:
into in interface DataflowReadChannel<T>
Parameters:
pool - The thread pool to use
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
target - The channel to copy data into

into

public void into(PGroup group,
                 java.util.Map<java.lang.String,java.lang.Object> params,
                 DataflowWriteChannel<T> target)
Description copied from interface: DataflowReadChannel
Makes the output of the current channel to be an input for the specified channel

Specified by:
into in interface DataflowReadChannel<T>
Parameters:
group - The PGroup to use
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
target - The channel to copy data into

or

public void or(DataflowWriteChannel<T> target)
Description copied from interface: DataflowReadChannel
Makes the output of the current channel to be an input for the specified channel

Specified by:
or in interface DataflowReadChannel<T>
Parameters:
target - The channel to copy data into

split

public void split(DataflowWriteChannel<T> target1,
                  DataflowWriteChannel<T> target2)
Description copied from interface: DataflowReadChannel
Splits the output of the current channel to be an input for the specified channels

Specified by:
split in interface DataflowReadChannel<T>
Parameters:
target1 - The first channel to copy data into
target2 - The second channel to copy data into

split

public void split(Pool pool,
                  DataflowWriteChannel<T> target1,
                  DataflowWriteChannel<T> target2)
Description copied from interface: DataflowReadChannel
Splits the output of the current channel to be an input for the specified channels

Specified by:
split in interface DataflowReadChannel<T>
Parameters:
pool - The thread pool to use
target1 - The first channel to copy data into
target2 - The second channel to copy data into

split

public void split(PGroup group,
                  DataflowWriteChannel<T> target1,
                  DataflowWriteChannel<T> target2)
Description copied from interface: DataflowReadChannel
Splits the output of the current channel to be an input for the specified channels

Specified by:
split in interface DataflowReadChannel<T>
Parameters:
group - The PGroup to use
target1 - The first channel to copy data into
target2 - The second channel to copy data into

split

public void split(java.util.List<DataflowWriteChannel<T>> targets)
Description copied from interface: DataflowReadChannel
Makes the output of the current channel to be an input for the specified channels

Specified by:
split in interface DataflowReadChannel<T>
Parameters:
targets - The channels to copy data into

split

public void split(Pool pool,
                  java.util.List<DataflowWriteChannel<T>> targets)
Description copied from interface: DataflowReadChannel
Makes the output of the current channel to be an input for the specified channels

Specified by:
split in interface DataflowReadChannel<T>
Parameters:
pool - The thread pool to use
targets - The channels to copy data into

split

public void split(PGroup group,
                  java.util.List<DataflowWriteChannel<T>> targets)
Description copied from interface: DataflowReadChannel
Makes the output of the current channel to be an input for the specified channels

Specified by:
split in interface DataflowReadChannel<T>
Parameters:
group - The PGroup to use
targets - The channels to copy data into

split

public void split(java.util.Map<java.lang.String,java.lang.Object> params,
                  DataflowWriteChannel<T> target1,
                  DataflowWriteChannel<T> target2)
Description copied from interface: DataflowReadChannel
Splits the output of the current channel to be an input for the specified channels

Specified by:
split in interface DataflowReadChannel<T>
Parameters:
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
target1 - The first channel to copy data into
target2 - The second channel to copy data into

split

public void split(Pool pool,
                  java.util.Map<java.lang.String,java.lang.Object> params,
                  DataflowWriteChannel<T> target1,
                  DataflowWriteChannel<T> target2)
Description copied from interface: DataflowReadChannel
Splits the output of the current channel to be an input for the specified channels

Specified by:
split in interface DataflowReadChannel<T>
Parameters:
pool - The thread pool to use
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
target1 - The first channel to copy data into
target2 - The second channel to copy data into

split

public void split(PGroup group,
                  java.util.Map<java.lang.String,java.lang.Object> params,
                  DataflowWriteChannel<T> target1,
                  DataflowWriteChannel<T> target2)
Description copied from interface: DataflowReadChannel
Splits the output of the current channel to be an input for the specified channels

Specified by:
split in interface DataflowReadChannel<T>
Parameters:
group - The PGroup to use
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
target1 - The first channel to copy data into
target2 - The second channel to copy data into

split

public void split(java.util.Map<java.lang.String,java.lang.Object> params,
                  java.util.List<DataflowWriteChannel<T>> targets)
Description copied from interface: DataflowReadChannel
Makes the output of the current channel to be an input for the specified channels

Specified by:
split in interface DataflowReadChannel<T>
Parameters:
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
targets - The channels to copy data into

split

public void split(Pool pool,
                  java.util.Map<java.lang.String,java.lang.Object> params,
                  java.util.List<DataflowWriteChannel<T>> targets)
Description copied from interface: DataflowReadChannel
Makes the output of the current channel to be an input for the specified channels

Specified by:
split in interface DataflowReadChannel<T>
Parameters:
pool - The thread pool to use
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
targets - The channels to copy data into

split

public void split(PGroup group,
                  java.util.Map<java.lang.String,java.lang.Object> params,
                  java.util.List<DataflowWriteChannel<T>> targets)
Description copied from interface: DataflowReadChannel
Makes the output of the current channel to be an input for the specified channels

Specified by:
split in interface DataflowReadChannel<T>
Parameters:
group - The PGroup to use
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
targets - The channels to copy data into

tap

public DataflowReadChannel<T> tap(DataflowWriteChannel<T> target)
Description copied from interface: DataflowReadChannel
Taps into the pipeline. The supplied channel will receive a copy of all messages passed through.

Specified by:
tap in interface DataflowReadChannel<T>
Parameters:
target - The channel to tap data into
Returns:
A channel of the same type as this channel, which the new operator will output into.

tap

public DataflowReadChannel<T> tap(Pool pool,
                                  DataflowWriteChannel<T> target)
Description copied from interface: DataflowReadChannel
Taps into the pipeline. The supplied channel will receive a copy of all messages passed through.

Specified by:
tap in interface DataflowReadChannel<T>
Parameters:
pool - The thread pool to use
target - The channel to tap data into
Returns:
A channel of the same type as this channel, which the new operator will output into.

tap

public DataflowReadChannel<T> tap(PGroup group,
                                  DataflowWriteChannel<T> target)
Description copied from interface: DataflowReadChannel
Taps into the pipeline. The supplied channel will receive a copy of all messages passed through.

Specified by:
tap in interface DataflowReadChannel<T>
Parameters:
group - The PGroup to use
target - The channel to tap data into
Returns:
A channel of the same type as this channel, which the new operator will output into.

tap

public DataflowReadChannel<T> tap(java.util.Map<java.lang.String,java.lang.Object> params,
                                  DataflowWriteChannel<T> target)
Description copied from interface: DataflowReadChannel
Taps into the pipeline. The supplied channel will receive a copy of all messages passed through.

Specified by:
tap in interface DataflowReadChannel<T>
Parameters:
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
target - The channel to tap data into
Returns:
A channel of the same type as this channel, which the new operator will output into.

tap

public DataflowReadChannel<T> tap(Pool pool,
                                  java.util.Map<java.lang.String,java.lang.Object> params,
                                  DataflowWriteChannel<T> target)
Description copied from interface: DataflowReadChannel
Taps into the pipeline. The supplied channel will receive a copy of all messages passed through.

Specified by:
tap in interface DataflowReadChannel<T>
Parameters:
pool - The thread pool to use
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
target - The channel to tap data into
Returns:
A channel of the same type as this channel, which the new operator will output into.

tap

public DataflowReadChannel<T> tap(PGroup group,
                                  java.util.Map<java.lang.String,java.lang.Object> params,
                                  DataflowWriteChannel<T> target)
Description copied from interface: DataflowReadChannel
Taps into the pipeline. The supplied channel will receive a copy of all messages passed through.

Specified by:
tap in interface DataflowReadChannel<T>
Parameters:
group - The PGroup to use
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
target - The channel to tap data into
Returns:
A channel of the same type as this channel, which the new operator will output into.

merge

public <V> DataflowReadChannel<V> merge(DataflowReadChannel<java.lang.Object> other,
                                        groovy.lang.Closure<V> closure)
Description copied from interface: DataflowReadChannel
Merges channels together as inputs for a single dataflow operator.

Specified by:
merge in interface DataflowReadChannel<T>
Type Parameters:
V - The type of values passed between the channels
Parameters:
other - The channel to merge with
closure - 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.
Returns:
A channel of the same type as this channel, which the new operator will output into.

merge

public <V> DataflowReadChannel<V> merge(Pool pool,
                                        DataflowReadChannel<java.lang.Object> other,
                                        groovy.lang.Closure<V> closure)
Description copied from interface: DataflowReadChannel
Merges channels together as inputs for a single dataflow operator.

Specified by:
merge in interface DataflowReadChannel<T>
Type Parameters:
V - The type of values passed between the channels
Parameters:
pool - The thread pool to use
other - The channel to merge with
closure - 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.
Returns:
A channel of the same type as this channel, which the new operator will output into.

merge

public <V> DataflowReadChannel<V> merge(PGroup group,
                                        DataflowReadChannel<java.lang.Object> other,
                                        groovy.lang.Closure<V> closure)
Description copied from interface: DataflowReadChannel
Merges channels together as inputs for a single dataflow operator.

Specified by:
merge in interface DataflowReadChannel<T>
Type Parameters:
V - The type of values passed between the channels
Parameters:
group - The PGroup to use
other - The channel to merge with
closure - 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.
Returns:
A channel of the same type as this channel, which the new operator will output into.

merge

public <V> DataflowReadChannel<V> merge(java.util.List<DataflowReadChannel<java.lang.Object>> others,
                                        groovy.lang.Closure<V> closure)
Description copied from interface: DataflowReadChannel
Merges channels together as inputs for a single dataflow operator.

Specified by:
merge in interface DataflowReadChannel<T>
Type Parameters:
V - The type of values passed between the channels
Parameters:
others - The channels to merge with
closure - 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.
Returns:
A channel of the same type as this channel, which the new operator will output into.

merge

public <V> DataflowReadChannel<V> merge(Pool pool,
                                        java.util.List<DataflowReadChannel<java.lang.Object>> others,
                                        groovy.lang.Closure<V> closure)
Description copied from interface: DataflowReadChannel
Merges channels together as inputs for a single dataflow operator.

Specified by:
merge in interface DataflowReadChannel<T>
Type Parameters:
V - The type of values passed between the channels
Parameters:
pool - The thread pool to use
others - The channels to merge with
closure - 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.
Returns:
A channel of the same type as this channel, which the new operator will output into.

merge

public <V> DataflowReadChannel<V> merge(PGroup group,
                                        java.util.List<DataflowReadChannel<java.lang.Object>> others,
                                        groovy.lang.Closure<V> closure)
Description copied from interface: DataflowReadChannel
Merges channels together as inputs for a single dataflow operator.

Specified by:
merge in interface DataflowReadChannel<T>
Type Parameters:
V - The type of values passed between the channels
Parameters:
group - The PGroup to use
others - The channels to merge with
closure - 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.
Returns:
A channel of the same type as this channel, which the new operator will output into.

merge

public <V> DataflowReadChannel<V> merge(java.util.Map<java.lang.String,java.lang.Object> params,
                                        DataflowReadChannel<java.lang.Object> other,
                                        groovy.lang.Closure<V> closure)
Description copied from interface: DataflowReadChannel
Merges channels together as inputs for a single dataflow operator.

Specified by:
merge in interface DataflowReadChannel<T>
Type Parameters:
V - The type of values passed between the channels
Parameters:
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
other - The channel to merge with
closure - 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.
Returns:
A channel of the same type as this channel, which the new operator will output into.

merge

public <V> DataflowReadChannel<V> merge(Pool pool,
                                        java.util.Map<java.lang.String,java.lang.Object> params,
                                        DataflowReadChannel<java.lang.Object> other,
                                        groovy.lang.Closure<V> closure)
Description copied from interface: DataflowReadChannel
Merges channels together as inputs for a single dataflow operator.

Specified by:
merge in interface DataflowReadChannel<T>
Type Parameters:
V - The type of values passed between the channels
Parameters:
pool - The thread pool to use
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
other - The channel to merge with
closure - 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.
Returns:
A channel of the same type as this channel, which the new operator will output into.

merge

public <V> DataflowReadChannel<V> merge(PGroup group,
                                        java.util.Map<java.lang.String,java.lang.Object> params,
                                        DataflowReadChannel<java.lang.Object> other,
                                        groovy.lang.Closure<V> closure)
Description copied from interface: DataflowReadChannel
Merges channels together as inputs for a single dataflow operator.

Specified by:
merge in interface DataflowReadChannel<T>
Type Parameters:
V - The type of values passed between the channels
Parameters:
group - The PGroup to use
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
other - The channel to merge with
closure - 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.
Returns:
A channel of the same type as this channel, which the new operator will output into.

merge

public <V> DataflowReadChannel<V> merge(java.util.Map<java.lang.String,java.lang.Object> params,
                                        java.util.List<DataflowReadChannel<java.lang.Object>> others,
                                        groovy.lang.Closure<V> closure)
Description copied from interface: DataflowReadChannel
Merges channels together as inputs for a single dataflow operator.

Specified by:
merge in interface DataflowReadChannel<T>
Type Parameters:
V - The type of values passed between the channels
Parameters:
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
others - The channels to merge with
closure - 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.
Returns:
A channel of the same type as this channel, which the new operator will output into.

merge

public <V> DataflowReadChannel<V> merge(Pool pool,
                                        java.util.Map<java.lang.String,java.lang.Object> params,
                                        java.util.List<DataflowReadChannel<java.lang.Object>> others,
                                        groovy.lang.Closure<V> closure)
Description copied from interface: DataflowReadChannel
Merges channels together as inputs for a single dataflow operator.

Specified by:
merge in interface DataflowReadChannel<T>
Type Parameters:
V - The type of values passed between the channels
Parameters:
pool - The thread pool to use
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
others - The channels to merge with
closure - 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.
Returns:
A channel of the same type as this channel, which the new operator will output into.

merge

public <V> DataflowReadChannel<V> merge(PGroup group,
                                        java.util.Map<java.lang.String,java.lang.Object> params,
                                        java.util.List<DataflowReadChannel<java.lang.Object>> others,
                                        groovy.lang.Closure<V> closure)
Description copied from interface: DataflowReadChannel
Merges channels together as inputs for a single dataflow operator.

Specified by:
merge in interface DataflowReadChannel<T>
Type Parameters:
V - The type of values passed between the channels
Parameters:
group - The PGroup to use
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
others - The channels to merge with
closure - 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.
Returns:
A channel of the same type as this channel, which the new operator will output into.

binaryChoice

public void binaryChoice(DataflowWriteChannel<T> trueBranch,
                         DataflowWriteChannel<T> falseBranch,
                         groovy.lang.Closure<java.lang.Boolean> code)
Description copied from interface: DataflowReadChannel
Directs the output to one of the two output channels depending on the boolean result of the provided closure.

Specified by:
binaryChoice in interface DataflowReadChannel<T>
Parameters:
trueBranch - The channel to send data to if the closure returns true
falseBranch - The channel to send data to if the closure returns true
code - A closure directing data to either the true or the false output branch

binaryChoice

public void binaryChoice(Pool pool,
                         DataflowWriteChannel<T> trueBranch,
                         DataflowWriteChannel<T> falseBranch,
                         groovy.lang.Closure<java.lang.Boolean> code)
Description copied from interface: DataflowReadChannel
Directs the output to one of the two output channels depending on the boolean result of the provided closure.

Specified by:
binaryChoice in interface DataflowReadChannel<T>
Parameters:
pool - The thread pool to use
trueBranch - The channel to send data to if the closure returns true
falseBranch - The channel to send data to if the closure returns true
code - A closure directing data to either the true or the false output branch

binaryChoice

public void binaryChoice(PGroup group,
                         DataflowWriteChannel<T> trueBranch,
                         DataflowWriteChannel<T> falseBranch,
                         groovy.lang.Closure<java.lang.Boolean> code)
Description copied from interface: DataflowReadChannel
Directs the output to one of the two output channels depending on the boolean result of the provided closure.

Specified by:
binaryChoice in interface DataflowReadChannel<T>
Parameters:
group - The PGroup to use
trueBranch - The channel to send data to if the closure returns true
falseBranch - The channel to send data to if the closure returns true
code - A closure directing data to either the true or the false output branch

binaryChoice

public void binaryChoice(java.util.Map<java.lang.String,java.lang.Object> params,
                         DataflowWriteChannel<T> trueBranch,
                         DataflowWriteChannel<T> falseBranch,
                         groovy.lang.Closure<java.lang.Boolean> code)
Description copied from interface: DataflowReadChannel
Directs the output to one of the two output channels depending on the boolean result of the provided closure.

Specified by:
binaryChoice in interface DataflowReadChannel<T>
Parameters:
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
trueBranch - The channel to send data to if the closure returns true
falseBranch - The channel to send data to if the closure returns true
code - A closure directing data to either the true or the false output branch

binaryChoice

public void binaryChoice(Pool pool,
                         java.util.Map<java.lang.String,java.lang.Object> params,
                         DataflowWriteChannel<T> trueBranch,
                         DataflowWriteChannel<T> falseBranch,
                         groovy.lang.Closure<java.lang.Boolean> code)
Description copied from interface: DataflowReadChannel
Directs the output to one of the two output channels depending on the boolean result of the provided closure.

Specified by:
binaryChoice in interface DataflowReadChannel<T>
Parameters:
pool - The thread pool to use
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
trueBranch - The channel to send data to if the closure returns true
falseBranch - The channel to send data to if the closure returns true
code - A closure directing data to either the true or the false output branch

binaryChoice

public void binaryChoice(PGroup group,
                         java.util.Map<java.lang.String,java.lang.Object> params,
                         DataflowWriteChannel<T> trueBranch,
                         DataflowWriteChannel<T> falseBranch,
                         groovy.lang.Closure<java.lang.Boolean> code)
Description copied from interface: DataflowReadChannel
Directs the output to one of the two output channels depending on the boolean result of the provided closure.

Specified by:
binaryChoice in interface DataflowReadChannel<T>
Parameters:
group - The PGroup to use
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
trueBranch - The channel to send data to if the closure returns true
falseBranch - The channel to send data to if the closure returns true
code - A closure directing data to either the true or the false output branch

choice

public void choice(java.util.List<DataflowWriteChannel<T>> outputs,
                   groovy.lang.Closure<java.lang.Integer> code)
Description copied from interface: DataflowReadChannel
Directs the output to one of the output channels depending on the int result of the provided closure.

Specified by:
choice in interface DataflowReadChannel<T>
Parameters:
outputs - The channels to send data to of the closure returns true
code - A closure returning an index of the output channel to direct the data to

choice

public void choice(Pool pool,
                   java.util.List<DataflowWriteChannel<T>> outputs,
                   groovy.lang.Closure<java.lang.Integer> code)
Description copied from interface: DataflowReadChannel
Directs the output to one of the output channels depending on the int result of the provided closure.

Specified by:
choice in interface DataflowReadChannel<T>
Parameters:
pool - The thread pool to use
outputs - The channels to send data to.
code - A closure returning an index of the output channel to direct the data to

choice

public void choice(PGroup group,
                   java.util.List<DataflowWriteChannel<T>> outputs,
                   groovy.lang.Closure<java.lang.Integer> code)
Description copied from interface: DataflowReadChannel
Directs the output to one of the output channels depending on the int result of the provided closure.

Specified by:
choice in interface DataflowReadChannel<T>
Parameters:
group - The PGroup to use
outputs - The channels to send data to.
code - A closure returning an index of the output channel to direct the data to

choice

public void choice(java.util.Map<java.lang.String,java.lang.Object> params,
                   java.util.List<DataflowWriteChannel<T>> outputs,
                   groovy.lang.Closure<java.lang.Integer> code)
Description copied from interface: DataflowReadChannel
Directs the output to one of the output channels depending on the int result of the provided closure.

Specified by:
choice in interface DataflowReadChannel<T>
Parameters:
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
outputs - The channels to send data to of the closure returns true
code - A closure returning an index of the output channel to direct the data to

choice

public void choice(Pool pool,
                   java.util.Map<java.lang.String,java.lang.Object> params,
                   java.util.List<DataflowWriteChannel<T>> outputs,
                   groovy.lang.Closure<java.lang.Integer> code)
Description copied from interface: DataflowReadChannel
Directs the output to one of the output channels depending on the int result of the provided closure.

Specified by:
choice in interface DataflowReadChannel<T>
Parameters:
pool - The thread pool to use
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

choice

public void choice(PGroup group,
                   java.util.Map<java.lang.String,java.lang.Object> params,
                   java.util.List<DataflowWriteChannel<T>> outputs,
                   groovy.lang.Closure<java.lang.Integer> code)
Description copied from interface: DataflowReadChannel
Directs the output to one of the output channels depending on the int result of the provided closure.

Specified by:
choice in interface DataflowReadChannel<T>
Parameters:
group - The PGroup to use
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

separate

public void separate(java.util.List<DataflowWriteChannel<?>> outputs,
                     groovy.lang.Closure<java.util.List<java.lang.Object>> code)
Description copied from interface: DataflowReadChannel
Allows the closure to output different values to different output channels.

Specified by:
separate in interface DataflowReadChannel<T>
Parameters:
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.

separate

public void separate(Pool pool,
                     java.util.List<DataflowWriteChannel<?>> outputs,
                     groovy.lang.Closure<java.util.List<java.lang.Object>> code)
Description copied from interface: DataflowReadChannel
Allows the closure to output different values to different output channels.

Specified by:
separate in interface DataflowReadChannel<T>
Parameters:
pool - The thread pool to use
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.

separate

public void separate(PGroup group,
                     java.util.List<DataflowWriteChannel<?>> outputs,
                     groovy.lang.Closure<java.util.List<java.lang.Object>> code)
Description copied from interface: DataflowReadChannel
Allows the closure to output different values to different output channels.

Specified by:
separate in interface DataflowReadChannel<T>
Parameters:
group - The PGroup to use
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.

separate

public void separate(java.util.Map<java.lang.String,java.lang.Object> params,
                     java.util.List<DataflowWriteChannel<?>> outputs,
                     groovy.lang.Closure<java.util.List<java.lang.Object>> code)
Description copied from interface: DataflowReadChannel
Allows the closure to output different values to different output channels.

Specified by:
separate in interface DataflowReadChannel<T>
Parameters:
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.

separate

public void separate(Pool pool,
                     java.util.Map<java.lang.String,java.lang.Object> params,
                     java.util.List<DataflowWriteChannel<?>> outputs,
                     groovy.lang.Closure<java.util.List<java.lang.Object>> code)
Description copied from interface: DataflowReadChannel
Allows the closure to output different values to different output channels.

Specified by:
separate in interface DataflowReadChannel<T>
Parameters:
pool - The thread pool to use
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.

separate

public void separate(PGroup group,
                     java.util.Map<java.lang.String,java.lang.Object> params,
                     java.util.List<DataflowWriteChannel<?>> outputs,
                     groovy.lang.Closure<java.util.List<java.lang.Object>> code)
Description copied from interface: DataflowReadChannel
Allows the closure to output different values to different output channels.

Specified by:
separate in interface DataflowReadChannel<T>
Parameters:
group - The PGroup to use
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.

getEventManager

public DataflowChannelEventListenerManager<T> getEventManager()
Description copied from interface: DataflowReadChannel
Retrieves the event manager object of this channel

Specified by:
getEventManager in interface DataflowReadChannel<T>
Returns:
The event manager to register custom events listeners

fireOnMessage

private void fireOnMessage(T value)

isBound

public boolean isBound()
Description copied from interface: DataflowReadChannel
Check if value has been set already for this expression

Specified by:
isBound in interface DataflowReadChannel<T>
Returns:
true if bound already

length

public int length()
Returns the current size of the buffer

Specified by:
length in interface DataflowReadChannel<T>
Returns:
Number of DFVs in the queue

poll

public DataflowExpression<T> poll()
                           throws java.lang.InterruptedException
Description copied from interface: DataflowReadChannel
Retrieves the value at the head of the buffer. Returns null, if no value is available.

Specified by:
poll in interface DataflowReadChannel<T>
Returns:
The value bound to the DFV at the head of the stream or null
Throws:
java.lang.InterruptedException - If the current thread is interrupted

allUnprocessedDFVs

protected final java.util.List<DataflowVariable<T>> allUnprocessedDFVs()
                                                                throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

moveHead

private void moveHead()

moveAsyncHead

private void moveAsyncHead()

Copyright © 2008–2012 Václav Pech. All Rights Reserved.