|
org.codehaus.gpars | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object groovyx.gpars.dataflow.stream.StreamCore
public abstract class StreamCore
Represents a common base for publish-subscribe deterministic channels.
- Type for values to pass through the channelsField Summary | |
---|---|
protected DataflowVariable |
first
|
protected java.util.concurrent.atomic.AtomicReference |
rest
|
protected java.util.Collection |
wheneverBoundListeners
A collection of listeners who need to be informed each time the stream is bound to a value |
Constructor Summary | |
protected StreamCore(DataflowVariable first)
Creates an empty stream |
|
protected StreamCore(DataflowVariable first, groovy.lang.Closure toBeApplied)
Creates a stream while applying the supplied initialization closure to it |
|
protected StreamCore(DataflowVariable first, java.util.Collection wheneverBoundListeners, java.util.Collection updateListeners)
|
Method Summary | |
---|---|
void
|
addUpdateListener(DataflowChannelListener updateListener)
|
private void
|
addUpdateListeners(java.util.Collection updateListeners)
|
java.lang.String
|
appendingString()
|
StreamCore
|
apply(groovy.lang.Closure closure)
Calls the supplied closure with the stream as a parameter |
private void
|
bind(java.lang.Object value)
|
protected StreamCore
|
createNewStream()
A factory method to create new instances of the correct class when needed |
void
|
decrementParties()
Decreases the number of parties required to perform the data exchange |
static java.lang.Object
|
eos()
|
boolean
|
equals(java.lang.Object obj)
|
private static java.lang.Object
|
eval(java.lang.Object valueOrDataflowVariable)
|
FList
|
filter(groovy.lang.Closure filterClosure)
Builds a filtered stream using the supplied filter closure |
private void
|
filter(StreamCore rest, groovy.lang.Closure filterClosure, StreamCore result)
|
StreamCore
|
generate(java.lang.Object seed, groovy.lang.Closure generator, groovy.lang.Closure condition)
Populates the stream with generated values |
private void
|
generateNext(java.lang.Object value, StreamCore stream, groovy.lang.Closure generator, groovy.lang.Closure condition)
|
java.lang.Object
|
getFirst()
Retrieved the first element in the stream, blocking until a value is available |
DataflowVariable
|
getFirstDFV()
|
FList
|
getRest()
Retrieves a DataflowStream representing the rest of this Stream after removing the first element |
int
|
hashCode()
|
private DataflowExpression
|
hookWheneverBoundListeners(DataflowExpression expr)
Hooks the registered when bound handlers to the supplied dataflow expression |
void
|
incrementParties()
Increases the number of parties required to perform the data exchange |
boolean
|
isEmpty()
Indicates, whether the first element in the stream is an eos |
java.util.Iterator
|
iterator()
Builds an iterator to iterate over the stream |
StreamCore
|
leftShift(DataflowReadChannel ref)
Adds a dataflow variable value to the stream, once the value is available |
StreamCore
|
leftShift(java.lang.Object value)
Adds a value to the stream |
FList
|
map(groovy.lang.Closure mapClosure)
Builds a modified stream using the supplied map closure |
private void
|
map(FList rest, groovy.lang.Closure mapClosure, StreamCore result)
|
java.lang.Object
|
reduce(groovy.lang.Closure reduceClosure)
Reduces all elements in the stream using the supplied closure |
java.lang.Object
|
reduce(java.lang.Object seed, groovy.lang.Closure reduceClosure)
Reduces all elements in the stream using the supplied closure |
private java.lang.Object
|
reduce(java.lang.Object current, FList rest, groovy.lang.Closure reduceClosure)
|
void
|
wheneverBound(groovy.lang.Closure closure)
|
void
|
wheneverBound(MessageStream stream)
|
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Field Detail |
---|
protected final DataflowVariable first
protected final java.util.concurrent.atomic.AtomicReference rest
protected final java.util.Collection wheneverBoundListeners
Constructor Detail |
---|
protected StreamCore(DataflowVariable first)
first
- The variable to store as the head of the stream
protected StreamCore(DataflowVariable first, groovy.lang.Closure toBeApplied)
first
- The variable to store as the head of the streamtoBeApplied
- The closure to use for initialization
@SuppressWarnings({"AssignmentToCollectionOrArrayFieldFromParameter"}) protected StreamCore(DataflowVariable first, java.util.Collection wheneverBoundListeners, java.util.Collection updateListeners)
Method Detail |
---|
final void addUpdateListener(DataflowChannelListener updateListener)
private void addUpdateListeners(java.util.Collection updateListeners)
@Override public java.lang.String appendingString()
public final StreamCore apply(groovy.lang.Closure closure)
closure
- The closure to call
private void bind(java.lang.Object value)
protected StreamCore createNewStream()
public void decrementParties()
public static java.lang.Object eos()
@Override public boolean equals(java.lang.Object obj)
private static java.lang.Object eval(java.lang.Object valueOrDataflowVariable)
@Override public final FList filter(groovy.lang.Closure filterClosure)
filterClosure
- The closure to decide on inclusion of elements
private void filter(StreamCore rest, groovy.lang.Closure filterClosure, StreamCore result)
public final StreamCore generate(java.lang.Object seed, groovy.lang.Closure generator, groovy.lang.Closure condition)
seed
- The initial element to evaluate and add as the first value of the streamgenerator
- A closure generating stream elements from the previous valuescondition
- A closure indicating whether the generation should continue based on the last generated value
private void generateNext(java.lang.Object value, StreamCore stream, groovy.lang.Closure generator, groovy.lang.Closure condition)
@Override public final java.lang.Object getFirst()
final DataflowVariable getFirstDFV()
@Override public FList getRest()
@Override public int hashCode()
private DataflowExpression hookWheneverBoundListeners(DataflowExpression expr)
expr
- The expression to hook all the when bound listeners to
public void incrementParties()
@Override public final boolean isEmpty()
@Override public final java.util.Iterator iterator()
public final StreamCore leftShift(DataflowReadChannel ref)
ref
- The DataflowVariable to check for value
public final StreamCore leftShift(java.lang.Object value)
value
- The value to add
@Override public final FList map(groovy.lang.Closure mapClosure)
mapClosure
- The closure to transform elements
private void map(FList rest, groovy.lang.Closure mapClosure, StreamCore result)
@Override public final java.lang.Object reduce(groovy.lang.Closure reduceClosure)
reduceClosure
- The closure to reduce elements of the stream gradually into an accumulator. The accumulator is seeded with the first stream element.
@Override public final java.lang.Object reduce(java.lang.Object seed, groovy.lang.Closure reduceClosure)
reduceClosure
- The closure to reduce elements of the stream gradually into an accumulator.seed
- The value to initialize the accumulator with.
private java.lang.Object reduce(java.lang.Object current, FList rest, groovy.lang.Closure reduceClosure)
public final void wheneverBound(groovy.lang.Closure closure)
public final void wheneverBound(MessageStream stream)
Copyright © 2008–2012 Václav Pech. All Rights Reserved.