Package org.geotools.feature.visitor
Class UniqueVisitor
Object
UniqueVisitor
- All Implemented Interfaces:
FeatureVisitor
,FeatureAttributeVisitor
,FeatureCalc
,LimitingVisitor
- Direct Known Subclasses:
UniqueCountVisitor
public class UniqueVisitor
extends Object
implements FeatureCalc, FeatureAttributeVisitor, LimitingVisitor
Generates a list of unique values from a collection
- Since:
- 2.2.M2
- Author:
- Cory Horner, Refractions
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionUniqueVisitor
(int attributeTypeIndex, SimpleFeatureType type) UniqueVisitor
(String... attributeTypeNames) UniqueVisitor
(String attrName, SimpleFeatureType type) UniqueVisitor
(SimpleFeatureType type, Integer... indexes) UniqueVisitor
(SimpleFeatureType type, String... attributeNames) UniqueVisitor
(Expression... expressions) -
Method Summary
Modifier and TypeMethodDescriptionList of expressions used by visitor.int
Returns maxFeatures (max # of elements to return)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.int
Returns startIndex (first element to return)boolean
Checks if the visitor has limits.void
init
(SimpleFeatureCollection collection) boolean
True if the unique visitor must be order preservingvoid
reset()
void
setMaxFeatures
(int maxFeatures) void
setPreserveOrder
(boolean preserveOrder) void
setStartIndex
(int startIndex) void
void
Visit the provided feature.void
visit
(SimpleFeature feature)
-
Constructor Details
-
UniqueVisitor
- Throws:
IllegalFilterException
-
UniqueVisitor
- Throws:
IllegalFilterException
-
UniqueVisitor
-
UniqueVisitor
- Throws:
IllegalFilterException
-
UniqueVisitor
public UniqueVisitor(SimpleFeatureType type, String... attributeNames) throws IllegalFilterException - Throws:
IllegalFilterException
-
UniqueVisitor
-
-
Method Details
-
init
-
setStartIndex
public void setStartIndex(int startIndex) -
setMaxFeatures
public void setMaxFeatures(int maxFeatures) -
setPreserveOrder
public void setPreserveOrder(boolean preserveOrder) -
getStartIndex
public int getStartIndex()Description copied from interface:LimitingVisitor
Returns startIndex (first element to return)- Specified by:
getStartIndex
in interfaceLimitingVisitor
-
getMaxFeatures
public int getMaxFeatures()Description copied from interface:LimitingVisitor
Returns maxFeatures (max # of elements to return)- Specified by:
getMaxFeatures
in interfaceLimitingVisitor
-
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
-
visit
-
visit
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
-
getExpression
-
getUnique
-
setValue
-
reset
public void reset() -
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
-
getAttrNames
-
hasLimits
public boolean hasLimits()Description copied from interface:LimitingVisitor
Checks if the visitor has limits.- Specified by:
hasLimits
in interfaceLimitingVisitor
- Returns:
- true if the visitor has limits
-
isPreserveOrder
public boolean isPreserveOrder()True if the unique visitor must be order preserving
-