Class GroupByVisitor

Object
GroupByVisitor
All Implemented Interfaces:
FeatureVisitor, FeatureAttributeVisitor, FeatureCalc

public class GroupByVisitor extends Object implements FeatureCalc, FeatureAttributeVisitor
Group features by one or several attributes and applies an aggregator visitor to each group.
  • Constructor Details

  • Method Details

    • wasOptimized

      public boolean wasOptimized()
    • wasVisited

      public boolean wasVisited()
    • getAggregate

      public Aggregate 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

      public CalcResult 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:
      getResult in interface FeatureCalc
      Returns:
      group by visitor result
    • 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 interface FeatureVisitor
    • getExpression

      public Expression getExpression()
    • getAggregateVisitor

      public FeatureVisitor getAggregateVisitor()
    • getGroupByAttributes

      public List<Expression> getGroupByAttributes()
    • setValue

      public void setValue(List<GroupByVisitor.GroupByRawResult> value)
      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

      public List<Expression> getExpressions()
      Description copied from interface: FeatureAttributeVisitor
      List of expressions used by visitor.
      Specified by:
      getExpressions in interface FeatureAttributeVisitor
    • 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 interface FeatureAttributeVisitor
      Parameters:
      inputTypes - The type of the input expressions