Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## cascading.operation.aggregator
Class Sum

    java.lang.Object
      cascading.operation.BaseOperation<Pair<Double[],Tuple>>
          cascading.operation.aggregator.Sum

All Implemented Interfaces:
  Aggregator<Pair<Double[],Tuple>>, Operation<Pair<Double[],Tuple>>, Serializable

    public class Sum

extends BaseOperation<Pair<Double[],Tuple>>
implements Aggregator<Pair<Double[],Tuple>>

Class Sum is an `Aggregator` that returns the sum of all numeric values in the current group.

See Also:
  Serialized Form

Field Summary
`static String` | `FIELD_NAME` Field FIELD_NAME

Fields inherited from class cascading.operation.BaseOperation
`fieldDeclaration, numArgs, trace`

Fields inherited from interface cascading.operation.Operation
`ANY`

Constructor Summary
`Sum()` Constructor Sum creates a new Sum instance that accepts one argument and returns a single field named "sum".
`Sum(Fields fieldDeclaration)` Constructs a new instance that returns the fields declared in fieldDeclaration and accepts only 1 argument.
`Sum(Fields fieldDeclaration, Class type)` Constructs a new instance that returns the fields declared in fieldDeclaration and accepts only 1 argument.

Method Summary
`void` | `aggregate(FlowProcess flowProcess, AggregatorCall<Pair<Double[],Tuple>> aggregatorCall)` Method aggregate is called for each `TupleEntry` value in the current grouping.
`void` | `complete(FlowProcess flowProcess, AggregatorCall<Pair<Double[],Tuple>> aggregatorCall)` Method complete will be issued last after every `TupleEntry` has been passed to the `Aggregator.aggregate(cascading.flow.FlowProcess, AggregatorCall)` method.
`boolean` | `equals(Object object)`
`protected Tuple` | `getResult(AggregatorCall<Pair<Double[],Tuple>> aggregatorCall)`
`Type` | `getType()`
`int` | `hashCode()`
`void` | `prepare(FlowProcess flowProcess, OperationCall<Pair<Double[],Tuple>> operationCall)` Method prepare does nothing, and may safely be overridden.
`void` | `start(FlowProcess flowProcess, AggregatorCall<Pair<Double[],Tuple>> aggregatorCall)` Method start initializes the aggregation procedure and is called for every unique grouping.

Methods inherited from class cascading.operation.BaseOperation
`cleanup, flush, getFieldDeclaration, getNumArgs, getTrace, isSafe, printOperationInternal, toString, toStringInternal`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface cascading.operation.Operation
`cleanup, flush, getFieldDeclaration, getNumArgs, isSafe`

Field Detail

### FIELD_NAME

    public static final String FIELD_NAME

  Field FIELD_NAME

  See Also:
    Constant Field Values

Constructor Detail

### Sum

    public Sum()

  Constructor Sum creates a new Sum instance that accepts one argument and returns a single field named "sum".

### Sum

    @ConstructorProperties(value="fieldDeclaration")
    public Sum(Fields fieldDeclaration)

  Constructs a new instance that returns the fields declared in fieldDeclaration and accepts only 1 argument.

  If the given `fieldDeclaration` has a type, it will be used to coerce the result value.

  Parameters:
    `fieldDeclaration` - of type Fields

### Sum

    @ConstructorProperties(value={"fieldDeclaration","type"})
    public Sum(Fields fieldDeclaration,
                                          Class type)

  Constructs a new instance that returns the fields declared in fieldDeclaration and accepts only 1 argument. The return result is coerced into the given Class type.

  Parameters:
    `fieldDeclaration` - of type Fields
    `type` - of type Class

Method Detail

### getType

    public Type getType()

### prepare

    public void prepare(FlowProcess flowProcess,
                        OperationCall<Pair<Double[],Tuple>> operationCall)

  Description copied from class: `BaseOperation`
  Method prepare does nothing, and may safely be overridden.

  Specified by:
    `prepare` in interface `Operation<Pair<Double[],Tuple>>`
  Overrides:
    `prepare` in class `BaseOperation<Pair<Double[],Tuple>>`

### start

    public void start(FlowProcess flowProcess,
                      AggregatorCall<Pair<Double[],Tuple>> aggregatorCall)

  Description copied from interface: `Aggregator`
  Method start initializes the aggregation procedure and is called for every unique grouping.

  The AggregatorCall context should be initialized here if necessary.

  The first time this method is called for a given 'process', the AggregatorCall context will be null. This method should set a new instance of the user defined context object. When the AggregatorCall context is not null, it is up to the developer to create a new instance, or 'recycle' the given instance. If recycled, it must be re-initialized to remove any previous state/values.

  For example, if a Map is used to hold the intermediate data for each subsequent `Aggregator.aggregate(cascading.flow.FlowProcess, AggregatorCall)` call, new HashMap() should be set on the AggregatorCall instance when `OperationCall.getContext()` is null. On the next grouping, start() will be called again, but this time with the old Map instance. In this case, map.clear() should be invoked before returning.

  Specified by:
    `start` in interface `Aggregator<Pair<Double[],Tuple>>`
  Parameters:
    `flowProcess` - of type FlowProcess
    `aggregatorCall` - of type AggregatorCall

### aggregate

    public void aggregate(FlowProcess flowProcess,
                          AggregatorCall<Pair<Double[],Tuple>> aggregatorCall)

  Description copied from interface: `Aggregator`
  Method aggregate is called for each `TupleEntry` value in the current grouping.

  TupleEntry entry, or entry.getTuple() should not be stored directly in the context. A copy of the tuple should be made via the `new Tuple( entry.getTuple() )` copy constructor.

  Specified by:
    `aggregate` in interface `Aggregator<Pair<Double[],Tuple>>`
  Parameters:
    `flowProcess` - of type FlowProcess
    `aggregatorCall` - of type AggregatorCall

### complete

    public void complete(FlowProcess flowProcess,
                         AggregatorCall<Pair<Double[],Tuple>> aggregatorCall)

  Description copied from interface: `Aggregator`
  Method complete will be issued last after every `TupleEntry` has been passed to the `Aggregator.aggregate(cascading.flow.FlowProcess, AggregatorCall)` method. Any final calculation should be completed here and passed to the outputCollector.

  Specified by:
    `complete` in interface `Aggregator<Pair<Double[],Tuple>>`
  Parameters:
    `flowProcess` - of type FlowProcess
    `aggregatorCall` - of type AggregatorCall

### getResult

    protected Tuple getResult(AggregatorCall<Pair<Double[],Tuple>> aggregatorCall)

### equals

    public boolean equals(Object object)

  Overrides:
    `equals` in class `BaseOperation<Pair<Double[],Tuple>>`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `BaseOperation<Pair<Double[],Tuple>>`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2007-2013 Concurrent, Inc. All Rights Reserved.