Class ManualRegexIterator

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

    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.
    • 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
        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.
      • 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 UnicodeString 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​(RegexMatchHandler 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