Package com.saxonica.ee.stream

## Class ManualGroupIterator

- java.lang.Object
- - net.sf.saxon.tree.iter.ManualIterator
  - - com.saxonica.ee.stream.ManualGroupIterator

- All Implemented Interfaces:
    `java.io.Closeable`, `java.lang.AutoCloseable`, `LastPositionFinder`, `GroupIterator`, `FocusIterator`, `SequenceIterator`, `GroundedIterator`, `LookaheadIterator`, `ReversibleIterator`, `UnfailingIterator`
  Direct Known Subclasses:
    `GroupByIterator.ManualGroupByIterator`, `MergeGroupingIterator.ManualMergeGroupingIterator`

      public class ManualGroupIterator
      extends ManualIterator
      implements GroupIterator

  The class ManualGroupIterator represents an iterator that is never repositioned, but can be used to represent the focus in the dynamic context. It is used as a snapshot copy of a real grouping iterator for use when asynchronous threads are forked, as in xsl:result-document; the purpose of taking a snapshot is to ensure that changes to the base iterator in one thread do not affect the focus of another thread.

- - ### Nested Class Summary

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

      `SequenceIterator.Property`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ManualGroupIterator​(Item item, int position)` | Create a manual grouping iterator

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `appendToCurrentGroup​(Item item)` |
    `boolean` | `currentGroupContains​(Item item)` |
    `AtomicSequence` | `getCurrentGroupingKey()` | Get the grouping key of the current group
    `ManualGroupIterator` | `getSnapShot​(XPathContext context)` | Get a sequence which is a snapshot of this sequence at the current position
    `SequenceIterator` | `iterateCurrentGroup()` | Get an iterator over the members of the current group, in population order.
    `void` | `setCurrentGroup​(java.util.List<Item> group)` |
    `void` | `setCurrentGroupingKey​(AtomicSequence key)` |
    `void` | `startNewCurrentGroup​(Item item)` |

    - ### Methods inherited from class net.sf.saxon.tree.iter.ManualIterator

      `current, getLength, getProperties, getResidue, getReverseIterator, hasNext, incrementPosition, materialize, next, position, setContextItem, setLastPositionFinder, setPosition`

    - ### 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.om.SequenceIterator

      `close, forEachOrFail, getProperties`

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

      `forEach, toList`

- - ### Constructor Detail

    - #### ManualGroupIterator

          public ManualGroupIterator​(Item item,
                                     int position)

      Create a manual grouping iterator
      Parameters:
        `item` - the context item
        `position` - the context position

  - ### Method Detail

    - #### getSnapShot

          public ManualGroupIterator getSnapShot​(XPathContext context)

      Description copied from interface: `GroupIterator`
      Get a sequence which is a snapshot of this sequence at the current position
      Specified by:
        `getSnapShot` in interface `GroupIterator`

    - #### setCurrentGroupingKey

          public void setCurrentGroupingKey​(AtomicSequence key)

    - #### getCurrentGroupingKey

          public AtomicSequence getCurrentGroupingKey()

      Description copied from interface: `GroupIterator`
      Get the grouping key of the current group
      Specified by:
        `getCurrentGroupingKey` in interface `GroupIterator`
      Returns:
        the current grouping key in the case of group-by or group-adjacent, or null in the case of group-starting-with and group-ending-with

    - #### setCurrentGroup

          public void setCurrentGroup​(java.util.List<Item> group)

    - #### appendToCurrentGroup

          public void appendToCurrentGroup​(Item item)

    - #### startNewCurrentGroup

          public void startNewCurrentGroup​(Item item)

    - #### iterateCurrentGroup

          public SequenceIterator iterateCurrentGroup()
                                               throws XPathException

      Description copied from interface: `GroupIterator`
      Get an iterator over the members of the current group, in population order. This must always be a clean iterator, that is, an iterator that starts at the first item of the group.
      Specified by:
        `iterateCurrentGroup` in interface `GroupIterator`
      Returns:
        an iterator over all the members of the current group, in population order.
      Throws:
        `XPathException` - if a dynamic error occurs

    - #### currentGroupContains

          public boolean currentGroupContains​(Item item)