Package com.saxonica.ee.stream
Class ManualRegexIterator
java.lang.Object
net.sf.saxon.tree.iter.ManualIterator
com.saxonica.ee.stream.ManualRegexIterator
- All Implemented Interfaces:
Closeable
,AutoCloseable
,LastPositionFinder
,FocusIterator
,SequenceIterator
,RegexIterator
,GroundedIterator
,LookaheadIterator
,ReversibleIterator
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Get the number of captured groupsgetRegexGroup
(int number) Get a substring that matches a parenthesised group within the regular expressionboolean
Determine whether the current item in the sequence is a matching item or a non-matching itemnext()
Get the next item in the sequence.void
Process a matching substring, performing specified actions at the start and end of each matching groupMethods inherited from class net.sf.saxon.tree.iter.ManualIterator
current, getLength, getResidue, getReverseIterator, hasNext, incrementPosition, isActuallyGrounded, materialize, position, setContextItem, setLengthFinder, setPosition, supportsGetLength, supportsHasNext
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
-
Constructor Details
-
Method Details
-
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 interfaceRegexIterator
- Specified by:
next
in interfaceSequenceIterator
- Overrides:
next
in classManualIterator
- 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 interfaceRegexIterator
-
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 interfaceRegexIterator
- Returns:
- true if the current item is a matching item
-
getRegexGroup
Get a substring that matches a parenthesised group within the regular expression- Specified by:
getRegexGroup
in interfaceRegexIterator
- 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
Process a matching substring, performing specified actions at the start and end of each matching group- Specified by:
processMatchingSubstring
in interfaceRegexIterator
- Parameters:
action
- the action to be performed on a matching substring
-