cascading.operation.aggregator
Class ExtremaBase

java.lang.Object
  extended by cascading.operation.BaseOperation
      extended by cascading.operation.aggregator.ExtremaBase
All Implemented Interfaces:
Aggregator, Operation, Serializable
Direct Known Subclasses:
Max, Min

public abstract class ExtremaBase
extends BaseOperation
implements Aggregator

Class ExtremaBase is the base class for Max and Min. The unique thing about Max and Min are that they return the original, un-coerced, argument value, though a coerced version of the argument is used for the comparison.

See Also:
Serialized Form

Field Summary
protected  Collection ignoreValues
          Field ignoreValues
 
Fields inherited from class cascading.operation.BaseOperation
fieldDeclaration, numArgs
 
Fields inherited from interface cascading.operation.Operation
ANY
 
Constructor Summary
  ExtremaBase(Fields fieldDeclaration)
           
protected ExtremaBase(Fields fieldDeclaration, Object... ignoreValues)
           
  ExtremaBase(int numArgs, Fields fieldDeclaration)
           
 
Method Summary
 void aggregate(Map context, TupleEntry entry)
          Method aggregate is called for each TupleEntry value in the current grouping.
protected abstract  boolean compare(Number lhs, Number rhs)
           
 void complete(Map context, TupleCollector outputCollector)
          Method complete will be issued last after every TupleEntry has been passed to the Aggregator.aggregate(Map, TupleEntry) method.
protected abstract  double getInitialValue()
           
 void start(Map context, TupleEntry groupEntry)
          Method start initializes the aggregation procedure.
 
Methods inherited from class cascading.operation.BaseOperation
getFieldDeclaration, getNumArgs, printOperationInternal, toString, toStringInternal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface cascading.operation.Operation
getFieldDeclaration, getNumArgs
 

Field Detail

ignoreValues

protected final Collection ignoreValues
Field ignoreValues

Constructor Detail

ExtremaBase

public ExtremaBase(Fields fieldDeclaration)

ExtremaBase

public ExtremaBase(int numArgs,
                   Fields fieldDeclaration)

ExtremaBase

protected ExtremaBase(Fields fieldDeclaration,
                      Object... ignoreValues)
Method Detail

start

public void start(Map context,
                  TupleEntry groupEntry)
Description copied from interface: Aggregator
Method start initializes the aggregation procedure. The Map context is used to hold intermediate values. The context should be initialized here if necessary. This method will be called before Aggregator.aggregate(Map, TupleEntry) and Aggregator.complete(java.util.Map,cascading.tuple.TupleCollector).

TupleEntry groupEntry, or groupEntry.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:
start in interface Aggregator
Parameters:
context - the map to be initialized (if necessary)
groupEntry - is the current grouping tuple
See Also:
Aggregator.start(java.util.Map , cascading.tuple.TupleEntry)

getInitialValue

protected abstract double getInitialValue()

aggregate

public void aggregate(Map context,
                      TupleEntry entry)
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
Parameters:
context - the map with aggregate values so far
entry - the tuple entry to add to the operation
See Also:
Aggregator.aggregate(java.util.Map, cascading.tuple.TupleEntry)

compare

protected abstract boolean compare(Number lhs,
                                   Number rhs)

complete

public void complete(Map context,
                     TupleCollector outputCollector)
Description copied from interface: Aggregator
Method complete will be issued last after every TupleEntry has been passed to the Aggregator.aggregate(Map, TupleEntry) method. Any final calculation should be completed here and passed to the outputCollector.

Specified by:
complete in interface Aggregator
Parameters:
context - the aggregate map @return the final aggregate value
See Also:
Aggregator.complete(java.util.Map, cascading.tuple.TupleCollector)


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