Package org.geotools.feature.visitor
Class StandardDeviationVisitor
- Object
-
- StandardDeviationVisitor
-
- All Implemented Interfaces:
FeatureVisitor,FeatureAttributeVisitor,FeatureCalc
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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classStandardDeviationVisitor.Result
-
Constructor Summary
Constructors Constructor Description StandardDeviationVisitor(Expression expr)Constructs a standard deviation visitor based on the specified expression
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExpressiongetExpression()List<Expression>getExpressions()List of expressions used by visitor.doublegetMean()mean value generated when calcualting standard deviationintgetNaNCount()intgetNullCount()CalcResultgetResult()Returns the result of the calculation as a handy object which can be merged and modified.Optional<List<Class>>getResultType(List<Class> inputTypes)Returns the expected output type given the input type.voidinit(SimpleFeatureCollection collection)voidreset()voidsetValue(Object value)voidvisit(Feature feature)Visit the provided feature.voidvisit(SimpleFeature feature)
-
-
-
Constructor Detail
-
StandardDeviationVisitor
public StandardDeviationVisitor(Expression expr)
Constructs a standard deviation visitor based on the specified expression
-
-
Method Detail
-
init
public void init(SimpleFeatureCollection collection)
-
getExpression
public Expression getExpression()
-
setValue
public void setValue(Object value)
-
getExpressions
public List<Expression> getExpressions()
Description copied from interface:FeatureAttributeVisitorList of expressions used by visitor.- Specified by:
getExpressionsin interfaceFeatureAttributeVisitor
-
getResultType
public Optional<List<Class>> getResultType(List<Class> inputTypes)
Description copied from interface:FeatureAttributeVisitorReturns the expected output type given the input type.- Specified by:
getResultTypein interfaceFeatureAttributeVisitor- Parameters:
inputTypes- The type of the input expressions
-
getResult
public CalcResult getResult()
Description copied from interface:FeatureCalcReturns the result of the calculation as a handy object which can be merged and modified.- Specified by:
getResultin interfaceFeatureCalc- Returns:
- the results of the calculation
-
visit
public void visit(SimpleFeature feature)
-
visit
public void visit(Feature feature)
Description copied from interface:FeatureVisitorVisit 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:
visitin interfaceFeatureVisitor
-
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
-
-