org.apache.xalan.xsltc.dom
Class MatchingIterator

java.lang.Object
  |
  +--org.apache.xml.dtm.ref.DTMAxisIteratorBase
        |
        +--org.apache.xalan.xsltc.dom.MatchingIterator

public final class MatchingIterator
extends DTMAxisIteratorBase

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).


Constructor Summary
MatchingIterator(int match, DTMAxisIterator source)
           
 
Method Summary
 DTMAxisIterator cloneIterator()
           
 int getLast()
           
 int getPosition()
           
 void gotoMark()
           
 int next()
           
 DTMAxisIterator reset()
           
 void setMark()
           
 void setRestartable(boolean isRestartable)
           
 DTMAxisIterator setStartNode(int node)
           
 
Methods inherited from class org.apache.xml.dtm.ref.DTMAxisIteratorBase
getAxis, getNodeByPosition, getStartNode, includeSelf, isDocOrdered, isReverse
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MatchingIterator

public MatchingIterator(int match,
                        DTMAxisIterator source)
Method Detail

setRestartable

public void setRestartable(boolean isRestartable)
Overrides:
setRestartable in class DTMAxisIteratorBase

cloneIterator

public DTMAxisIterator cloneIterator()
Overrides:
cloneIterator in class DTMAxisIteratorBase

setStartNode

public DTMAxisIterator setStartNode(int node)

reset

public DTMAxisIterator reset()
Overrides:
reset in class DTMAxisIteratorBase

next

public int next()

getLast

public int getLast()
Overrides:
getLast in class DTMAxisIteratorBase

getPosition

public int getPosition()
Overrides:
getPosition in class DTMAxisIteratorBase

setMark

public void setMark()

gotoMark

public void gotoMark()


Copyright 2006 Apache XML Project. All Rights Reserved.