Groovy Documentation

gpars
[Groovy] Class AbstractPAWrapper

java.lang.Object
  gpars.AbstractPAWrapper

abstract class AbstractPAWrapper

Wraps a ParallelArray instance in map/reduce operation chains.


Property Summary
def pa

The wrapper ParallelArray instance

 
Constructor Summary
AbstractPAWrapper(def pa)

Creates an instance wrapping the supplied instance of ParallelArray

 
Method Summary
AbstractPAWrapper filter(groovy.lang.Closure cl)

Filters concurrently elements in the collection based on the outcome of the supplied function on each of the elements.

Object getCollection()

Reconstructs a collection from the wrapped ParallelArray instance

AbstractPAWrapper map(groovy.lang.Closure cl)

Applies concurrently the supplied function to all elements in the collection, returning a collection containing the transformed values.

Object max()

Finds in parallel the maximum of all values in the collection.

Object max(groovy.lang.Closure cl)

Finds in parallel the maximum of all values in the collection.

Object min()

Finds in parallel the minimum of all values in the collection.

Object min(groovy.lang.Closure cl)

Finds in parallel the minimum of all values in the collection.

Object reduce(groovy.lang.Closure cl)

Performs a parallel reduce operation.

Object reduce(def seed, groovy.lang.Closure cl)

Performs a parallel reduce operation.

int size()

Size of the collection

Object sum()

Summarizes all elements of the collection in parallel using the "plus()" operator of the elements

 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Property Detail

pa

final def pa
The wrapper ParallelArray instance


 
Constructor Detail

AbstractPAWrapper

AbstractPAWrapper(def pa)
Creates an instance wrapping the supplied instance of ParallelArray


 
Method Detail

filter

AbstractPAWrapper filter(groovy.lang.Closure cl)
Filters concurrently elements in the collection based on the outcome of the supplied function on each of the elements.
Parameters:
A - closure indicating whether to propagate the given element into the filtered collection
Returns:
A collection holding the allowed values


getCollection

final Object getCollection()
Reconstructs a collection from the wrapped ParallelArray instance
Returns:
A collection containing all elements of the wrapped ParallelArray


map

final AbstractPAWrapper map(groovy.lang.Closure cl)
Applies concurrently the supplied function to all elements in the collection, returning a collection containing the transformed values.
Parameters:
A - closure calculating a transformed value from the original one
Returns:
A collection holding the new values


max

final Object max()
Finds in parallel the maximum of all values in the collection. The implicit comparator is used.
Returns:
The maximum element of the collection


max

final Object max(groovy.lang.Closure cl)
Finds in parallel the maximum of all values in the collection. The supplied comparator is used. If the supplied closure takes two arguments it is used directly as a comparator. If the supplied closure takes one argument, the values returned by the supplied closure for individual elements are used for comparison by the implicit comparator.
Parameters:
cl - A one or two-argument closure
Returns:
The maximum element of the collection


min

final Object min()
Finds in parallel the minimum of all values in the collection. The implicit comparator is used.
Returns:
The minimum element of the collection


min

final Object min(groovy.lang.Closure cl)
Finds in parallel the minimum of all values in the collection. The supplied comparator is used. If the supplied closure takes two arguments it is used directly as a comparator. If the supplied closure takes one argument, the values returned by the supplied closure for individual elements are used for comparison by the implicit comparator.
Parameters:
cl - A one or two-argument closure
Returns:
The minimum element of the collection


reduce

final Object reduce(groovy.lang.Closure cl)
Performs a parallel reduce operation. It will use the supplied two-argument closure to gradually reduce two elements into one.
Parameters:
cl - A two-argument closure merging two elements into one. The return value of the closure will replace the original two elements.
Returns:
The product of reduction


reduce

final Object reduce(def seed, groovy.lang.Closure cl)
Performs a parallel reduce operation. It will use the supplied two-argument closure to gradually reduce two elements into one.
Parameters:
cl - A two-argument closure merging two elements into one. The return value of the closure will replace the original two elements.
Returns:
The product of reduction


size

final int size()
Size of the collection
Returns:
The number of elements in the collection


sum

final Object sum()
Summarizes all elements of the collection in parallel using the "plus()" operator of the elements
Returns:
The summary od all elements in the collection


 

Groovy Documentation