org.apache.xalan.xsltc.dom
Class MatchingIterator
java.lang.Object
|
+--org.apache.xalan.xsltc.dom.NodeIteratorBase
|
+--org.apache.xalan.xsltc.dom.MatchingIterator
- public final class MatchingIterator
- extends NodeIteratorBase
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).
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
MatchingIterator
public MatchingIterator(int match,
NodeIterator source)
setRestartable
public void setRestartable(boolean isRestartable)
- Overrides:
- setRestartable in class NodeIteratorBase
cloneIterator
public NodeIterator cloneIterator()
- Overrides:
- cloneIterator in class NodeIteratorBase
setStartNode
public NodeIterator setStartNode(int node)
- Overrides:
- setStartNode in class NodeIteratorBase
reset
public NodeIterator reset()
- Overrides:
- reset in class NodeIteratorBase
next
public int next()
getLast
public int getLast()
- Overrides:
- getLast in class NodeIteratorBase
getPosition
public int getPosition()
- Overrides:
- getPosition in class NodeIteratorBase
setMark
public void setMark()
gotoMark
public void gotoMark()
Copyright © 2002 Apache XML Project. All Rights Reserved.