Package org.geotools.feature.visitor
Class MinVisitor
- Object
-
- MinVisitor
-
- All Implemented Interfaces:
FeatureVisitor,FeatureAttributeVisitor,FeatureCalc
public class MinVisitor extends Object implements FeatureCalc, FeatureAttributeVisitor
Calculates the minimum value of an attribute.- Since:
- 2.2.M2
- Author:
- Cory Horner, Refractions
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMinVisitor.MinResult
-
Constructor Summary
Constructors Constructor Description MinVisitor(int attributeTypeIndex, SimpleFeatureType type)MinVisitor(String attributeTypeName)MinVisitor(String attrName, SimpleFeatureType type)MinVisitor(Expression expr)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExpressiongetExpression()List<Expression>getExpressions()List of expressions used by visitor.ComparablegetMin()Get the min value.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 result)Overwrites the result stored by the visitor.voidvisit(Feature feature)Visit the provided feature.voidvisit(SimpleFeature feature)Visitor function, which looks at each feature and finds the minimum.
-
-
-
Constructor Detail
-
MinVisitor
public MinVisitor(String attributeTypeName)
-
MinVisitor
public MinVisitor(int attributeTypeIndex, SimpleFeatureType type) throws IllegalFilterException- Throws:
IllegalFilterException
-
MinVisitor
public MinVisitor(String attrName, SimpleFeatureType type) throws IllegalFilterException
- Throws:
IllegalFilterException
-
MinVisitor
public MinVisitor(Expression expr) throws IllegalFilterException
- Throws:
IllegalFilterException
-
-
Method Detail
-
init
public void init(SimpleFeatureCollection collection)
-
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
-
visit
public void visit(SimpleFeature feature)
Visitor function, which looks at each feature and finds the minimum.- Parameters:
feature- the feature to be visited
-
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
-
getMin
public Comparable getMin()
Get the min value.- Returns:
- Minimum value
-
reset
public void reset()
-
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
-
getExpression
public Expression getExpression()
-
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 'min', the value stored is of type 'Comparable'.
-
-