pt.runtime
Interface Reduction<E>

Type Parameters:
E - The type of elements to be reduced

public interface Reduction<E>

Define a reduction of two items into one. This definition may then be used to reduce a collection of items into one item. This is primarily intended for reducing the results from a multi-task (see TaskIDGroup.reduce(Reduction)).

This approach allows the programmer to easily define complex reductions that could even involve entire data structures, for example concatenating lists or maps. A reduction must be:

For convenience, some pre-defined reductions are included to be used for common types.

Author:
Nasser Giacaman, Oliver Sinnen

Field Summary
static Reduction<java.lang.Object[]> ArrayCOMBINE
          Combines the elements from the arrays into a new array.
static Reduction<java.lang.Boolean> BooleanAND
          Performs a Boolean AND
static Reduction<java.lang.Boolean> BooleanOR
          Performs a Boolean OR
static Reduction<java.lang.Double> DoubleMAX
          Perform a maximum reduction for Double values.
static Reduction<java.lang.Double> DoubleMIN
          Perform a minimum reduction for Double values.
static Reduction<java.lang.Double> DoubleSUM
          Perform a sum reduction for Double values.
static Reduction<java.lang.Integer> IntegerMAX
          Perform a maximum reduction for Integer values.
static Reduction<java.lang.Integer> IntegerMIN
          Perform a minimum reduction for Integer values.
static Reduction<java.lang.Integer> IntegerSUM
          Perform a sum reduction for Integer values.
 
Method Summary
 E combine(E a, E b)
          Specifies a reduction as defined by 2 elements into 1.
 

Field Detail

IntegerMIN

static final Reduction<java.lang.Integer> IntegerMIN
Perform a minimum reduction for Integer values.


IntegerMAX

static final Reduction<java.lang.Integer> IntegerMAX
Perform a maximum reduction for Integer values.


IntegerSUM

static final Reduction<java.lang.Integer> IntegerSUM
Perform a sum reduction for Integer values.


DoubleMIN

static final Reduction<java.lang.Double> DoubleMIN
Perform a minimum reduction for Double values.


DoubleMAX

static final Reduction<java.lang.Double> DoubleMAX
Perform a maximum reduction for Double values.


DoubleSUM

static final Reduction<java.lang.Double> DoubleSUM
Perform a sum reduction for Double values.


ArrayCOMBINE

static final Reduction<java.lang.Object[]> ArrayCOMBINE
Combines the elements from the arrays into a new array.


BooleanOR

static final Reduction<java.lang.Boolean> BooleanOR
Performs a Boolean OR


BooleanAND

static final Reduction<java.lang.Boolean> BooleanAND
Performs a Boolean AND

Method Detail

combine

E combine(E a,
          E b)
Specifies a reduction as defined by 2 elements into 1. The reduction must obey the following constraints: