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 class
StandardDeviationVisitor.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 Expression
getExpression()
List<Expression>
getExpressions()
List of expressions used by visitor.double
getMean()
mean value generated when calcualting standard deviationint
getNaNCount()
int
getNullCount()
CalcResult
getResult()
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.void
init(SimpleFeatureCollection collection)
void
reset()
void
setValue(Object value)
void
visit(Feature feature)
Visit the provided feature.void
visit(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:FeatureAttributeVisitor
List of expressions used by visitor.- Specified by:
getExpressions
in interfaceFeatureAttributeVisitor
-
getResultType
public Optional<List<Class>> getResultType(List<Class> inputTypes)
Description copied from interface:FeatureAttributeVisitor
Returns the expected output type given the input type.- Specified by:
getResultType
in interfaceFeatureAttributeVisitor
- Parameters:
inputTypes
- The type of the input expressions
-
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 interfaceFeatureCalc
- 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 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
-
-