Package com.saxonica.ee.stream

## Class ManualRegexIterator

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

- All Implemented Interfaces:
    `java.io.Closeable`, `java.lang.AutoCloseable`, `LastPositionFinder`, `FocusIterator`, `SequenceIterator`, `RegexIterator`, `GroundedIterator`, `LookaheadIterator`, `ReversibleIterator`, `UnfailingIterator`

      public class ManualRegexIterator
      extends ManualIterator
      implements RegexIterator

  The class ManualRegexIterator represents an iterator that is never repositioned, but can be used to represent the current regex groups in the dynamic context. It is used as a snapshot copy of a real regex 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 result of the current-group() function in another thread.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface net.sf.saxon.regex.RegexIterator

      `RegexIterator.MatchHandler`

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

      `SequenceIterator.Property`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ManualRegexIterator​(RegexIterator base)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `int` | `getNumberOfGroups()` | Get the number of captured groups
    `java.lang.String` | `getRegexGroup​(int number)` | Get a substring that matches a parenthesised group within the regular expression
    `boolean` | `isMatching()` | Determine whether the current item in the sequence is a matching item or a non-matching item
    `StringValue` | `next()` | Get the next item in the sequence.
    `void` | `processMatchingSubstring​(RegexIterator.MatchHandler action)` | Process a matching substring, performing specified actions at the start and end of each matching group

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

      `current, getLength, getProperties, getResidue, getReverseIterator, hasNext, incrementPosition, materialize, 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

    - #### ManualRegexIterator

          public ManualRegexIterator​(RegexIterator base)

  - ### Method Detail

    - #### next

          public StringValue next()

      Description copied from interface: `SequenceIterator`
      Get the next item in the sequence. This method changes the state of the iterator.
      Specified by:
        `next` in interface `RegexIterator`
      Specified by:
        `next` in interface `SequenceIterator`
      Specified by:
        `next` in interface `UnfailingIterator`
      Overrides:
        `next` in class `ManualIterator`
      Returns:
        the next item, or null if there are no more items. Once a call on next() has returned null, no further calls should be made. The preferred action for an iterator if subsequent calls on next() are made is to return null again, and all implementations within Saxon follow this rule.

    - #### getNumberOfGroups

          public int getNumberOfGroups()

      Get the number of captured groups
      Specified by:
        `getNumberOfGroups` in interface `RegexIterator`

    - #### isMatching

          public boolean isMatching()

      Determine whether the current item in the sequence is a matching item or a non-matching item
      Specified by:
        `isMatching` in interface `RegexIterator`
      Returns:
        true if the current item is a matching item

    - #### getRegexGroup

          public java.lang.String getRegexGroup​(int number)

      Get a substring that matches a parenthesised group within the regular expression
      Specified by:
        `getRegexGroup` in interface `RegexIterator`
      Parameters:
        `number` - the number of the group to be obtained
      Returns:
        the substring of the current item that matches the n'th parenthesized group within the regular expression

    - #### processMatchingSubstring

          public void processMatchingSubstring​(RegexIterator.MatchHandler action)

      Process a matching substring, performing specified actions at the start and end of each matching group
      Specified by:
        `processMatchingSubstring` in interface `RegexIterator`
      Parameters:
        `action` - the action to be performed on a matching substring