net.sf.saxon.expr.sort

## Class GroupEndingIterator

- java.lang.Object
- - net.sf.saxon.expr.sort.GroupMatchingIterator
  - - net.sf.saxon.expr.sort.GroupEndingIterator

- All Implemented Interfaces:
    GroupIterator, SequenceIterator, LookaheadIterator

      public class GroupEndingIterator
      extends GroupMatchingIterator
      implements GroupIterator, LookaheadIterator

  A GroupEndingIterator iterates over a sequence of groups defined by xsl:for-each-group group-ending-with="x". The groups are returned in order of first appearance.

- - ### Field Summary

    - ### Fields inherited from class net.sf.saxon.expr.sort.GroupMatchingIterator

      `baseContext, current, currentMembers, next, pattern, population, position, runningContext`

    - ### Fields inherited from interface net.sf.saxon.om.SequenceIterator

      `GROUNDED, LAST_POSITION_FINDER, LOOKAHEAD`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GroupEndingIterator(SequenceIterator population, Pattern endPattern, XPathContext context)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `advance()`
    `SequenceIterator` | `getAnother()` Get another SequenceIterator that iterates over the same items as the original, but which is repositioned at the start of the sequence.

    - ### Methods inherited from class net.sf.saxon.expr.sort.GroupMatchingIterator

      `close, current, getCurrentGroupingKey, getProperties, getSnapShot, hasCurrentGroup, hasCurrentGroupingKey, hasNext, iterateCurrentGroup, next, position, setGroupSlot, setKeySlot`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface net.sf.saxon.expr.sort.GroupIterator

      `getCurrentGroupingKey, getSnapShot, hasCurrentGroup, hasCurrentGroupingKey, iterateCurrentGroup, setGroupSlot, setKeySlot`

    - ### Methods inherited from interface net.sf.saxon.tree.iter.LookaheadIterator

      `hasNext`

    - ### Methods inherited from interface net.sf.saxon.om.SequenceIterator

      `close, current, getProperties, next, position`

- - ### Constructor Detail

    - #### GroupEndingIterator

          public GroupEndingIterator(SequenceIterator population,
                             Pattern endPattern,
                             XPathContext context)
                              throws XPathException

      Throws:
        `XPathException`

  - ### Method Detail

    - #### advance

          protected void advance()
                          throws XPathException

      Specified by:
        `advance` in class `GroupMatchingIterator`
      Throws:
        `XPathException`

    - #### getAnother

          public SequenceIterator getAnother()
                                      throws XPathException

      Description copied from interface: `SequenceIterator`
      Get another SequenceIterator that iterates over the same items as the original, but which is repositioned at the start of the sequence.

      This method allows access to all the items in the sequence without disturbing the current position of the iterator. Internally, its main use is in evaluating the last() function.

      This method does not change the state of the iterator.

      Some implementations of this method may regenerate the input sequence, creating new nodes with different identity from the original. This is not recommended, but is hard to prevent. This causes no problem for the primary usage of this method to support the last() function, but it has been known to cause trouble in other situations.

      Specified by:
        `getAnother` in interface `SequenceIterator`
      Returns:
        a SequenceIterator that iterates over the same items, positioned before the first item
      Throws:
        `XPathException` - if any error occurs

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