Groovy Documentation

gpars.dataflow
Class DataFlowVariable

java.lang.Object
  groovyx.gpars.serial.WithSerialId
      gpars.dataflow.DataFlowExpression
          gpars.dataflow.DataFlowVariable

@SuppressWarnings({"AccessingNonPublicFieldOfAnotherObject", "UnqualifiedStaticUsage"})
class DataFlowVariable
extends DataFlowExpression

Represents a thread-safe single-assignment, multi-read variable. Each instance of DataFlowVariable can be read repeatedly any time using the 'val' property and assigned once in its lifetime using the '<<' operator. Reads preceding assignment will be blocked until the value is assigned. 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.

author:
Vaclav Pech, Alex Tkachman Date: Jun 4, 2009
param:
Type of values to bind with the DataFlowVariable


Nested Class Summary
class DataFlowVariable.RemoteDataFlowVariable

 
Field Summary
 
Fields inherited from class DataFlowExpression
S_INITIALIZED, S_INITIALIZING, S_NOT_INITIALIZED, state, stateUpdater, value, waitingUpdater
 
Constructor Summary
DataFlowVariable()

Creates a new unbound Dataflow Variable

 
Method Summary
Class getRemoteClass()

void leftShift(T value)

Assigns a value to the variable.

void leftShift(DataFlowExpression ref)

Assigns a value from one DataFlowVariable instance to this variable.

 
Methods inherited from class DataFlowExpression
DataFlowExpression, bind, bindSafely, doBindRemote, evaluate, getMetaClass, getProperty, getVal, getVal, getValAsync, getValAsync, invokeMethod, isBound, rightShift, setMetaClass, setProperty, subscribe, subscribe, toString, transform, whenBound, whenBound
 

Constructor Detail

DataFlowVariable

public DataFlowVariable()
Creates a new unbound Dataflow Variable


 
Method Detail

getRemoteClass

@Override
public Class getRemoteClass()


leftShift

public void leftShift(T value)
Assigns a value to the variable. Can only be invoked once on each instance of DataFlowVariable
param:
value The value to assign


leftShift

public void leftShift(DataFlowExpression ref)
Assigns a value from one DataFlowVariable instance to this variable. Can only be invoked once on each instance of DataFlowVariable
param:
ref The DataFlowVariable instance the value of which to bind


 

Groovy Documentation