Package org.geotools.feature.visitor
Class GroupByVisitor
Object
GroupByVisitor
- All Implemented Interfaces:
FeatureVisitor,FeatureAttributeVisitor,FeatureCalc
Group features by one or several attributes and applies an aggregator visitor to each group.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classHelper class that should be used by optimizations to set the results.static classThis class implements the feature calculation result of the group by visitor. -
Constructor Summary
ConstructorsConstructorDescriptionGroupByVisitor(Aggregate aggregateVisitor, Expression expression, List<Expression> groupByAttributes, ProgressListener progressListener) -
Method Summary
Modifier and TypeMethodDescriptionReturns the aggregate visitor used by this group by visitor.List of expressions used by visitor.This method computes and returns the group by visitor result.getResultType(List<Class> inputTypes) Returns the expected output type given the input type.voidMethods that allow optimizations to directly set the group by visitor result instead of computing it visiting all the features.voidVisit the provided feature.booleanboolean
-
Constructor Details
-
GroupByVisitor
public GroupByVisitor(Aggregate aggregateVisitor, Expression expression, List<Expression> groupByAttributes, ProgressListener progressListener)
-
-
Method Details
-
wasOptimized
public boolean wasOptimized() -
wasVisited
public boolean wasVisited() -
getAggregate
Returns the aggregate visitor used by this group by visitor. This is the visitor that will be applied to each group of features. -
getResult
This method computes and returns the group by visitor result. If the computation was optimized the optimization result is returned otherwise the result is computed in memory. If for some reason an optimization result exists and there are visited features, an in memory computation is performed and is merged with the existing optimization results.- Specified by:
getResultin interfaceFeatureCalc- Returns:
- group by visitor result
-
visit
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
-
getExpression
-
getAggregateVisitor
-
getGroupByAttributes
-
setValue
Methods that allow optimizations to directly set the group by visitor result instead of computing it visiting all the features. Aggregate visitor results are wrapped with the appropriate feature calculation type.- Parameters:
value- the group by visitor result
-
getExpressions
Description copied from interface:FeatureAttributeVisitorList of expressions used by visitor.- Specified by:
getExpressionsin interfaceFeatureAttributeVisitor
-
getResultType
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
-