Package 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:
    `java.io.Closeable`, `java.lang.AutoCloseable`, `LastPositionFinder`, `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.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface net.sf.saxon.om.SequenceIterator

      `SequenceIterator.Property`

  - ### Field Summary

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

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

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `GroupEndingIterator​(Expression select, Pattern endPattern, XPathContext context)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected void` | `advance()` |
    `int` | `getLength()` | Get the last position (that is, the number of items in the sequence).

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

      `close, getCurrentGroupingKey, getProperties, getSnapShot, hasNext, iterateCurrentGroup, next`

    - ### 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, iterateCurrentGroup`

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

      `hasNext`

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

      `close, forEachOrFail, getProperties, materialize, next`

- - ### Constructor Detail

    - #### GroupEndingIterator

          public GroupEndingIterator​(Expression select,
                                     Pattern endPattern,
                                     XPathContext context)
                              throws XPathException

      Throws:
        `XPathException`

  - ### Method Detail

    - #### getLength

          public int getLength()
                        throws XPathException

      Description copied from interface: `LastPositionFinder`
      Get the last position (that is, the number of items in the sequence). This method is non-destructive: it does not change the state of the iterator. The result is undefined if the next() method of the iterator has already returned null. This method must not be called unless the result of getProperties() on the iterator includes the bit setting `SequenceIterator.Property.LAST_POSITION_FINDER`
      Specified by:
        `getLength` in interface `LastPositionFinder`
      Returns:
        the number of items in the sequence
      Throws:
        `XPathException` - if an error occurs evaluating the sequence in order to determine the number of items

    - #### advance

          protected void advance()
                          throws XPathException

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