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 Modifier and Type Class Description static class
UniqueVisitor.UniqueResult
-
Constructor Summary
Constructors Constructor Description UniqueVisitor(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>
getAttrNames()
Expression
getExpression()
List<Expression>
getExpressions()
List of expressions used by visitor.int
getMaxFeatures()
Returns maxFeatures (max # of elements to return)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.int
getStartIndex()
Returns startIndex (first element to return)Set
getUnique()
boolean
hasLimits()
Checks if the visitor has limits.void
init(SimpleFeatureCollection collection)
boolean
isPreserveOrder()
True if the unique visitor must be order preservingvoid
reset()
void
setMaxFeatures(int maxFeatures)
void
setPreserveOrder(boolean preserveOrder)
void
setStartIndex(int startIndex)
void
setValue(Object value)
void
visit(Feature feature)
Visit the provided feature.void
visit(SimpleFeature feature)
-
-
-
Constructor Detail
-
UniqueVisitor
public UniqueVisitor(int attributeTypeIndex, SimpleFeatureType type) throws IllegalFilterException
- Throws:
IllegalFilterException
-
UniqueVisitor
public UniqueVisitor(String attrName, SimpleFeatureType type) throws IllegalFilterException
- Throws:
IllegalFilterException
-
UniqueVisitor
public UniqueVisitor(String... attributeTypeNames)
-
UniqueVisitor
public UniqueVisitor(SimpleFeatureType type, Integer... indexes) throws IllegalFilterException
- Throws:
IllegalFilterException
-
UniqueVisitor
public UniqueVisitor(SimpleFeatureType type, String... attributeNames) throws IllegalFilterException
- Throws:
IllegalFilterException
-
UniqueVisitor
public UniqueVisitor(Expression... expressions)
-
-
Method Detail
-
init
public void init(SimpleFeatureCollection collection)
-
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
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
-
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
-
getExpression
public Expression getExpression()
-
getUnique
public Set getUnique()
-
setValue
public void setValue(Object value)
-
reset
public void reset()
-
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
-
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
-
-