groovyx.gpars.dataflow
Interface DataflowReadChannel<T>

All Known Subinterfaces:
DataflowChannel<T>
All Known Implementing Classes:
DataflowComplexExpression, DataflowExpression, DataflowExpression.TransformMany, DataflowExpression.TransformOne, DataflowGetPropertyExpression, DataflowInvocationExpression, DataflowQueue, DataflowStreamReadAdapter, DataflowVariable, DataflowVariable.RemoteDataflowVariable, RemoteDataflowExpression, SyncDataflowQueue, SyncDataflowStreamReadAdapter, SyncDataflowVariable

public interface DataflowReadChannel<T>

A common interface for all dataflow variables, streams or queues

Author:
Vaclav Pech Date: 21st Sep 2010

Method Summary
 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
 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
 int length()
          Reports the current number of elements in the channel
<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.
<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.
 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.
<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 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.
 

Method Detail

getValAsync

void getValAsync(MessageStream callback)
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.

Parameters:
callback - An actor to send the bound value to.

getValAsync

void getValAsync(java.lang.Object attachment,
                 MessageStream callback)
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.

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.

getVal

T getVal()
         throws java.lang.InterruptedException
Reads the current value of the channel. Blocks, if the value has not been assigned yet.

Returns:
The actual value
Throws:
java.lang.InterruptedException - If the current thread gets interrupted while waiting for the channel to be bound

getVal

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

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

rightShift

<V> Promise<V> rightShift(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

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

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

<V> void whenBound(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.

Parameters:
closure - closure to execute when data becomes available. The closure should take at most one argument.

whenBound

<V> void whenBound(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.

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

<V> void whenBound(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.

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

void whenBound(MessageStream stream)
Send the bound data to provided stream when it becomes available

Parameters:
stream - stream where to send result

then

<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

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

<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.

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

<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.

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

<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. *

Parameters:
closure - closure to execute when data becomes available. The closure should take at most one argument.

wheneverBound

void wheneverBound(MessageStream stream)
Send all pieces of data bound in the future to the provided stream when it becomes available.

Parameters:
stream - stream where to send result

chainWith

<V> DataflowReadChannel<V> chainWith(groovy.lang.Closure<V> closure)
Creates and attaches a new operator processing values from the channel

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

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

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

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

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

<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

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

<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

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)
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

<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

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)
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.

or

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

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

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

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

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

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

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

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

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

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

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

Parameters:
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
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

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

Parameters:
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
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.

into

void into(DataflowWriteChannel<T> target)
Makes the output of the current channel to be an input for the specified channel

Parameters:
target - The channel to copy data into

into

void into(Pool pool,
          DataflowWriteChannel<T> target)
Makes the output of the current channel to be an input for the specified channel

Parameters:
pool - The thread pool to use
target - The channel to copy data into

into

void into(PGroup group,
          DataflowWriteChannel<T> target)
Makes the output of the current channel to be an input for the specified channel

Parameters:
group - The PGroup to use
target - The channel to copy data into

into

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

Parameters:
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
target - The channel to copy data into

into

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

Parameters:
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
pool - The thread pool to use
target - The channel to copy data into

into

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

Parameters:
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
group - The PGroup to use
target - The channel to copy data into

or

void or(DataflowWriteChannel<T> target)
Makes the output of the current channel to be an input for the specified channel

Parameters:
target - The channel to copy data into

split

void split(DataflowWriteChannel<T> target1,
           DataflowWriteChannel<T> target2)
Splits the output of the current channel to be an input for the specified channels

Parameters:
target1 - The first channel to copy data into
target2 - The second channel to copy data into

split

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

Parameters:
pool - The thread pool to use
target1 - The first channel to copy data into
target2 - The second channel to copy data into

split

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

Parameters:
group - The PGroup to use
target1 - The first channel to copy data into
target2 - The second channel to copy data into

split

void split(java.util.List<DataflowWriteChannel<T>> targets)
Makes the output of the current channel to be an input for the specified channels

Parameters:
targets - The channels to copy data into

split

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

Parameters:
pool - The thread pool to use
targets - The channels to copy data into

split

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

Parameters:
group - The PGroup to use
targets - The channels to copy data into

split

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

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

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

Parameters:
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
pool - The thread pool to use
target1 - The first channel to copy data into
target2 - The second channel to copy data into

split

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

Parameters:
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
group - The PGroup to use
target1 - The first channel to copy data into
target2 - The second channel to copy data into

split

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

Parameters:
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
targets - The channels to copy data into

split

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

Parameters:
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
pool - The thread pool to use
targets - The channels to copy data into

split

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

Parameters:
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
group - The PGroup to use
targets - The channels to copy data into

tap

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

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

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

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

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

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

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

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

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

Parameters:
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
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

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

Parameters:
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
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.

merge

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

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

<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.

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

<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.

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

<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.

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

<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.

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

<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.

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

<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.

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

<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.

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)
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

<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.

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)
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

<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.

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

<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.

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)
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

<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.

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)
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.

binaryChoice

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.

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

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.

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

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.

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

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.

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

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.

Parameters:
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
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

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.

Parameters:
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
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

choice

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.

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

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.

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

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.

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

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.

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

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.

Parameters:
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
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

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.

Parameters:
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
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

separate

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.

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

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.

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

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.

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

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.

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

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.

Parameters:
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
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

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.

Parameters:
params - Additional parameters to initialize the operator with (e.g. listeners or maxForks)
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.

getEventManager

DataflowChannelEventListenerManager<T> getEventManager()
Retrieves the event manager object of this channel

Returns:
The event manager to register custom events listeners

isBound

boolean isBound()
Check if value has been set already for this expression

Returns:
true if bound already

length

int length()
Reports the current number of elements in the channel

Returns:
The current snapshot of the number of elements in the channel

poll

DataflowExpression<T> poll()
                           throws java.lang.InterruptedException
Retrieves the value at the head of the buffer. Returns null, if no value is available.

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

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