net.sf.saxon.sort
public class GroupByIterator extends Object implements GroupIterator, LastPositionFinder, LookaheadIterator
The GroupByIterator acts as a SequenceIterator, where successive calls of next() return the leading item of each group in turn. The current item of the iterator is therefore the leading item of the current group. To get access to all the members of the current group, the method iterateCurrentGroup() is used; this underpins the current-group() function in XSLT. The grouping key for the current group is available via the getCurrentGroupingKey() method.
Constructor Summary | |
---|---|
GroupByIterator(SequenceIterator population, Expression keyExpression, XPathContext keyContext, Comparator collator)
Create a GroupByIterator |
Method Summary | |
---|---|
Item | current() |
SequenceIterator | getAnother() |
List | getCurrentGroup()
Get the contents of the current group as a java List |
AtomicValue | getCurrentGroupingKey()
Get the value of the grouping key for the current group |
int | getLastPosition()
Get the last position (that is, the number of groups) |
int | getProperties()
Get properties of this iterator, as a bit-significant integer.
|
boolean | hasNext() |
SequenceIterator | iterateCurrentGroup()
Get an iterator over the items in the current group |
Item | next() |
int | position() |
Parameters: population iterator over the population to be grouped keyExpression the expression used to calculate the grouping key keyContext dynamic context for calculating the grouping key collator Collation to be used for comparing grouping keys
Throws: XPathException
Returns: the contents of the current group
Returns: the grouping key
Returns: the properties of this iterator. This will be some combination of properties such as GROUNDED, LAST_POSITION_FINDER, and LOOKAHEAD. It is always acceptable to return the value zero, indicating that there are no known special properties. It is acceptable for the properties of the iterator to change depending on its state.
Returns: the iterator