Constructors Summary |
---|
WalkingIterator(Compiler compiler, int opPos, int analysis, boolean shouldLoadWalkers)Create a WalkingIterator iterator, including creation
of step walkers from the opcode list, and call back
into the Compiler to create predicate expressions.
super(compiler, opPos, analysis, shouldLoadWalkers);
int firstStepPos = compiler.getFirstChildPos(opPos);
if (shouldLoadWalkers)
{
m_firstWalker = WalkerFactory.loadWalkers(this, compiler, firstStepPos, 0);
m_lastUsedWalker = m_firstWalker;
}
|
public WalkingIterator(PrefixResolver nscontext)Create a WalkingIterator object.
super(nscontext);
|
Methods Summary |
---|
public void | callVisitors(com.sun.org.apache.xpath.internal.ExpressionOwner owner, com.sun.org.apache.xpath.internal.XPathVisitor visitor)
if(visitor.visitLocationPath(owner, this))
{
if(null != m_firstWalker)
{
m_firstWalker.callVisitors(this, visitor);
}
}
|
public java.lang.Object | clone()Get a cloned WalkingIterator that holds the same
position as this iterator.
WalkingIterator clone = (WalkingIterator) super.clone();
// clone.m_varStackPos = this.m_varStackPos;
// clone.m_varStackContext = this.m_varStackContext;
if (null != m_firstWalker)
{
clone.m_firstWalker = m_firstWalker.cloneDeep(clone, null);
}
return clone;
|
public boolean | deepEquals(com.sun.org.apache.xpath.internal.Expression expr)
if (!super.deepEquals(expr))
return false;
AxesWalker walker1 = m_firstWalker;
AxesWalker walker2 = ((WalkingIterator)expr).m_firstWalker;
while ((null != walker1) && (null != walker2))
{
if(!walker1.deepEquals(walker2))
return false;
walker1 = walker1.getNextWalker();
walker2 = walker2.getNextWalker();
}
if((null != walker1) || (null != walker2))
return false;
return true;
|
public void | detach()Detaches the iterator from the set which it iterated over, releasing
any computational resources and placing the iterator in the INVALID
state. Afterdetach has been invoked, calls to
nextNode orpreviousNode will raise the
exception INVALID_STATE_ERR.
if(m_allowDetach)
{
AxesWalker walker = m_firstWalker;
while (null != walker)
{
walker.detach();
walker = walker.getNextWalker();
}
m_lastUsedWalker = null;
// Always call the superclass detach last!
super.detach();
}
|
public void | fixupVariables(java.util.Vector vars, int globalsSize)This function is used to fixup variables from QNames to stack frame
indexes at stylesheet build time.
m_predicateIndex = -1;
AxesWalker walker = m_firstWalker;
while (null != walker)
{
walker.fixupVariables(vars, globalsSize);
walker = walker.getNextWalker();
}
|
public int | getAnalysisBits()Get the analysis bits for this walker, as defined in the WalkerFactory.
int bits = 0;
if (null != m_firstWalker)
{
AxesWalker walker = m_firstWalker;
while (null != walker)
{
int bit = walker.getAnalysisBits();
bits |= bit;
walker = walker.getNextWalker();
}
}
return bits;
|
public com.sun.org.apache.xpath.internal.Expression | getExpression()
return m_firstWalker;
|
public final com.sun.org.apache.xpath.internal.axes.AxesWalker | getFirstWalker()Get the head of the walker list.
return m_firstWalker;
|
public final com.sun.org.apache.xpath.internal.axes.AxesWalker | getLastUsedWalker()Get the last used walker.
return m_lastUsedWalker;
|
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)
return DTM.NULL;
// If the variable stack position is not -1, we'll have to
// set our position in the variable stack, so our variable access
// will be correct. Iterators that are at the top level of the
// expression need to reset the variable stack, while iterators
// in predicates do not need to, and should not, since their execution
// may be much later than top-level iterators.
// m_varStackPos is set in setRoot, which is called
// from the execute method.
if (-1 == m_stackFrame)
{
return returnNextNode(m_firstWalker.nextNode());
}
else
{
VariableStack vars = m_execContext.getVarStack();
// These three statements need to be combined into one operation.
int savedStart = vars.getStackFrame();
vars.setStackFrame(m_stackFrame);
int n = returnNextNode(m_firstWalker.nextNode());
// These two statements need to be combined into one operation.
vars.setStackFrame(savedStart);
return n;
}
|
public void | reset()Reset the iterator.
super.reset();
if (null != m_firstWalker)
{
m_lastUsedWalker = m_firstWalker;
m_firstWalker.setRoot(m_context);
}
|
public void | setExpression(com.sun.org.apache.xpath.internal.Expression exp)
exp.exprSetParent(this);
m_firstWalker = (AxesWalker)exp;
|
public final void | setFirstWalker(com.sun.org.apache.xpath.internal.axes.AxesWalker walker)Set the head of the walker list.
m_firstWalker = walker;
|
public final void | setLastUsedWalker(com.sun.org.apache.xpath.internal.axes.AxesWalker walker)Set the last used walker.
m_lastUsedWalker = walker;
|
public void | setRoot(int context, java.lang.Object environment)Initialize the context values for this expression
after it is cloned.
super.setRoot(context, environment);
if(null != m_firstWalker)
{
m_firstWalker.setRoot(context);
m_lastUsedWalker = m_firstWalker;
}
|