org.gridgain.grid.lang
Class GridReducer3<E1,E2,E3,R>
java.lang.Object
org.gridgain.grid.lang.GridMetadataAwareAdapter
org.gridgain.grid.lang.GridLambdaAdapter
org.gridgain.grid.lang.GridOutClosure<R>
org.gridgain.grid.lang.GridReducer3<E1,E2,E3,R>
- Type Parameters:
E1 - Type of the first free variable, i.e. the element the closure is called on.E2 - Type of the second free variable, i.e. the element the closure is called on.E3 - Type of the third free variable, i.e. the element the closure is called on.R - Type of the closure's return value.
- All Implemented Interfaces:
- Serializable, Cloneable, Callable<R>, GridJob, GridMetadataAware, GridPeerDeployAware, GridLambda
- Direct Known Subclasses:
- GridReducer3X, R3
public abstract class GridReducer3<E1,E2,E3,R>
- extends GridOutClosure<R>
Defines generic for-all or reduce type of closure. Unlike for-each type of closure
that returns optional value on each execution of the closure - the reducer returns a single
value for one or more collected values.
Closures are a first-class functions that are defined with
(or closed over) their free variables that are bound to the closure scope at execution. Since
Java 6 doesn't provide a language construct for first-class function the closures are implemented
as abstract classes.
Note that this interface does not impose or assume any specific thread-safety by its
implementations. Each implementation can elect what type of thread-safety it provides,
if any.
- See Also:
- Serialized Form
-
| Methods inherited from class org.gridgain.grid.lang.GridMetadataAwareAdapter |
addMeta, addMetaIfAbsent, addMetaIfAbsent, allMeta, clone, copyMeta, copyMeta, hasMeta, hasMeta, meta, putMetaIfAbsent, putMetaIfAbsent, readExternalMeta, removeMeta, removeMeta, replaceMeta, writeExternalMeta |
| Methods inherited from interface org.gridgain.grid.GridMetadataAware |
addMeta, addMetaIfAbsent, addMetaIfAbsent, allMeta, copyMeta, copyMeta, hasMeta, hasMeta, meta, putMetaIfAbsent, putMetaIfAbsent, removeMeta, removeMeta, replaceMeta |
GridReducer3
public GridReducer3()
collect
public abstract boolean collect(E1 e1,
E2 e2,
E3 e3)
- Collects given values. All values will be reduced by
GridOutClosure.apply() method.
- Parameters:
e1 - First bound free variable, i.e. the element the closure is called on.e2 - Second bound free variable, i.e. the element the closure is called on.e3 - Third bound free variable, i.e. the element the closure is called on.
- Returns:
true to continue collecting, false to instruct caller to stop
collecting and call GridOutClosure.apply() method.
curry
public GridOutClosure<R> curry(GridTuple3<E1,E2,E3>... t)
- Curries this closure with given tuple values. When result closure is called it will
be executed with given values.
- Parameters:
t - Tuples each with three values.
- Returns:
- Curried or partially applied closure with given values.