| 
org.codehaus.gpars | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectgroovy.lang.GroovyObjectSupport
groovyx.gpars.dataflow.Dataflows
public final class Dataflows extends groovy.lang.GroovyObjectSupport
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]
 
 | Field Summary | |
|---|---|
        static int | 
        
            DEFAULT_CONCURRENCY_LEVEL
             | 
        
        static int | 
        
            DEFAULT_INITIAL_CAPACITY
             | 
        
        static float | 
        
            DEFAULT_LOAD_FACTOR
             | 
        
        private static DataflowVariable | 
        
            DUMMY
             | 
        
        private java.lang.Object | 
        
            lock
             | 
        
        private java.util.concurrent.ConcurrentMap | 
        
            variables
             | 
        
| Constructor Summary | |
            Dataflows(int initialCapacity, float loadFactor, int concurrencyLevel)
            Constructor with default values for building the underlying ConcurrentHashMap  | 
        |
            Dataflows()
             | 
        |
| Method Summary | |
|---|---|
            boolean
         | 
        
            contains(java.lang.Object name)
            Convenience method to play nicely with Groovy object iteration methods.  | 
        
            private DataflowVariable
         | 
        
            ensureToContainVariable(java.lang.Object name)
            Utility method extracted just to help JIT  | 
        
            java.lang.Object
         | 
        
            getAt(int index)
            Binds the value to the DataflowVariable that is associated with the property "index".  | 
        
            java.lang.Object
         | 
        
            getProperty(java.lang.String property)
             | 
        
            java.lang.Object
         | 
        
            invokeMethod(java.lang.String name, java.lang.Object args)
             | 
        
            java.util.Iterator
         | 
        
            iterator()
             | 
        
            void
         | 
        
            putAt(java.lang.Object index, java.lang.Object value)
             | 
        
            private DataflowVariable
         | 
        
            putNewUnderLock(java.lang.Object name)
             | 
        
            DataflowVariable
         | 
        
            remove(java.lang.Object name)
            Checks whether a certain key is contained in the map.  | 
        
            void
         | 
        
            setProperty(java.lang.String property, java.lang.Object newValue)
             | 
        
| Methods inherited from class groovy.lang.GroovyObjectSupport | |
|---|---|
| groovy.lang.GroovyObjectSupport#setProperty(java.lang.String, java.lang.Object), groovy.lang.GroovyObjectSupport#getProperty(java.lang.String), groovy.lang.GroovyObjectSupport#invokeMethod(java.lang.String, java.lang.Object), groovy.lang.GroovyObjectSupport#getMetaClass(), groovy.lang.GroovyObjectSupport#setMetaClass(groovy.lang.MetaClass), groovy.lang.GroovyObjectSupport#wait(long, int), groovy.lang.GroovyObjectSupport#wait(long), groovy.lang.GroovyObjectSupport#wait(), groovy.lang.GroovyObjectSupport#equals(java.lang.Object), groovy.lang.GroovyObjectSupport#toString(), groovy.lang.GroovyObjectSupport#hashCode(), groovy.lang.GroovyObjectSupport#getClass(), groovy.lang.GroovyObjectSupport#notify(), groovy.lang.GroovyObjectSupport#notifyAll() | 
| 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 | 
|---|
static final int DEFAULT_CONCURRENCY_LEVEL
static final int DEFAULT_INITIAL_CAPACITY
static final float DEFAULT_LOAD_FACTOR
private static final DataflowVariable DUMMY
private final java.lang.Object lock
@java.lang.SuppressWarnings* Resizing may be performed when the average number of elements per private java.util.concurrent.ConcurrentMap variables
| Constructor Detail | 
|---|
public Dataflows(int initialCapacity, float loadFactor, int concurrencyLevel)
public Dataflows()
| Method Detail | 
|---|
public boolean contains(java.lang.Object name)
private DataflowVariable ensureToContainVariable(java.lang.Object name)
name -  The key to ensure has a DFV bound to it
@java.lang.SuppressWarnings/** java.lang.Object getAt(int index)
index -  The index to associate the value withvalue -  a scalar or a DataflowVariable that may block on value access
@java.lang.Override* public java.lang.Object getProperty(java.lang.String property)
@java.lang.Override* @throws InterruptedException If the thread gets interrupted public java.lang.Object invokeMethod(java.lang.String name, java.lang.Object args)
public java.util.Iterator iterator()
void putAt(java.lang.Object index, java.lang.Object value)
private DataflowVariable putNewUnderLock(java.lang.Object name)
public DataflowVariable remove(java.lang.Object name)
name -  The name of the DFV to check.
@java.lang.Override} public void setProperty(java.lang.String property, java.lang.Object newValue)
Copyright © 2008–2013 Václav Pech. All Rights Reserved.