|
Groovy Documentation | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | PROPERTY | CONSTR | METHOD | DETAIL: FIELD | PROPERTY | CONSTR | METHOD | |||||||
java.lang.Objectgpars.dataflow.DataFlows
class DataFlows
Convenience class that makes working with DataFlowVariables more comfortable. See the implementation of groovyx.gpars.samples.dataflow.DemoDataFlows for a full example. A DataFlows instance is a bean with properties of type DataFlowVariable. Property access is relayed to the access methods of DataFlowVariable. Each property is initialized lazily the first time it is accessed. Non-String named properties can be also accessed using array-like indexing syntax This allows a rather compact usage of DataFlowVariables like
final df = new DataFlows()
start { df[0] = df.x + df.y }
start { df.x = 10 }
start { df.y = 5 }
assert 15 == df[0]
| Property Summary | |
|---|---|
static int |
DEFAULT_CONCURRENCY_LEVEL
|
static int |
DEFAULT_INITIAL_CAPACITY
|
static float |
DEFAULT_LOAD_FACTOR
|
static int |
MAX_SEGMENTS
|
| Constructor Summary | |
DataFlows(int initialCapacity = DEFAULT_INITIAL_CAPACITY, float loadFactor = DEFAULT_LOAD_FACTOR, int concurrencyLevel = DEFAULT_CONCURRENCY_LEVEL)
Constructor that supports the various constructors of the underlying ConcurrentHashMap (unless the one with Map parameter). |
|
| Method Summary | |
|---|---|
def
|
contains(def name)
Checks whether a certain key is contained in the map. |
def
|
getAt(def index)
|
def
|
getProperty(String name)
|
def
|
invokeMethod(String name, Object args)
Invokes the given method. |
Iterator
|
iterator()
Convenience method to play nicely with Groovy object iteration methods. |
void
|
putAt(def index, def value)
Binds the value to the DataFlowVariable that is associated with the property "index". |
def
|
remove(def name)
Removes a DFV from the map and binds it to null, if it has not been bound yet |
void
|
setProperty(String name, def value)
Binds the value to the DataFlowVariable that is associated with the property "name". |
| Methods inherited from class Object | |
|---|---|
| wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
| Property Detail |
|---|
static final int DEFAULT_CONCURRENCY_LEVEL
static final int DEFAULT_INITIAL_CAPACITY
static final float DEFAULT_LOAD_FACTOR
static final int MAX_SEGMENTS
| Constructor Detail |
|---|
public DataFlows(int initialCapacity = DEFAULT_INITIAL_CAPACITY, float loadFactor = DEFAULT_LOAD_FACTOR, int concurrencyLevel = DEFAULT_CONCURRENCY_LEVEL)
| Method Detail |
|---|
public def contains(def name)
public def getAt(def index)
public def getProperty(String name)
public def invokeMethod(String name, Object args)
def df = new DataFlows()
df.var {* println "Variable bound to $it"
}*
public Iterator iterator()
void putAt(def index, def value)
public def remove(def name)
void setProperty(String name, def value)
Groovy Documentation