BasicTestIteratorpublic abstract class BasicTestIterator extends LocPathIterator Base for iterators that handle predicates. Does the basic next
node logic, so all the derived iterator has to do is get the
next node. |
Fields Summary |
---|
static final long | serialVersionUID |
Constructors Summary |
---|
protected BasicTestIterator()Create a LocPathIterator object.
| protected BasicTestIterator(PrefixResolver nscontext)Create a LocPathIterator object.
super(nscontext);
| protected BasicTestIterator(Compiler compiler, int opPos, int analysis)Create a LocPathIterator object, including creation
of step walkers from the opcode list, and call back
into the Compiler to create predicate expressions.
super(compiler, opPos, analysis, false);
int firstStepPos = compiler.getFirstChildPos(opPos);
int whatToShow = compiler.getWhatToShow(firstStepPos);
if ((0 == (whatToShow
& (DTMFilter.SHOW_ATTRIBUTE
| DTMFilter.SHOW_NAMESPACE
| DTMFilter.SHOW_ELEMENT
| DTMFilter.SHOW_PROCESSING_INSTRUCTION)))
|| (whatToShow == DTMFilter.SHOW_ALL))
initNodeTest(whatToShow);
else
{
initNodeTest(whatToShow, compiler.getStepNS(firstStepPos),
compiler.getStepLocalName(firstStepPos));
}
initPredicateInfo(compiler, firstStepPos);
| protected BasicTestIterator(Compiler compiler, int opPos, int analysis, boolean shouldLoadWalkers)Create a LocPathIterator object, including creation
of step walkers from the opcode list, and call back
into the Compiler to create predicate expressions.
super(compiler, opPos, analysis, shouldLoadWalkers);
|
Methods Summary |
---|
public com.sun.org.apache.xml.internal.dtm.DTMIterator | cloneWithReset()Get a cloned Iterator that is reset to the beginning
of the query.
ChildTestIterator clone = (ChildTestIterator) super.cloneWithReset();
clone.resetProximityPositions();
return clone;
| protected abstract int | getNextNode()Get the next node via getNextXXX. Bottlenecked for derived class override.
| public int | nextNode()Returns the next node in the set and advances the position of the
iterator in the set. After a NodeIterator is created, the first call
to nextNode() returns the first node in the set.
if(m_foundLast)
{
m_lastFetched = DTM.NULL;
return DTM.NULL;
}
if(DTM.NULL == m_lastFetched)
{
resetProximityPositions();
}
int next;
com.sun.org.apache.xpath.internal.VariableStack vars;
int savedStart;
if (-1 != m_stackFrame)
{
vars = m_execContext.getVarStack();
// These three statements need to be combined into one operation.
savedStart = vars.getStackFrame();
vars.setStackFrame(m_stackFrame);
}
else
{
// Yuck. Just to shut up the compiler!
vars = null;
savedStart = 0;
}
try
{
do
{
next = getNextNode();
if (DTM.NULL != next)
{
if(DTMIterator.FILTER_ACCEPT == acceptNode(next))
break;
else
continue;
}
else
break;
}
while (next != DTM.NULL);
if (DTM.NULL != next)
{
m_pos++;
return next;
}
else
{
m_foundLast = true;
return DTM.NULL;
}
}
finally
{
if (-1 != m_stackFrame)
{
// These two statements need to be combined into one operation.
vars.setStackFrame(savedStart);
}
}
|
|