|
org.codehaus.gpars | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object groovyx.gpars.util.PAUtils
@SuppressWarnings({"UtilityClass", "AbstractClassWithoutAbstractMethods", "AbstractClassNeverImplemented", "StaticMethodOnlyUsedInOneClass"}) public abstract class PAUtils extends java.lang.Object
Handy methods build PA from different types
Constructor Summary | |
PAUtils()
|
Method Summary | |
---|---|
static groovy.lang.Closure
|
buildClosureForMaps(groovy.lang.Closure cl)
If the passed-in closure expects two arguments, it is considered to be a map-iterative code and is then wrapped with a single-argument closure, which unwraps the key:value pairs for the original closure. |
static groovy.lang.Closure
|
buildClosureForMapsWithIndex(groovy.lang.Closure cl)
If the passed-in closure expects three arguments, it is considered to be a map-iterative_with_index code and is then wrapped with a two-argument closure, which unwraps the key:value pairs for the original closure. |
static java.util.Map
|
buildResultMap(java.util.Collection result)
Builds a resulting map out of an map entry collection |
static String[]
|
createArray(java.lang.CharSequence value)
|
static java.lang.Object
|
createArray(java.util.Map map)
|
static java.util.Collection
|
createCollection(java.lang.Iterable object)
|
static java.util.Collection
|
createCollection(java.util.Iterator iterator)
|
static java.util.Comparator
|
createComparator(groovy.lang.Closure handler)
Builds a comparator depending on the number of arguments accepted by the supplied closure. |
static groovy.lang.Closure
|
createGroupByClosure(groovy.lang.Closure cl, java.util.concurrent.ConcurrentMap map)
Creates a closure that will insert elements in the appropriate group |
static void
|
evaluateArguments(Pool pool, Object[] args, int current, java.util.List soFarArgs, DataflowVariable result, groovy.lang.Closure original, boolean pooledThreadFlag)
Performs a single step in the evaluation of parameters passed into an asynchronous function |
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() |
Constructor Detail |
---|
PAUtils()
Method Detail |
---|
public static groovy.lang.Closure buildClosureForMaps(groovy.lang.Closure cl)
cl
- The closure to use for parallel methods
public static groovy.lang.Closure buildClosureForMapsWithIndex(groovy.lang.Closure cl)
cl
- The closure to use for parallel methods
public static java.util.Map buildResultMap(java.util.Collection result)
result
- The collection containing map entries
public static String[] createArray(java.lang.CharSequence value)
public static java.lang.Object createArray(java.util.Map map)
public static java.util.Collection createCollection(java.lang.Iterable object)
public static java.util.Collection createCollection(java.util.Iterator iterator)
public static java.util.Comparator createComparator(groovy.lang.Closure handler)
handler
- The one or two argument closure to build a comparator on
public static groovy.lang.Closure createGroupByClosure(groovy.lang.Closure cl, java.util.concurrent.ConcurrentMap map)
cl
- The distinction closuremap
- The map of groups to contribute to
@SuppressWarnings({"unchecked"}) public static void evaluateArguments(Pool pool, Object[] args, int current, java.util.List soFarArgs, DataflowVariable result, groovy.lang.Closure original, boolean pooledThreadFlag)
pool
- The thread pool to useargs
- The list of original argumentscurrent
- The index of the current argument to evaluatesoFarArgs
- A list of arguments evaluated so farresult
- The DFV expecting the function result to be bound to once calculatedoriginal
- The original non-asynchronous function to invoke once all arguments are availablepooledThreadFlag
- Indicates, whether we now run in a pooled thread so we don't have to schedule the original function invocation, once all arguments have been bound
Copyright © 2008–2010 Václav Pech. All Rights Reserved.