|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object groovyx.gpars.dataflow.DataflowQueue<T>
public class DataflowQueue<T>
Represents a thread-safe data flow stream. Values or DataflowVariables are added using the '<<' operator and safely read once available using the 'val' property. The iterative methods like each(), collect(), iterator(), any(), all() or the for loops work with snapshots of the stream at the time of calling the particular method. For actors and Dataflow Operators the asynchronous non-blocking variants of the getValAsync() methods can be used. They register the request to read a value and will send a message to the actor or operator once the value is available.
Field Summary | |
---|---|
private DataflowChannelEventOrchestrator<T> |
eventManager
|
private java.util.concurrent.LinkedBlockingQueue<DataflowVariable<T>> |
queue
Stores the received DataflowVariables in the buffer. |
private java.lang.Object |
queueLock
Internal lock |
private java.util.Queue<DataflowVariable<T>> |
requests
Stores unsatisfied requests for values |
private java.util.Collection<MessageStream> |
wheneverBoundListeners
A collection of listeners who need to be informed each time the stream is bound to a value |
Constructor Summary | |
---|---|
DataflowQueue()
|
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. |
|
void |
bind(T value)
Adds a DataflowVariable representing the passed in value to the buffer. |
|
private DataflowVariable<T> |
copyDFV(java.util.Queue<DataflowVariable<T>> from,
java.util.Queue<DataflowVariable<T>> to)
|
|
protected DataflowVariable<T> |
createVariable()
Creates a new variable to perform the next data exchange |
|
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 |
|
(package private) java.util.concurrent.LinkedBlockingQueue<DataflowVariable<T>> |
getQueue()
|
|
T |
getVal()
Retrieves the value at the head of the buffer. |
|
T |
getVal(long timeout,
java.util.concurrent.TimeUnit units)
Retrieves the value at the head of the buffer. |
|
void |
getValAsync(MessageStream callback)
Asynchronously retrieves the value at the head of the buffer. |
|
void |
getValAsync(java.lang.Object attachment,
MessageStream callback)
Asynchronously retrieves the value at the head of the buffer. |
|
private DataflowExpression<T> |
hookWheneverBoundListeners(DataflowExpression<T> expr)
Hooks the registered when bound handlers to the supplied dataflow expression |
|
|
chainWith(groovy.lang.Closure<V> closure)
Creates and attaches a new operator processing values from the channel |
|
|
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 |
|
|
chainWith(PGroup group,
groovy.lang.Closure<V> closure)
Creates and attaches a new operator processing values from the channel |
|
|
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 |
|
|
chainWith(Pool pool,
groovy.lang.Closure<V> closure)
Creates and attaches a new operator processing values from the channel |
|
|
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()
Returns an iterator over a current snapshot of the buffer's content. |
|
DataflowWriteChannel<T> |
leftShift(DataflowReadChannel<T> ref)
Adds a DataflowVariable to the buffer. |
|
DataflowWriteChannel<T> |
leftShift(T value)
Adds a DataflowVariable representing the passed in value to the buffer. |
|
int |
length()
Returns the current size of the buffer |
|
|
merge(DataflowReadChannel<java.lang.Object> other,
groovy.lang.Closure<V> closure)
Merges channels together as inputs for a single dataflow operator. |
|
|
merge(java.util.List<DataflowReadChannel<java.lang.Object>> others,
groovy.lang.Closure<V> closure)
Merges channels together as inputs for a single dataflow operator. |
|
|
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. |
|
|
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. |
|
|
merge(PGroup group,
DataflowReadChannel<java.lang.Object> other,
groovy.lang.Closure<V> closure)
Merges channels together as inputs for a single dataflow operator. |
|
|
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. |
|
|
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. |
|
|
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. |
|
|
merge(Pool pool,
DataflowReadChannel<java.lang.Object> other,
groovy.lang.Closure<V> closure)
Merges channels together as inputs for a single dataflow operator. |
|
|
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. |
|
|
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. |
|
|
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. |
|
|
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. |
|
private DataflowVariable<T> |
retrieveForBind()
Takes the first unsatisfied value request and binds a value on it. |
|
private DataflowVariable<T> |
retrieveOrCreateVariable()
Checks whether there's a DFV waiting in the queue and retrieves it. |
|
|
rightShift(groovy.lang.Closure<V> closure)
Schedule closure to be executed by pooled actor 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. |
|
|
then(groovy.lang.Closure<V> closure)
Schedule closure to be executed after data became available. |
|
|
then(PGroup group,
groovy.lang.Closure<V> closure)
Schedule closure to be executed after data becomes available. |
|
|
then(Pool pool,
groovy.lang.Closure<V> closure)
Schedule closure to be executed after data becomes available. |
|
java.lang.String |
toString()
|
|
|
whenBound(groovy.lang.Closure<V> closure)
Schedule closure to be executed by pooled actor after the next data becomes available. |
|
void |
whenBound(MessageStream stream)
Send the next bound piece of data to the provided stream when it becomes available. |
|
|
whenBound(PGroup group,
groovy.lang.Closure<V> closure)
Schedule closure to be executed after data becomes available. |
|
|
whenBound(Pool pool,
groovy.lang.Closure<V> closure)
Schedule closure to be executed by pooled actor after data becomes available. |
|
|
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 |
---|
private final java.lang.Object queueLock
private final java.util.concurrent.LinkedBlockingQueue<DataflowVariable<T>> queue
private final java.util.Queue<DataflowVariable<T>> requests
private final java.util.Collection<MessageStream> wheneverBoundListeners
private volatile DataflowChannelEventOrchestrator<T> eventManager
Constructor Detail |
---|
public DataflowQueue()
Method Detail |
---|
public final DataflowWriteChannel<T> leftShift(DataflowReadChannel<T> ref)
leftShift
in interface DataflowWriteChannel<T>
ref
- The DFV to add to the stream
public final DataflowWriteChannel<T> leftShift(T value)
leftShift
in interface DataflowWriteChannel<T>
value
- The value to bind to the head of the stream
public final void bind(T value)
bind
in interface DataflowWriteChannel<T>
value
- The value to bind to the head of the streamprivate DataflowExpression<T> hookWheneverBoundListeners(DataflowExpression<T> expr)
expr
- The expression to hook all the when bound listeners to
private DataflowVariable<T> retrieveForBind()
private DataflowVariable<T> copyDFV(java.util.Queue<DataflowVariable<T>> from, java.util.Queue<DataflowVariable<T>> to)
protected DataflowVariable<T> createVariable()
public final T getVal() throws java.lang.InterruptedException
getVal
in interface DataflowReadChannel<T>
java.lang.InterruptedException
- If the current thread is interruptedpublic final T getVal(long timeout, java.util.concurrent.TimeUnit units) throws java.lang.InterruptedException
getVal
in interface DataflowReadChannel<T>
timeout
- The timeout valueunits
- Units for the timeout
java.lang.InterruptedException
- If the current thread is interruptedpublic final DataflowExpression<T> poll()
poll
in interface DataflowReadChannel<T>
public final void getValAsync(MessageStream callback)
getValAsync
in interface DataflowReadChannel<T>
callback
- The actor to notify when a value is boundpublic final void getValAsync(java.lang.Object attachment, MessageStream callback)
getValAsync
in interface DataflowReadChannel<T>
attachment
- An arbitrary value to identify operator channels and so match requests and repliescallback
- The actor / operator to notify when a value is boundpublic final <V> Promise<V> rightShift(groovy.lang.Closure<V> closure)
rightShift
in interface DataflowReadChannel<T>
closure
- closure to execute when data becomes available. The closure should take at most one argument.
public final <V> void whenBound(groovy.lang.Closure<V> closure)
whenBound
in interface DataflowReadChannel<T>
closure
- closure to execute when data becomes available. The closure should take at most one argument.public final <V> void whenBound(Pool pool, groovy.lang.Closure<V> closure)
whenBound
in interface DataflowReadChannel<T>
pool
- The thread pool to use for task scheduling for asynchronous message deliveryclosure
- closure to execute when data becomes available. The closure should take at most one argument.public <V> void whenBound(PGroup group, groovy.lang.Closure<V> closure)
DataflowReadChannel
whenBound
in interface DataflowReadChannel<T>
group
- The PGroup to use for task scheduling for asynchronous message deliveryclosure
- closure to execute when data becomes available. The closure should take at most one argument.public final void whenBound(MessageStream stream)
whenBound
in interface DataflowReadChannel<T>
stream
- stream where to send resultpublic final <V> Promise<V> then(groovy.lang.Closure<V> closure)
then
in interface DataflowReadChannel<T>
closure
- closure to execute when data becomes available. The closure should take at most one argument.
public <V> Promise<V> then(Pool pool, groovy.lang.Closure<V> closure)
then
in interface DataflowReadChannel<T>
pool
- The thread pool to use for task scheduling for asynchronous message deliveryclosure
- closure to execute when data becomes available. The closure should take at most one argument.
public <V> Promise<V> then(PGroup group, groovy.lang.Closure<V> closure)
then
in interface DataflowReadChannel<T>
group
- The PGroup to use for task scheduling for asynchronous message deliveryclosure
- closure to execute when data becomes available. The closure should take at most one argument.
public final <V> void wheneverBound(groovy.lang.Closure<V> closure)
wheneverBound
in interface DataflowReadChannel<T>
closure
- closure to execute when data becomes available. The closure should take at most one argument.public final void wheneverBound(MessageStream stream)
wheneverBound
in interface DataflowReadChannel<T>
stream
- stream where to send resultpublic final <V> DataflowReadChannel<V> chainWith(groovy.lang.Closure<V> closure)
DataflowReadChannel
chainWith
in interface DataflowReadChannel<T>
V
- The type of values returned from the supplied closureclosure
- The function to invoke on all incoming values as part of the new operator's body
public final <V> DataflowReadChannel<V> chainWith(Pool pool, groovy.lang.Closure<V> closure)
DataflowReadChannel
chainWith
in interface DataflowReadChannel<T>
V
- The type of values returned from the supplied closurepool
- The thread pool to useclosure
- The function to invoke on all incoming values as part of the new operator's body
public <V> DataflowReadChannel<V> chainWith(PGroup group, groovy.lang.Closure<V> closure)
DataflowReadChannel
chainWith
in interface DataflowReadChannel<T>
V
- The type of values returned from the supplied closuregroup
- The PGroup to useclosure
- The function to invoke on all incoming values as part of the new operator's body
public final <V> DataflowReadChannel<V> chainWith(java.util.Map<java.lang.String,java.lang.Object> params, groovy.lang.Closure<V> closure)
DataflowReadChannel
chainWith
in interface DataflowReadChannel<T>
V
- The type of values returned from the supplied closureparams
- 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
public final <V> DataflowReadChannel<V> chainWith(Pool pool, java.util.Map<java.lang.String,java.lang.Object> params, groovy.lang.Closure<V> closure)
DataflowReadChannel
chainWith
in interface DataflowReadChannel<T>
V
- The type of values returned from the supplied closurepool
- The thread pool to useparams
- 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
public <V> DataflowReadChannel<V> chainWith(PGroup group, java.util.Map<java.lang.String,java.lang.Object> params, groovy.lang.Closure<V> closure)
DataflowReadChannel
chainWith
in interface DataflowReadChannel<T>
V
- The type of values returned from the supplied closuregroup
- The PGroup to useparams
- 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
public <V> DataflowReadChannel<V> or(groovy.lang.Closure<V> closure)
DataflowReadChannel
or
in interface DataflowReadChannel<T>
V
- The type of values returned from the supplied closureclosure
- The function to invoke on all incoming values as part of the new operator's body
public DataflowReadChannel<T> filter(groovy.lang.Closure<java.lang.Boolean> closure)
DataflowReadChannel
filter
in interface DataflowReadChannel<T>
closure
- The filter function to invoke on all incoming values to decide whether to pass the value on or not
public DataflowReadChannel<T> filter(Pool pool, groovy.lang.Closure<java.lang.Boolean> closure)
DataflowReadChannel
filter
in interface DataflowReadChannel<T>
pool
- The thread pool to useclosure
- The filter function to invoke on all incoming values to decide whether to pass the value on or not
public DataflowReadChannel<T> filter(PGroup group, groovy.lang.Closure<java.lang.Boolean> closure)
DataflowReadChannel
filter
in interface DataflowReadChannel<T>
group
- The PGroup to useclosure
- The filter function to invoke on all incoming values to decide whether to pass the value on or not
public DataflowReadChannel<T> filter(java.util.Map<java.lang.String,java.lang.Object> params, groovy.lang.Closure<java.lang.Boolean> closure)
DataflowReadChannel
filter
in interface DataflowReadChannel<T>
params
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)closure
- The filter function to invoke on all incoming values to decide whether to pass the value on or not
public DataflowReadChannel<T> filter(Pool pool, java.util.Map<java.lang.String,java.lang.Object> params, groovy.lang.Closure<java.lang.Boolean> closure)
DataflowReadChannel
filter
in interface DataflowReadChannel<T>
pool
- The thread pool to useparams
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)closure
- The filter function to invoke on all incoming values to decide whether to pass the value on or not
public DataflowReadChannel<T> filter(PGroup group, java.util.Map<java.lang.String,java.lang.Object> params, groovy.lang.Closure<java.lang.Boolean> closure)
DataflowReadChannel
filter
in interface DataflowReadChannel<T>
group
- The PGroup to useparams
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)closure
- The filter function to invoke on all incoming values to decide whether to pass the value on or not
public void into(DataflowWriteChannel<T> target)
DataflowReadChannel
into
in interface DataflowReadChannel<T>
target
- The channel to copy data intopublic void into(Pool pool, DataflowWriteChannel<T> target)
DataflowReadChannel
into
in interface DataflowReadChannel<T>
pool
- The thread pool to usetarget
- The channel to copy data intopublic void into(PGroup group, DataflowWriteChannel<T> target)
DataflowReadChannel
into
in interface DataflowReadChannel<T>
group
- The PGroup to usetarget
- The channel to copy data intopublic void into(java.util.Map<java.lang.String,java.lang.Object> params, DataflowWriteChannel<T> target)
DataflowReadChannel
into
in interface DataflowReadChannel<T>
params
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)target
- The channel to copy data intopublic void into(Pool pool, java.util.Map<java.lang.String,java.lang.Object> params, DataflowWriteChannel<T> target)
DataflowReadChannel
into
in interface DataflowReadChannel<T>
pool
- The thread pool to useparams
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)target
- The channel to copy data intopublic void into(PGroup group, java.util.Map<java.lang.String,java.lang.Object> params, DataflowWriteChannel<T> target)
DataflowReadChannel
into
in interface DataflowReadChannel<T>
group
- The PGroup to useparams
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)target
- The channel to copy data intopublic void or(DataflowWriteChannel<T> target)
DataflowReadChannel
or
in interface DataflowReadChannel<T>
target
- The channel to copy data intopublic void split(DataflowWriteChannel<T> target1, DataflowWriteChannel<T> target2)
DataflowReadChannel
split
in interface DataflowReadChannel<T>
target1
- The first channel to copy data intotarget2
- The second channel to copy data intopublic void split(Pool pool, DataflowWriteChannel<T> target1, DataflowWriteChannel<T> target2)
DataflowReadChannel
split
in interface DataflowReadChannel<T>
pool
- The thread pool to usetarget1
- The first channel to copy data intotarget2
- The second channel to copy data intopublic void split(PGroup group, DataflowWriteChannel<T> target1, DataflowWriteChannel<T> target2)
DataflowReadChannel
split
in interface DataflowReadChannel<T>
group
- The PGroup to usetarget1
- The first channel to copy data intotarget2
- The second channel to copy data intopublic void split(java.util.List<DataflowWriteChannel<T>> targets)
DataflowReadChannel
split
in interface DataflowReadChannel<T>
targets
- The channels to copy data intopublic void split(Pool pool, java.util.List<DataflowWriteChannel<T>> targets)
DataflowReadChannel
split
in interface DataflowReadChannel<T>
pool
- The thread pool to usetargets
- The channels to copy data intopublic void split(PGroup group, java.util.List<DataflowWriteChannel<T>> targets)
DataflowReadChannel
split
in interface DataflowReadChannel<T>
group
- The PGroup to usetargets
- The channels to copy data intopublic void split(java.util.Map<java.lang.String,java.lang.Object> params, DataflowWriteChannel<T> target1, DataflowWriteChannel<T> target2)
DataflowReadChannel
split
in interface DataflowReadChannel<T>
params
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)target1
- The first channel to copy data intotarget2
- The second channel to copy data intopublic void split(Pool pool, java.util.Map<java.lang.String,java.lang.Object> params, DataflowWriteChannel<T> target1, DataflowWriteChannel<T> target2)
DataflowReadChannel
split
in interface DataflowReadChannel<T>
pool
- The thread pool to useparams
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)target1
- The first channel to copy data intotarget2
- The second channel to copy data intopublic void split(PGroup group, java.util.Map<java.lang.String,java.lang.Object> params, DataflowWriteChannel<T> target1, DataflowWriteChannel<T> target2)
DataflowReadChannel
split
in interface DataflowReadChannel<T>
group
- The PGroup to useparams
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)target1
- The first channel to copy data intotarget2
- The second channel to copy data intopublic void split(java.util.Map<java.lang.String,java.lang.Object> params, java.util.List<DataflowWriteChannel<T>> targets)
DataflowReadChannel
split
in interface DataflowReadChannel<T>
params
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)targets
- The channels to copy data intopublic void split(Pool pool, java.util.Map<java.lang.String,java.lang.Object> params, java.util.List<DataflowWriteChannel<T>> targets)
DataflowReadChannel
split
in interface DataflowReadChannel<T>
pool
- The thread pool to useparams
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)targets
- The channels to copy data intopublic void split(PGroup group, java.util.Map<java.lang.String,java.lang.Object> params, java.util.List<DataflowWriteChannel<T>> targets)
DataflowReadChannel
split
in interface DataflowReadChannel<T>
group
- The PGroup to useparams
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)targets
- The channels to copy data intopublic DataflowReadChannel<T> tap(DataflowWriteChannel<T> target)
DataflowReadChannel
tap
in interface DataflowReadChannel<T>
target
- The channel to tap data into
public DataflowReadChannel<T> tap(Pool pool, DataflowWriteChannel<T> target)
DataflowReadChannel
tap
in interface DataflowReadChannel<T>
pool
- The thread pool to usetarget
- The channel to tap data into
public DataflowReadChannel<T> tap(PGroup group, DataflowWriteChannel<T> target)
DataflowReadChannel
tap
in interface DataflowReadChannel<T>
group
- The PGroup to usetarget
- The channel to tap data into
public DataflowReadChannel<T> tap(java.util.Map<java.lang.String,java.lang.Object> params, DataflowWriteChannel<T> target)
DataflowReadChannel
tap
in interface DataflowReadChannel<T>
params
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)target
- The channel to tap data into
public DataflowReadChannel<T> tap(Pool pool, java.util.Map<java.lang.String,java.lang.Object> params, DataflowWriteChannel<T> target)
DataflowReadChannel
tap
in interface DataflowReadChannel<T>
pool
- The thread pool to useparams
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)target
- The channel to tap data into
public DataflowReadChannel<T> tap(PGroup group, java.util.Map<java.lang.String,java.lang.Object> params, DataflowWriteChannel<T> target)
DataflowReadChannel
tap
in interface DataflowReadChannel<T>
group
- The PGroup to useparams
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)target
- The channel to tap data into
public <V> DataflowReadChannel<V> merge(DataflowReadChannel<java.lang.Object> other, groovy.lang.Closure<V> closure)
DataflowReadChannel
merge
in interface DataflowReadChannel<T>
V
- The type of values passed between the channelsother
- The channel to merge withclosure
- The function to invoke on all incoming values as part of the new operator's body. The number of arguments to the closure must match the number of input channels.
public <V> DataflowReadChannel<V> merge(Pool pool, DataflowReadChannel<java.lang.Object> other, groovy.lang.Closure<V> closure)
DataflowReadChannel
merge
in interface DataflowReadChannel<T>
V
- The type of values passed between the channelspool
- The thread pool to useother
- The channel to merge withclosure
- The function to invoke on all incoming values as part of the new operator's body. The number of arguments to the closure must match the number of input channels.
public <V> DataflowReadChannel<V> merge(PGroup group, DataflowReadChannel<java.lang.Object> other, groovy.lang.Closure<V> closure)
DataflowReadChannel
merge
in interface DataflowReadChannel<T>
V
- The type of values passed between the channelsgroup
- The PGroup to useother
- The channel to merge withclosure
- The function to invoke on all incoming values as part of the new operator's body. The number of arguments to the closure must match the number of input channels.
public <V> DataflowReadChannel<V> merge(java.util.List<DataflowReadChannel<java.lang.Object>> others, groovy.lang.Closure<V> closure)
DataflowReadChannel
merge
in interface DataflowReadChannel<T>
V
- The type of values passed between the channelsothers
- The channels to merge withclosure
- The function to invoke on all incoming values as part of the new operator's body. The number of arguments to the closure must match the number of input channels.
public <V> DataflowReadChannel<V> merge(Pool pool, java.util.List<DataflowReadChannel<java.lang.Object>> others, groovy.lang.Closure<V> closure)
DataflowReadChannel
merge
in interface DataflowReadChannel<T>
V
- The type of values passed between the channelspool
- The thread pool to useothers
- The channels to merge withclosure
- The function to invoke on all incoming values as part of the new operator's body. The number of arguments to the closure must match the number of input channels.
public <V> DataflowReadChannel<V> merge(PGroup group, java.util.List<DataflowReadChannel<java.lang.Object>> others, groovy.lang.Closure<V> closure)
DataflowReadChannel
merge
in interface DataflowReadChannel<T>
V
- The type of values passed between the channelsgroup
- The PGroup to useothers
- The channels to merge withclosure
- The function to invoke on all incoming values as part of the new operator's body. The number of arguments to the closure must match the number of input channels.
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)
DataflowReadChannel
merge
in interface DataflowReadChannel<T>
V
- The type of values passed between the channelsparams
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)other
- The channel to merge withclosure
- The function to invoke on all incoming values as part of the new operator's body. The number of arguments to the closure must match the number of input channels.
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)
DataflowReadChannel
merge
in interface DataflowReadChannel<T>
V
- The type of values passed between the channelspool
- The thread pool to useparams
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)other
- The channel to merge withclosure
- The function to invoke on all incoming values as part of the new operator's body. The number of arguments to the closure must match the number of input channels.
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)
DataflowReadChannel
merge
in interface DataflowReadChannel<T>
V
- The type of values passed between the channelsgroup
- The PGroup to useparams
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)other
- The channel to merge withclosure
- The function to invoke on all incoming values as part of the new operator's body. The number of arguments to the closure must match the number of input channels.
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)
DataflowReadChannel
merge
in interface DataflowReadChannel<T>
V
- The type of values passed between the channelsparams
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)others
- The channels to merge withclosure
- The function to invoke on all incoming values as part of the new operator's body. The number of arguments to the closure must match the number of input channels.
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)
DataflowReadChannel
merge
in interface DataflowReadChannel<T>
V
- The type of values passed between the channelspool
- The thread pool to useparams
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)others
- The channels to merge withclosure
- The function to invoke on all incoming values as part of the new operator's body. The number of arguments to the closure must match the number of input channels.
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)
DataflowReadChannel
merge
in interface DataflowReadChannel<T>
V
- The type of values passed between the channelsgroup
- The PGroup to useparams
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)others
- The channels to merge withclosure
- The function to invoke on all incoming values as part of the new operator's body. The number of arguments to the closure must match the number of input channels.
public void binaryChoice(DataflowWriteChannel<T> trueBranch, DataflowWriteChannel<T> falseBranch, groovy.lang.Closure<java.lang.Boolean> code)
DataflowReadChannel
binaryChoice
in interface DataflowReadChannel<T>
trueBranch
- The channel to send data to if the closure returns truefalseBranch
- The channel to send data to if the closure returns truecode
- A closure directing data to either the true or the false output branchpublic void binaryChoice(Pool pool, DataflowWriteChannel<T> trueBranch, DataflowWriteChannel<T> falseBranch, groovy.lang.Closure<java.lang.Boolean> code)
DataflowReadChannel
binaryChoice
in interface DataflowReadChannel<T>
pool
- The thread pool to usetrueBranch
- The channel to send data to if the closure returns truefalseBranch
- The channel to send data to if the closure returns truecode
- A closure directing data to either the true or the false output branchpublic void binaryChoice(PGroup group, DataflowWriteChannel<T> trueBranch, DataflowWriteChannel<T> falseBranch, groovy.lang.Closure<java.lang.Boolean> code)
DataflowReadChannel
binaryChoice
in interface DataflowReadChannel<T>
group
- The PGroup to usetrueBranch
- The channel to send data to if the closure returns truefalseBranch
- The channel to send data to if the closure returns truecode
- A closure directing data to either the true or the false output branchpublic 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)
DataflowReadChannel
binaryChoice
in interface DataflowReadChannel<T>
params
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)trueBranch
- The channel to send data to if the closure returns truefalseBranch
- The channel to send data to if the closure returns truecode
- A closure directing data to either the true or the false output branchpublic 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)
DataflowReadChannel
binaryChoice
in interface DataflowReadChannel<T>
pool
- The thread pool to useparams
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)trueBranch
- The channel to send data to if the closure returns truefalseBranch
- The channel to send data to if the closure returns truecode
- A closure directing data to either the true or the false output branchpublic 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)
DataflowReadChannel
binaryChoice
in interface DataflowReadChannel<T>
group
- The PGroup to useparams
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)trueBranch
- The channel to send data to if the closure returns truefalseBranch
- The channel to send data to if the closure returns truecode
- A closure directing data to either the true or the false output branchpublic void choice(java.util.List<DataflowWriteChannel<T>> outputs, groovy.lang.Closure<java.lang.Integer> code)
DataflowReadChannel
choice
in interface DataflowReadChannel<T>
outputs
- The channels to send data to of the closure returns truecode
- A closure returning an index of the output channel to direct the data topublic void choice(Pool pool, java.util.List<DataflowWriteChannel<T>> outputs, groovy.lang.Closure<java.lang.Integer> code)
DataflowReadChannel
choice
in interface DataflowReadChannel<T>
pool
- The thread pool to useoutputs
- The channels to send data to.code
- A closure returning an index of the output channel to direct the data topublic void choice(PGroup group, java.util.List<DataflowWriteChannel<T>> outputs, groovy.lang.Closure<java.lang.Integer> code)
DataflowReadChannel
choice
in interface DataflowReadChannel<T>
group
- The PGroup to useoutputs
- The channels to send data to.code
- A closure returning an index of the output channel to direct the data topublic 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)
DataflowReadChannel
choice
in interface DataflowReadChannel<T>
params
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)outputs
- The channels to send data to of the closure returns truecode
- A closure returning an index of the output channel to direct the data topublic 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)
DataflowReadChannel
choice
in interface DataflowReadChannel<T>
pool
- The thread pool to useparams
- 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 topublic 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)
DataflowReadChannel
choice
in interface DataflowReadChannel<T>
group
- The PGroup to useparams
- 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 topublic void separate(java.util.List<DataflowWriteChannel<?>> outputs, groovy.lang.Closure<java.util.List<java.lang.Object>> code)
DataflowReadChannel
separate
in interface DataflowReadChannel<T>
outputs
- The channels to send data to.code
- A closure returning a list of values to pass to the output channels. Values are output to the output channels with identical index.public void separate(Pool pool, java.util.List<DataflowWriteChannel<?>> outputs, groovy.lang.Closure<java.util.List<java.lang.Object>> code)
DataflowReadChannel
separate
in interface DataflowReadChannel<T>
pool
- The thread pool to useoutputs
- The channels to send data to.code
- A closure returning a list of values to pass to the output channels. Values are output to the output channels with identical index.public void separate(PGroup group, java.util.List<DataflowWriteChannel<?>> outputs, groovy.lang.Closure<java.util.List<java.lang.Object>> code)
DataflowReadChannel
separate
in interface DataflowReadChannel<T>
group
- The PGroup to useoutputs
- The channels to send data to.code
- A closure returning a list of values to pass to the output channels. Values are output to the output channels with identical index.public void separate(java.util.Map<java.lang.String,java.lang.Object> params, java.util.List<DataflowWriteChannel<?>> outputs, groovy.lang.Closure<java.util.List<java.lang.Object>> code)
DataflowReadChannel
separate
in interface DataflowReadChannel<T>
params
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)outputs
- The channels to send data to.code
- A closure returning a list of values to pass to the output channels. Values are output to the output channels with identical index.public void separate(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)
DataflowReadChannel
separate
in interface DataflowReadChannel<T>
pool
- The thread pool to useparams
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)outputs
- The channels to send data to.code
- A closure returning a list of values to pass to the output channels. Values are output to the output channels with identical index.public void separate(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)
DataflowReadChannel
separate
in interface DataflowReadChannel<T>
group
- The PGroup to useparams
- Additional parameters to initialize the operator with (e.g. listeners or maxForks)outputs
- The channels to send data to.code
- A closure returning a list of values to pass to the output channels. Values are output to the output channels with identical index.public final boolean isBound()
isBound
in interface DataflowReadChannel<T>
private DataflowVariable<T> retrieveOrCreateVariable()
public final int length()
length
in interface DataflowReadChannel<T>
public final java.util.Iterator<T> iterator()
public DataflowChannelEventListenerManager<T> getEventManager()
DataflowReadChannel
getEventManager
in interface DataflowReadChannel<T>
private void fireOnMessage(T value)
final java.util.concurrent.LinkedBlockingQueue<DataflowVariable<T>> getQueue()
public java.lang.String toString()
toString
in class java.lang.Object
|
Copyright © 2008–2012 Václav Pech. All Rights Reserved. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |