org.geotools.feature.visitor
Class MedianVisitor

Object
  extended by MedianVisitor
All Implemented Interfaces:
FeatureAttributeVisitor, FeatureCalc, FeatureVisitor

public class MedianVisitor
extends Object
implements FeatureCalc, FeatureAttributeVisitor

Calculates the median of an attribute in all features of a collection

Since:
2.2.M2
Author:
Cory Horner, Refractions

Nested Class Summary
static class MedianVisitor.MedianResult
           
 
Constructor Summary
MedianVisitor(Expression expr)
           
MedianVisitor(int attributeTypeIndex, SimpleFeatureType type)
           
MedianVisitor(String attributeTypeName)
           
MedianVisitor(String attrName, SimpleFeatureType type)
           
 
Method Summary
 Expression getExpression()
           
 List<Expression> getExpressions()
          List of expressions used by visitor.
 Object getMedian()
          Return the median of all features in the collection
 CalcResult getResult()
          Returns the result of the calculation as a handy object which can be merged and modified.
 void init(SimpleFeatureCollection collection)
           
 void reset()
          Reset the stored information about the median.
 void setValue(Comparable median)
           
 void setValue(List list)
           
 void visit(Feature feature)
          Visit the provided feature.
 void visit(SimpleFeature feature)
           
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MedianVisitor

public MedianVisitor(String attributeTypeName)

MedianVisitor

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

MedianVisitor

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

MedianVisitor

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

init

public void init(SimpleFeatureCollection collection)

getExpressions

public List<Expression> getExpressions()
Description copied from interface: FeatureAttributeVisitor
List of expressions used by visitor.

Specified by:
getExpressions in interface FeatureAttributeVisitor

visit

public void visit(SimpleFeature feature)

visit

public void visit(Feature feature)
Description copied from interface: FeatureVisitor
Visit the provided feature.

Please consult the documentation for the FeatureCollection you are visiting to learn more - the provided feature may be invalid, or read only.

Specified by:
visit in interface FeatureVisitor

getExpression

public Expression getExpression()

getMedian

public Object getMedian()
Return the median of all features in the collection


reset

public void reset()
Reset the stored information about the median.


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(List list)

setValue

public void setValue(Comparable median)


Copyright © 1996-2014 Geotools. All Rights Reserved.