simpledb.materialize
Class MaxFn

java.lang.Object
  extended by simpledb.materialize.MaxFn
All Implemented Interfaces:
AggregationFn

public class MaxFn
extends Object
implements AggregationFn

The max aggregation function.

Author:
Edward Sciore

Constructor Summary
MaxFn(String fldname)
          Creates a max aggregation function for the specified field.
 
Method Summary
 String fieldName()
          Returns the field's name, prepended by "maxof".
 void processFirst(Scan s)
          Starts a new maximum to be the field value in the current record.
 void processNext(Scan s)
          Replaces the current maximum by the field value in the current record, if it is higher.
 Constant value()
          Returns the current maximum.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MaxFn

public MaxFn(String fldname)
Creates a max aggregation function for the specified field.

Parameters:
fldname - the name of the aggregated field
Method Detail

processFirst

public void processFirst(Scan s)
Starts a new maximum to be the field value in the current record.

Specified by:
processFirst in interface AggregationFn
Parameters:
s - the scan to aggregate over.
See Also:
AggregationFn.processFirst(simpledb.query.Scan)

processNext

public void processNext(Scan s)
Replaces the current maximum by the field value in the current record, if it is higher.

Specified by:
processNext in interface AggregationFn
Parameters:
s - the scan to aggregate over.
See Also:
AggregationFn.processNext(simpledb.query.Scan)

fieldName

public String fieldName()
Returns the field's name, prepended by "maxof".

Specified by:
fieldName in interface AggregationFn
Returns:
the name of the new aggregation field
See Also:
AggregationFn.fieldName()

value

public Constant value()
Returns the current maximum.

Specified by:
value in interface AggregationFn
Returns:
the computed aggregation value
See Also:
AggregationFn.value()


Copyright © 2011. All Rights Reserved.