GridGain™ 3.6.0e
Enterprise Edition

org.gridgain.grid.lang
Class GridReducer3<E1,E2,E3,R>

java.lang.Object
  extended by org.gridgain.grid.lang.GridMetadataAwareAdapter
      extended by org.gridgain.grid.lang.GridLambdaAdapter
          extended by org.gridgain.grid.lang.GridOutClosure<R>
              extended by 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.

Thread Safety

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.

Wiki & Forum:


Wiki
Forum

See Also:
Serialized Form
 

Constructor Summary
GridReducer3()
           
 
Method Summary
abstract  boolean collect(E1 e1, E2 e2, E3 e3)
          Collects given values.
 GridOutClosure<R> curry(GridTuple3<E1,E2,E3>... t)
          Curries this closure with given tuple values.
 
Methods inherited from class org.gridgain.grid.lang.GridOutClosure
andThen, andThen, apply, call, cancel, execute, uncurry, uncurry2, uncurry3
 
Methods inherited from class org.gridgain.grid.lang.GridLambdaAdapter
classLoader, deployClass, peerDeployLike, withMeta
 
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 class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.gridgain.grid.GridMetadataAware
addMeta, addMetaIfAbsent, addMetaIfAbsent, allMeta, copyMeta, copyMeta, hasMeta, hasMeta, meta, putMetaIfAbsent, putMetaIfAbsent, removeMeta, removeMeta, replaceMeta
 

Constructor Detail

GridReducer3

public GridReducer3()
Method Detail

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.

GridGain™ 3.6.0e
Enterprise Edition

GridGain - Real Time Big Data
Enterprise Edition, ver. 3.6.0e.13012012
2012 Copyright © GridGain Systems
Follow us:   Follow GridGain on Github Follow GridGain on Facebook Join GridGain User Group Follow GridGain on Twitter Follow GridGain on YouTube