org.geotools.feature.visitor
Class MaxVisitor

Object
  extended by MaxVisitor
All Implemented Interfaces:
FeatureCalc, FeatureVisitor

public class MaxVisitor
extends Object
implements FeatureCalc

Calculates the maximum value of an attribute.

Since:
2.2.M2
Author:
Cory Horner, Refractions Research Inc.
Module:

Nested Class Summary
static class MaxVisitor.MaxResult
           
 
Constructor Summary
MaxVisitor(Expression expr)
           
MaxVisitor(int attributeTypeIndex, SimpleFeatureType type)
           
MaxVisitor(String attributeTypeName)
           
MaxVisitor(String attrName, SimpleFeatureType type)
           
 
Method Summary
 Expression getExpression()
           
 Comparable getMax()
          Get the max value.
 int getNaNCount()
           
 int getNullCount()
           
 CalcResult getResult()
          Returns the result of the calculation as a handy object which can be merged and modified.
 void init(FeatureCollection<SimpleFeatureType,SimpleFeature> collection)
           
 void reset()
           
 void setValue(Object result)
          Overwrites the result stored by the visitor.
 void visit(Feature feature)
           
 void visit(SimpleFeature feature)
          Visitor function, which looks at each feature and finds the maximum.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MaxVisitor

public MaxVisitor(String attributeTypeName)

MaxVisitor

public MaxVisitor(int attributeTypeIndex,
                  SimpleFeatureType type)
           throws IllegalFilterException
Throws:
IllegalFilterException

MaxVisitor

public MaxVisitor(String attrName,
                  SimpleFeatureType type)
           throws IllegalFilterException
Throws:
IllegalFilterException

MaxVisitor

public MaxVisitor(Expression expr)
           throws IllegalFilterException
Throws:
IllegalFilterException
Method Detail

init

public void init(FeatureCollection<SimpleFeatureType,SimpleFeature> collection)

visit

public void visit(SimpleFeature feature)
Visitor function, which looks at each feature and finds the maximum.

Parameters:
feature - the feature to be visited

visit

public void visit(Feature feature)
Specified by:
visit in interface FeatureVisitor

getMax

public Comparable getMax()
Get the max value.

Returns:
Max value
Throws:
IllegalStateException - DOCUMENT ME!

getNaNCount

public int getNaNCount()
Returns:
the number of features which returned a NaN

getNullCount

public int getNullCount()
Returns:
the number of features which returned a null

reset

public void reset()

getExpression

public Expression getExpression()

getResult

public CalcResult getResult()
Description copied from interface: FeatureCalc
Returns the result of the calculation as a handy object which can be merged and modified.

Specified by:
getResult in interface FeatureCalc
Returns:
the results of the calculation

setValue

public void setValue(Object result)
Overwrites the result stored by the visitor. This should only be used by optimizations which will tell the visitor the answer rather than visiting all features.

For 'max', the value stored is of type 'Comparable'.

Parameters:
result -


Copyright © 1996-2009 Geotools. All Rights Reserved.