org.codehaus.gpars

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

java.lang.Object
  groovyx.gpars.dataflow.stream.StreamCore
All Implemented Interfaces:
FList

public abstract class StreamCore

Represents a common base for publish-subscribe deterministic channels.

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


Field Summary
protected DataflowVariable first

protected java.util.concurrent.atomic.AtomicReference rest

protected java.util.Collection wheneverBoundListeners

 
Constructor Summary
protected StreamCore(DataflowVariable first)

protected StreamCore(DataflowVariable first, groovy.lang.Closure toBeApplied)

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)

Adds a dataflow variable value to the stream, once the value is available

private void bind(java.lang.Object value)

protected StreamCore createNewStream()

void decrementParties()

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)

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)

private void generateNext(java.lang.Object value, StreamCore stream, groovy.lang.Closure generator, groovy.lang.Closure condition)

java.lang.Object getFirst()

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

DataflowVariable getFirstDFV()

FList getRest()

Indicates, whether the first element in the stream is an eos

int hashCode()

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

private DataflowExpression hookWheneverBoundListeners(DataflowExpression expr)

Increases the number of parties required to perform the data exchange

void incrementParties()

boolean isEmpty()

java.util.Iterator iterator()

StreamCore leftShift(DataflowReadChannel ref)

StreamCore leftShift(java.lang.Object value)

FList map(groovy.lang.Closure mapClosure)

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)

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, int), java.lang.Object#wait(long), java.lang.Object#wait(), 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

first

protected final DataflowVariable first


rest

protected final java.util.concurrent.atomic.AtomicReference rest


wheneverBoundListeners

protected final java.util.Collection wheneverBoundListeners


 
Constructor Detail

StreamCore

protected StreamCore(DataflowVariable first)


StreamCore

protected StreamCore(DataflowVariable first, groovy.lang.Closure toBeApplied)


StreamCore

@java.lang.SuppressWarnings
protected StreamCore(DataflowVariable first, java.util.Collection wheneverBoundListeners, java.util.Collection updateListeners)


 
Method Detail

addUpdateListener

final void addUpdateListener(DataflowChannelListener updateListener)


addUpdateListeners

private void addUpdateListeners(java.util.Collection updateListeners)


appendingString

@java.lang.Overrideif (isEmpty())
public java.lang.String appendingString()


apply

public final StreamCore apply(groovy.lang.Closure closure)
Adds a dataflow variable value to the stream, once the value is available
Parameters:
ref - The DataflowVariable to check for value
Returns:
The rest of the stream


bind

private void bind(java.lang.Object value)


createNewStream

protected StreamCore createNewStream()


decrementParties

public void decrementParties()


eos

public static java.lang.Object eos()


equals

@java.lang.Overrideint result = first.hashCode();
public boolean equals(java.lang.Object obj)


eval

private static java.lang.Object eval(java.lang.Object valueOrDataflowVariable)


filter

@java.lang.Overridefinal boolean include = (Boolean) eval(filterClosure.call(new Object[]{recurRest.getFirst()}));
public final FList filter(groovy.lang.Closure filterClosure)


filter

private void filter(StreamCore rest, groovy.lang.Closure filterClosure, StreamCore result)


generate

public final StreamCore generate(java.lang.Object seed, groovy.lang.Closure generator, groovy.lang.Closure condition)


generateNext

private void generateNext(java.lang.Object value, StreamCore stream, groovy.lang.Closure generator, groovy.lang.Closure condition)


getFirst

@java.lang.Overridepublic abstract FList getRest();
public final java.lang.Object getFirst()
Retrieves a DataflowStream representing the rest of this Stream after removing the first element
Returns:
The remaining stream elements


getFirstDFV

final DataflowVariable getFirstDFV()


getRest

@java.lang.Override* @return The first item of the filtered stream
public FList getRest()
Indicates, whether the first element in the stream is an eos


hashCode

@java.lang.OverridewheneverBoundListeners.add(new DataCallback(closure, Dataflow.retrieveCurrentDFPGroup()));
public int hashCode()
A factory method to create new instances of the correct class when needed
Returns:
An instance of the appropriate sub-class


hookWheneverBoundListeners

private DataflowExpression hookWheneverBoundListeners(DataflowExpression expr)
Increases the number of parties required to perform the data exchange


incrementParties

public void incrementParties()


isEmpty

@java.lang.Overridereturn newStream;
public final boolean isEmpty()


iterator

@java.lang.Overridepublic boolean equals(final Object obj) {
public final java.util.Iterator iterator()


leftShift

public final StreamCore leftShift(DataflowReadChannel ref)


leftShift

public final StreamCore leftShift(java.lang.Object value)


map

@java.lang.Overridefinal Object mapped = mapClosure.call(new Object[]{recurRest.getFirst()});
public final FList map(groovy.lang.Closure mapClosure)


map

private void map(FList rest, groovy.lang.Closure mapClosure, StreamCore result)


reduce

@java.lang.Overridepublic final T reduce(final T seed, final Closure reduceClosure) {
public final java.lang.Object reduce(groovy.lang.Closure reduceClosure)
Reduces all elements in the stream using the supplied closure
Parameters:
reduceClosure - The closure to reduce elements of the stream gradually into an accumulator.
seed - The value to initialize the accumulator with.
Returns:
The result of reduction of the whole stream


reduce

@java.lang.Override}
public final java.lang.Object reduce(java.lang.Object seed, groovy.lang.Closure reduceClosure)


reduce

private java.lang.Object reduce(java.lang.Object current, FList rest, groovy.lang.Closure reduceClosure)


wheneverBound

public final void wheneverBound(groovy.lang.Closure closure)


wheneverBound

public final void wheneverBound(MessageStream stream)


 

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