org.geotools.feature.visitor
Class StandardDeviationVisitor

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

public class StandardDeviationVisitor
extends Object
implements FeatureCalc, FeatureAttributeVisitor

Determines the standard deviation.

            ----------------------------
            |  1   ---
 Std dev =  | ___  \   ( x - mean ) ^ 2
           \|  N   /__
 
aka std dev = sqrt((sum((x-mean)^2))/N) where N is the number of samples. It uses the rolling variance algorithm described here: http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#On-line_algorithm

Author:
Cory Horner, Refractions Research Inc., Andrea Aime, GeoSolutions

Constructor Summary
StandardDeviationVisitor(Expression expr)
          Constructs a standard deviation visitor based on the specified expression
StandardDeviationVisitor(Expression expr, double average)
          Deprecated. use StandardDeviationVisitor(Expression) insteads
 
Method Summary
 List<Expression> getExpressions()
          List of expressions used by visitor.
 double getMean()
          mean value generated when calcualting standard deviation
 int getNaNCount()
           
 int getNullCount()
           
 CalcResult getResult()
          Returns the result of the calculation as a handy object which can be merged and modified.
 void init(SimpleFeatureCollection collection)
           
 void reset()
           
 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

StandardDeviationVisitor

@Deprecated
public StandardDeviationVisitor(Expression expr,
                                           double average)
Deprecated. use StandardDeviationVisitor(Expression) insteads

Constructor left for backwards compatibility. The current algorithm uses a on line computation that does not require the average to be calculated in advance

Parameters:
expr -
average -

StandardDeviationVisitor

public StandardDeviationVisitor(Expression expr)
Constructs a standard deviation visitor based on the specified expression

Parameters:
expr -
average -
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

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

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

reset

public void reset()

getMean

public double getMean()
mean value generated when calcualting standard deviation


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


Copyright © 1996-2014 Geotools. All Rights Reserved.