Package net.sf.saxon.expr.flwor
Class GroupByClause
- java.lang.Object
- 
- net.sf.saxon.expr.flwor.Clause
- 
- net.sf.saxon.expr.flwor.GroupByClause
 
 
- 
 public class GroupByClause extends Clause This class represents an "group by" clause in a FLWOR expression
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classGroupByClause.ObjectToBeGroupedInner class representing the contents of a tuple from the pre-grouping tuple stream; a set of such objects consitutes a group.classGroupByClause.TupleComparisonKeyInner class representing a tuple comparison key: that is, an arbitrary object whose equals() and hashCode() methods can be used to test whether two tuples have equivalent grouping keys- 
Nested classes/interfaces inherited from class net.sf.saxon.expr.flwor.ClauseClause.ClauseName
 
- 
 - 
Constructor SummaryConstructors Constructor Description GroupByClause(Configuration config)Create a group-by clause
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddToPathMap(PathMap pathMap, PathMap.PathMapNodeSet pathMapNodeSet)Collect information about the navigation paths followed by this clause, for document projection purposesbooleancontainsNonInlineableVariableReference(Binding binding)Determine whether the clause contains a reference to a local variable binding that cannot be inlinedGroupByClausecopy(FLWORExpression flwor, RebindingMap rebindings)Create a copy of this clausevoidexplain(ExpressionPresenter out)Diagnostic print of expression structure.Clause.ClauseNamegetClauseKey()Get a keyword identifying what kind of clause this isGroupByClause.TupleComparisonKeygetComparisonKey(Tuple t, GenericAtomicComparer[] comparers)Callback to get the comparison key for a tuple.TupleExpressiongetGroupingTupleExpression()Get the tuple expression that evaluates all the grouping variables, returning the values these variables take in the input streamTuplePullgetPullStream(TuplePull base, XPathContext context)Get a tuple stream that implements the functionality of this clause, taking its input from another tuple stream which this clause modifiesTuplePushgetPushStream(TuplePush destination, Outputter output, XPathContext context)Get a push-mode tuple stream that implements the functionality of this clause, supplying its output to another tuple streamLocalVariableBinding[]getRangeVariables()Get the variables bound by this clauseTupleExpressiongetRetainedTupleExpression()Get the tuple expression that evaluates all the non-grouping variables, returning the values these variables take in the grouping input streamvoidinitGroupingTupleExpression(FLWORExpression flwor, TupleExpression expr)Initialize a tuple expression that evaluates all the grouping variables, returning the values these variables take in the input streamvoidinitRetainedTupleExpression(FLWORExpression flwor, TupleExpression expr)Initialize a tuple expression that evaluates all the non-grouping variables, returning the values these variables take in the grouping input streamvoidoptimize(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType)Optimize any expressions contained within this clausevoidprocessGroup(java.util.List<GroupByClause.ObjectToBeGrouped> group, XPathContext context)Process a group of tuples from the input stream to generate a single tuple in the output stream.voidprocessOperands(OperandProcessor processor)Process the subexpressions of this clausevoidsetComparers(GenericAtomicComparer[] comparers)Set the comparers used for the grouping keys.voidsetGroupingTupleExpression(TupleExpression expr)Set a tuple expression that evaluates all the grouping variables, returning the values these variables take in the input streamvoidsetRetainedTupleExpression(TupleExpression expr)Set a tuple expression that evaluates all the non-grouping variables, returning the values these variables take in the grouping input streamvoidsetVariableBindings(LocalVariableBinding[] bindings)Set the bindings of new variables created by the grouping clause, which constitute the variables appearing in the output (post-grouping) tuple stream.java.lang.StringtoString()- 
Methods inherited from class net.sf.saxon.expr.flwor.ClausegatherVariableReferences, getConfiguration, getLocation, getPackageData, getTraceInfo, isRepeated, refineVariableType, setLocation, setPackageData, setRepeated, toShortString, typeCheck
 
- 
 
- 
- 
- 
Constructor Detail- 
GroupByClausepublic GroupByClause(Configuration config) Create a group-by clause- Parameters:
- config- the Saxon configuration
 
 
- 
 - 
Method Detail- 
getClauseKeypublic Clause.ClauseName getClauseKey() Description copied from class:ClauseGet a keyword identifying what kind of clause this is- Specified by:
- getClauseKeyin class- Clause
- Returns:
- the kind of clause
 
 - 
containsNonInlineableVariableReferencepublic boolean containsNonInlineableVariableReference(Binding binding) Description copied from class:ClauseDetermine whether the clause contains a reference to a local variable binding that cannot be inlined- Overrides:
- containsNonInlineableVariableReferencein class- Clause
- Parameters:
- binding- the binding for the local variable in question
- Returns:
- true if this clause uses the variable in a way that does not permit inlining
 
 - 
copypublic GroupByClause copy(FLWORExpression flwor, RebindingMap rebindings) Description copied from class:ClauseCreate a copy of this clause
 - 
initRetainedTupleExpressionpublic void initRetainedTupleExpression(FLWORExpression flwor, TupleExpression expr) Initialize a tuple expression that evaluates all the non-grouping variables, returning the values these variables take in the grouping input stream- Parameters:
- flwor- the containing FLWORExpression
- expr- the tuple expression
 
 - 
setRetainedTupleExpressionpublic void setRetainedTupleExpression(TupleExpression expr) Set a tuple expression that evaluates all the non-grouping variables, returning the values these variables take in the grouping input stream- Parameters:
- expr- the tuple expression
 
 - 
getRetainedTupleExpressionpublic TupleExpression getRetainedTupleExpression() Get the tuple expression that evaluates all the non-grouping variables, returning the values these variables take in the grouping input stream- Returns:
- the tuple expression
 
 - 
optimizepublic void optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) throws XPathException Description copied from class:ClauseOptimize any expressions contained within this clause- Overrides:
- optimizein class- Clause
- Parameters:
- visitor- the ExpressionVisitor, providing access to static context information
- contextItemType- the type of the context item
- Throws:
- XPathException- if any error is detected
 
 - 
initGroupingTupleExpressionpublic void initGroupingTupleExpression(FLWORExpression flwor, TupleExpression expr) Initialize a tuple expression that evaluates all the grouping variables, returning the values these variables take in the input stream- Parameters:
- flwor- the containing FLWORExpression
- expr- the tuple expression
 
 - 
setGroupingTupleExpressionpublic void setGroupingTupleExpression(TupleExpression expr) Set a tuple expression that evaluates all the grouping variables, returning the values these variables take in the input stream- Parameters:
- expr- the tuple expression
 
 - 
getGroupingTupleExpressionpublic TupleExpression getGroupingTupleExpression() Get the tuple expression that evaluates all the grouping variables, returning the values these variables take in the input stream- Returns:
- the tuple expression
 
 - 
setVariableBindingspublic void setVariableBindings(LocalVariableBinding[] bindings) Set the bindings of new variables created by the grouping clause, which constitute the variables appearing in the output (post-grouping) tuple stream. There will be one of these for each variable in the input (pre-grouping) stream; by convention the bindings for grouping variables precede the bindings for non-grouping (retained) variables, and the order is preserved.- Parameters:
- bindings- the bindings of the variables created in the output stream
 
 - 
getRangeVariablespublic LocalVariableBinding[] getRangeVariables() Get the variables bound by this clause- Overrides:
- getRangeVariablesin class- Clause
- Returns:
- the variable bindings
 
 - 
setComparerspublic void setComparers(GenericAtomicComparer[] comparers) Set the comparers used for the grouping keys. There is one comparer for each grouping variable- Parameters:
- comparers- the comparers for grouping keys.
 
 - 
getPullStreampublic TuplePull getPullStream(TuplePull base, XPathContext context) Get a tuple stream that implements the functionality of this clause, taking its input from another tuple stream which this clause modifies- Specified by:
- getPullStreamin class- Clause
- Parameters:
- base- the input tuple stream
- context- the XPath dynamic evaluation context
- Returns:
- the output tuple stream
 
 - 
getPushStreampublic TuplePush getPushStream(TuplePush destination, Outputter output, XPathContext context) Get a push-mode tuple stream that implements the functionality of this clause, supplying its output to another tuple stream- Specified by:
- getPushStreamin class- Clause
- Parameters:
- destination- the output tuple stream
- output- the destination for the result
- context- the dynamic evaluation context
- Returns:
- the push tuple stream that implements the functionality of this clause of the FLWOR expression
 
 - 
processOperandspublic void processOperands(OperandProcessor processor) throws XPathException Process the subexpressions of this clause- Specified by:
- processOperandsin class- Clause
- Parameters:
- processor- the expression processor used to process the subexpressions
- Throws:
- XPathException- if any error is detected
 
 - 
explainpublic void explain(ExpressionPresenter out) Diagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 - 
processGrouppublic void processGroup(java.util.List<GroupByClause.ObjectToBeGrouped> group, XPathContext context) throws XPathException Process a group of tuples from the input stream to generate a single tuple in the output stream. This method takes a group of tuples as input, and sets all the required variables in the local stack frame as required to deliver this group as the current tuple in the post-grouping stream- Parameters:
- group- the group of input tuples
- context- the XPath dynamic evaluation context
- Throws:
- XPathException- if a dynamic error occurs
 
 - 
getComparisonKeypublic GroupByClause.TupleComparisonKey getComparisonKey(Tuple t, GenericAtomicComparer[] comparers) Callback to get the comparison key for a tuple. Two tuples are equal if their comparison keys compare equal using the equals() method.- Parameters:
- t- the tuple whose comparison key is required
- Returns:
- a comparison key suitable for comparing with other tuples
 
 - 
addToPathMappublic void addToPathMap(PathMap pathMap, PathMap.PathMapNodeSet pathMapNodeSet) Description copied from class:ClauseCollect information about the navigation paths followed by this clause, for document projection purposes- Specified by:
- addToPathMapin class- Clause
- Parameters:
- pathMap- the path map in which the data is to be collected
- pathMapNodeSet- the path map node set representing the paths to the context item
 
 
- 
 
-