org.apache.xalan.xsltc.dom

Class MatchingIterator

Implemented Interfaces:
Cloneable, DTMAxisIterator

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).
Authors:
Jacek Ambroziak
Santiago Pericas-Geertsen

Fields inherited from interface org.apache.xml.dtm.DTMAxisIterator

END

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

cloneIterator, getAxis, getLast, getNodeByPosition, getPosition, getStartNode, includeSelf, isDocOrdered, isReverse, reset, setRestartable

Constructor Details

MatchingIterator

public MatchingIterator(int match,
                        DTMAxisIterator source)

Method Details

cloneIterator

public DTMAxisIterator cloneIterator()
Specified by:
cloneIterator in interface DTMAxisIterator
Overrides:
cloneIterator in interface DTMAxisIteratorBase

getLast

public int getLast()
Specified by:
getLast in interface DTMAxisIterator
Overrides:
getLast in interface DTMAxisIteratorBase

getPosition

public int getPosition()
Specified by:
getPosition in interface DTMAxisIterator
Overrides:
getPosition in interface DTMAxisIteratorBase

gotoMark

public void gotoMark()
Specified by:
gotoMark in interface DTMAxisIterator

next

public int next()
Specified by:
next in interface DTMAxisIterator

reset

public DTMAxisIterator reset()
Specified by:
reset in interface DTMAxisIterator
Overrides:
reset in interface DTMAxisIteratorBase

setMark

public void setMark()
Specified by:
setMark in interface DTMAxisIterator

setRestartable

public void setRestartable(boolean isRestartable)
Specified by:
setRestartable in interface DTMAxisIterator
Overrides:
setRestartable in interface DTMAxisIteratorBase

setStartNode

public DTMAxisIterator setStartNode(int node)
Specified by:
setStartNode in interface DTMAxisIterator

Copyright B) 2004 Apache XML Project. All Rights Reserved.