Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.saxonica.expr.flwor
Class GroupByClause

    java.lang.Object
      net.sf.saxon.expr.flwor.Clause
          com.saxonica.expr.flwor.GroupByClause

    public class GroupByClause

extends Clause

This class represents an "group by" clause in a FLWOR expression

Nested Class Summary
`static class` | `GroupByClause.ObjectToBeGrouped` Inner class representing the contents of a tuple from the pre-grouping tuple stream; a set of such objects consitutes a group.
`class` | `GroupByClause.TupleComparisonKey` Inner 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

Field Summary

Fields inherited from class net.sf.saxon.expr.flwor.Clause
`COUNT, FOR, GROUPBYCLAUSE, LET, ORDERBYCLAUSE, WHERE, WINDOW`

Constructor Summary
`GroupByClause(Configuration config)` Create a group-by clause

Method Summary
`GroupByClause` | `copy()`
`void` | `explain(ExpressionPresenter out)` Diagnostic print of expression structure.
`int` | `getClauseKey()` Get a keyword identifying what kind of clause this is
`GroupByClause.TupleComparisonKey` | `getComparisonKey(Tuple t)` Callback to get the comparison key for a tuple.
`TupleExpression` | `getGroupingTupleExpression()` Get the tuple expression that evaluates all the grouping variables, returning the values these variables take in the input stream
`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
`TuplePush` | `getPushStream(TuplePush destination, XPathContext context)` Get a push-mode tuple stream that implements the functionality of this clause, supplying its output to another tuple stream
`LocalVariableBinding[]` | `getRangeVariables()` Get the variables bound by this clause
`TupleExpression` | `getRetainedTupleExpression()` Get the tuple expression that evaluates all the non-grouping variables, returning the values these variables take in the grouping input stream
`void` | `optimize(ExpressionVisitor visitor, ExpressionVisitor.ContextItemType contextItemType)` Optimize any expressions contained within this clause
`void` | `processGroup(List<GroupByClause.ObjectToBeGrouped> group, XPathContext context)` Process a group of tuples from the input stream to generate a single tuple in the output stream.
`void` | `processSubExpressions(ExpressionProcessor processor)` Process the subexpressions of this clause
`void` | `setComparers(GenericAtomicComparer[] comparers)` Set the comparers used for the grouping keys.
`void` | `setGroupingTupleExpression(TupleExpression expr)` Set a tuple expression that evaluates all the grouping variables, returning the values these variables take in the input stream
`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
`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.
`String` | `toString()`

Methods inherited from class net.sf.saxon.expr.flwor.Clause
`gatherVariableReferences, refineVariableType, typeCheck`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### GroupByClause

    public GroupByClause(Configuration config)

  Create a group-by clause

  Parameters:
    `config` - the Saxon configuration

Method Detail

### getClauseKey

    public int getClauseKey()

  Description copied from class: `Clause`
  Get a keyword identifying what kind of clause this is

  Specified by:
    `getClauseKey` in class `Clause`
  Returns:
    the kind of clause

### copy

    public GroupByClause copy()

  Specified by:
    `copy` in class `Clause`

### setRetainedTupleExpression

    public 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

### getRetainedTupleExpression

    public 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

### optimize

    public void optimize(ExpressionVisitor visitor,
                         ExpressionVisitor.ContextItemType contextItemType)
                  throws XPathException

  Description copied from class: `Clause`
  Optimize any expressions contained within this clause

  Overrides:
    `optimize` in 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

### setGroupingTupleExpression

    public 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

### getGroupingTupleExpression

    public 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

### setVariableBindings

    public 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

### getRangeVariables

    public LocalVariableBinding[] getRangeVariables()

  Get the variables bound by this clause

  Overrides:
    `getRangeVariables` in class `Clause`
  Returns:
    the variable bindings

### setComparers

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

### getPullStream

    public 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:
    `getPullStream` in class `Clause`
  Parameters:
    `base` - the input tuple stream
    `context` - the XPath dynamic evaluation context
  Returns:
    the output tuple stream

### getPushStream

    public TuplePush getPushStream(TuplePush destination,
                                   XPathContext context)

  Get a push-mode tuple stream that implements the functionality of this clause, supplying its output to another tuple stream

  Specified by:
    `getPushStream` in class `Clause`
  Parameters:
    `destination` - the output tuple stream
    `context` -
  Returns:
    the push tuple stream that implements the functionality of this clause of the FLWOR expression

### processSubExpressions

    public void processSubExpressions(ExpressionProcessor processor)
                               throws XPathException

  Process the subexpressions of this clause

  Specified by:
    `processSubExpressions` in class `Clause`
  Parameters:
    `processor` - the expression processor used to process the subexpressions
  Throws:
    `XPathException` - if any error is detected

### explain

    public void explain(ExpressionPresenter out)

  Diagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.

  Specified by:
    `explain` in class `Clause`
  Parameters:
    `out` - the expression presenter used to display the structure

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### processGroup

    public void processGroup(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`

### getComparisonKey

    public GroupByClause.TupleComparisonKey getComparisonKey(Tuple t)

  Callback to get the comparison key for a tuple. Two tuples are equal if their comparison keys compare equal using the equals() method.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2004-2011 Saxonica Limited. All rights reserved.