|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.xml.dtm.ref.DTMAxisIteratorBase org.apache.xalan.xsltc.dom.MatchingIterator
public final class MatchingIterator
This is a special kind of iterator that takes a source iterator and a node N. If initialized with a node M (the parent of N) it computes the position of N amongst the children of M. This position can be obtained by calling getPosition(). It is an iterator even though next() will never be called. It is used to match patterns with a single predicate like: BOOK[position() = last()] In this example, the source iterator will return elements of type BOOK, a call to position() will return the position of N. Notice that because of the way the pattern matching is implemented, N will always be a node in the source since (i) it is a BOOK or the test sequence would not be considered and (ii) the source iterator is initialized with M which is the parent of N. Also, and still in this example, a call to last() will return the number of elements in the source (i.e. the number of BOOKs).
Field Summary | |
---|---|
private int |
_match
The node to match. |
private DTMAxisIterator |
_source
A reference to a source iterator. |
Fields inherited from class org.apache.xml.dtm.ref.DTMAxisIteratorBase |
---|
_includeSelf, _isRestartable, _last, _markedNode, _position, _startNode |
Fields inherited from interface org.apache.xml.dtm.DTMAxisIterator |
---|
END |
Constructor Summary | |
---|---|
MatchingIterator(int match,
DTMAxisIterator source)
|
Method Summary | |
---|---|
DTMAxisIterator |
cloneIterator()
Returns a deep copy of this iterator. |
int |
getLast()
Returns the position of the last node within the iteration, as defined by XPath. |
int |
getPosition()
|
void |
gotoMark()
Restores the current node remembered by setMark(). |
int |
next()
Get the next node in the iteration. |
DTMAxisIterator |
reset()
Resets the iterator to the last start node. |
void |
setMark()
Remembers the current node for the next call to gotoMark(). |
void |
setRestartable(boolean isRestartable)
Set if restartable. |
DTMAxisIterator |
setStartNode(int node)
Set start to END should 'close' the iterator, i.e. |
Methods inherited from class org.apache.xml.dtm.ref.DTMAxisIteratorBase |
---|
getAxis, getNodeByPosition, getStartNode, includeSelf, isDocOrdered, isReverse, resetPosition, returnNode |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private DTMAxisIterator _source
private final int _match
Constructor Detail |
---|
public MatchingIterator(int match, DTMAxisIterator source)
Method Detail |
---|
public void setRestartable(boolean isRestartable)
DTMAxisIterator
setRestartable
in interface DTMAxisIterator
setRestartable
in class DTMAxisIteratorBase
public DTMAxisIterator cloneIterator()
DTMAxisIteratorBase
cloneIterator
in interface DTMAxisIterator
cloneIterator
in class DTMAxisIteratorBase
public DTMAxisIterator setStartNode(int node)
DTMAxisIterator
node
- Sets the root of the iteration.
public DTMAxisIterator reset()
DTMAxisIterator
reset
in interface DTMAxisIterator
reset
in class DTMAxisIteratorBase
public int next()
DTMAxisIterator
public int getLast()
DTMAxisIteratorBase
getLast
in interface DTMAxisIterator
getLast
in class DTMAxisIteratorBase
public int getPosition()
getPosition
in interface DTMAxisIterator
getPosition
in class DTMAxisIteratorBase
public void setMark()
DTMAxisIterator
public void gotoMark()
DTMAxisIterator
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |