org.codehaus.gpars

groovyx.gpars.dataflow.stream
[Java] Class DataflowStream

java.lang.Object
  groovyx.gpars.dataflow.stream.StreamCore
      groovyx.gpars.dataflow.stream.DataflowStream

@java.lang.SuppressWarningspublic DataflowStream(final Closure toBeApplied) {
public final class DataflowStream
extends StreamCore

Represents a deterministic dataflow channel. Unlike a DataflowQueue, DataflowStream allows multiple readers each to read all the messages. Essentially, you may think of DataflowStream as a 1 to many communication channel, since when a reader consumes a messages, other readers will still be able to read the message. Also, all messages arrive to all readers in the same order. DataflowStream is implemented as a functional queue, which impacts the API in that users have to traverse the values in the stream themselves. On the other hand in offers handy methods for value filtering or transformation together with interesting performance characteristics. For convenience and for the ability to use DataflowStream with other dataflow constructs, like e.g. operators, you can wrap DataflowStreams with DataflowReadAdapter for read access or DataflowWriteAdapter for write access.

The DataflowStream class is designed for single-threaded producers and consumers. If multiple threads are supposed to read or write values to the stream, their access to the stream must be serialized externally or the adapters should be used.

Parameters:
- Type for values to pass through the stream
Authors:
Johannes Link, Vaclav Pech


Field Summary
 
Fields inherited from class StreamCore
first, rest, wheneverBoundListeners
 
Constructor Summary
DataflowStream()

DataflowStream(groovy.lang.Closure toBeApplied)

Retrieves a DataflowStream representing the rest of this Stream after removing the first element

private DataflowStream(java.util.Collection wheneverBoundListeners, java.util.Collection updateListeners)

 
Method Summary
protected StreamCore createNewStream()

FList getRest()

A factory method to create new instances of the correct class when needed

java.lang.String toString()

 
Methods inherited from class StreamCore
addUpdateListener, addUpdateListeners, appendingString, apply, bind, createNewStream, decrementParties, eos, equals, eval, filter, filter, generate, generateNext, getFirst, getFirstDFV, getRest, hashCode, hookWheneverBoundListeners, incrementParties, isEmpty, iterator, leftShift, leftShift, map, map, reduce, reduce, reduce, wheneverBound, wheneverBound
 

Constructor Detail

DataflowStream

public DataflowStream()


DataflowStream

public DataflowStream(groovy.lang.Closure toBeApplied)
Retrieves a DataflowStream representing the rest of this Stream after removing the first element
Returns:
The remaining stream elements


DataflowStream

private DataflowStream(java.util.Collection wheneverBoundListeners, java.util.Collection updateListeners)


 
Method Detail

createNewStream

@java.lang.Override
protected StreamCore createNewStream()


getRest

@java.lang.Override}
public FList getRest()
A factory method to create new instances of the correct class when needed
Returns:
An instance of the appropriate sub-class


toString

@java.lang.Override
public java.lang.String toString()


 

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