Package org.geotools.feature.visitor
Class NearestVisitor
Object
NearestVisitor
- All Implemented Interfaces:
FeatureVisitor
,FeatureAttributeVisitor
,FeatureCalc
Finds the nearest value to the provided one in the attribute domain.
- Author:
- Andrea Aime - GeoSolutions, Ilkka Rinne / Spatineo Inc for the Finnish Meteorological Institute
-
Constructor Summary
ConstructorsConstructorDescriptionNearestVisitor
(Expression expression, Object valueToMatch) Creates a NearestVisitor instance for the given attribute and a value to match. -
Method Summary
Modifier and TypeMethodDescriptionExpression used to access collection content.List of expressions used by visitor.Returns the match aftervisit(org.geotools.api.feature.Feature)
.Returns the result of the calculation as a handy object which can be merged and modified.getResultType
(List<Class> inputTypes) Returns the expected output type given the input type.Provided value to match against.void
reset()
void
setValue
(Comparable nearest) void
setValue
(Comparable maxBelow, Comparable minAbove) void
Visitor function, which looks at each feature and finds the value of the attribute given attribute nearest to the given comparison value.
-
Constructor Details
-
NearestVisitor
Creates a NearestVisitor instance for the given attribute and a value to match.- Parameters:
valueToMatch
- The target value to match
-
-
Method Details
-
visit
Visitor function, which looks at each feature and finds the value of the attribute given attribute nearest to the given comparison value.- Specified by:
visit
in interfaceFeatureVisitor
- Parameters:
feature
- the feature to be visited
-
reset
public void reset() -
setValue
-
setValue
-
getNearestMatch
Returns the match aftervisit(org.geotools.api.feature.Feature)
.- Throws:
IllegalStateException
-
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
-
getExpression
Expression used to access collection content.- Returns:
- expr used to access collection
-
getValueToMatch
Provided value to match against.- Returns:
- value to match against.
-
getExpressions
Description copied from interface:FeatureAttributeVisitor
List of expressions used by visitor.- Specified by:
getExpressions
in interfaceFeatureAttributeVisitor
-
getResultType
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
-