public abstract class LocPathIterator extends PredicatedNodeTest implements Cloneable, DTMIterator, PathComponent
| Modifier and Type | Field and Description |
|---|---|
protected DTM |
m_cdtm
The dtm of the context node.
|
protected IteratorPool |
m_clones
The pool for cloned iterators.
|
protected int |
m_context
The context node for this iterator, which doesn't change through the course of the iteration.
|
protected int |
m_currentContextNode
The node context from where the expression is being executed from (i.e. for current() support).
|
protected XPathContext |
m_execContext
The XPathContext reference, needed for execution of many operations.
|
int |
m_lastFetched
The last node that was fetched, usually by nextNode.
|
protected int |
m_length |
protected int |
m_pos
The current position of the context node.
|
m_foundLast, m_lpi, m_predCount, m_proximityPositionsm_name, m_whatToShow, SCORE_NODETEST, SCORE_NONE, SCORE_NSWILD, SCORE_OTHER, SCORE_QNAME, SHOW_BYFUNCTION, WILDFILTER_ACCEPT, FILTER_SKIP| Modifier | Constructor and Description |
|---|---|
protected |
LocPathIterator()
Create a LocPathIterator object.
|
protected |
LocPathIterator(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.
|
protected |
LocPathIterator(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.
|
protected |
LocPathIterator(PrefixResolver nscontext)
Create a LocPathIterator object.
|
| Modifier and Type | Method and Description |
|---|---|
DTMIterator |
asIterator(XPathContext xctxt,
int contextNode)
Given an select expression and a context, evaluate the XPath and return the resulting iterator.
|
int |
asNode(XPathContext xctxt)
Return the first node out of the nodeset, if this expression is a nodeset expression.
|
boolean |
bool(XPathContext xctxt)
Evaluate expression to a boolean.
|
void |
callVisitors(XPathVisitor visitor)
This will traverse the hierarchy, calling the visitor for each member.
|
DTMIterator |
cloneWithReset()
Get a cloned Iterator that is reset to the start of the iteration.
|
void |
detach()
Detaches the
DTMIterator from the set which it iterated over, releasing any
computational resources and placing the iterator in the INVALID state. |
XObject |
execute(XPathContext xctxt)
Execute an expression in the XPath runtime context, and return the result of the expression.
|
int |
getAnalysisBits()
Get the analysis bits for this path component, as defined in the WalkerFactory.
|
int |
getAxis()
Returns the axis being iterated, if it is known.
|
int |
getCurrentNode()
Get the current node in the iterator.
|
int |
getCurrentPos()
Get the current position within the cached list, which is one less than the next nextNode()
call will retrieve. i.e. if you call getCurrentPos() and the return is 0, the next fetch will
take place at index 1.
|
DTM |
getDTM(int nodeHandle)
Get an instance of a DTM that "owns" a node handle.
|
DTMManager |
getDTMManager()
Get an instance of the DTMManager.
|
boolean |
getExpandEntityReferences()
The value of this flag determines whether the children of entity reference nodes are visible to
the iterator.
|
boolean |
getIsTopLevel()
Get if this is an iterator at the upper level of the XPath.
|
int |
getLastPos(XPathContext xctxt)
Get the number of nodes in the node list, which, in the XSLT 1 based counting system, is the
last index position.
|
int |
getLength()
The number of nodes in the list.
|
PrefixResolver |
getPrefixResolver()
Return the saved reference to the prefix resolver that was in effect when this iterator was
created.
|
int |
getRoot()
The root node of the
DTMIterator, as specified when it was created. |
int |
getWhatToShow()
This attribute determines which node types are accepted.
|
XPathContext |
getXPathContext()
The XPath execution context we are operating on.
|
void |
incrementCurrentPos()
Increment the current position in the node set.
|
boolean |
isDocOrdered()
Returns true if all the nodes in the iteration well be returned in document order.
|
boolean |
isFresh()
Tells if this NodeSetDTM is "fresh", in other words, if the first nextNode() that is called
will return the first node in the set.
|
int |
item(int index)
Returns the
node handle of an item in the collection. |
abstract int |
nextNode()
Returns the next node in the set and advances the position of the iterator in the set.
|
int |
previousNode()
Returns the previous node in the set and moves the position of the
DTMIterator
backwards in the set. |
void |
reset()
Reset the iterator to the start.
|
protected int |
returnNextNode(int nextNode)
Bottleneck the return of a next node, to make returns easier from nextNode().
|
void |
runTo(int index)
If an index is requested, NodeSetDTM will call this method to run the iterator to the index.
|
void |
setCurrentPos(int i)
Set the current position in the node set.
|
void |
setIsTopLevel(boolean b)
Set if this is an iterator at the upper level of the XPath.
|
void |
setRoot(int context,
Object environment)
Reset the root node of the
DTMIterator, overriding the value specified when it was
created. |
void |
setShouldCacheNodes(boolean b)
If setShouldCacheNodes(true) is called, then nodes will be cached, enabling random access, and
giving the ability to do sorts and the like.
|
acceptNode, callPredicateVisitors, canTraverseOutsideSubtree, clone, countProximityPosition, deepEquals, getPredicate, getPredicateCount, getProximityPosition, getProximityPosition, getProximityPosition, initPredicateInfo, initProximityPosition, isReverseAxes, nodeToString, resetProximityPositions, setLocPathIterator, setPredicateCountcalcScore, execute, execute, getLocalName, getNamespace, getNodeTypeTest, getStaticScore, initNodeTest, initNodeTest, setLocalName, setNamespace, setStaticScore, setWhatToShowassertion, error, execute, exprGetParent, exprSetParent, getColumnNumber, getExpressionOwner, getLineNumber, getPublicId, getSystemId, isSameClass, isStableNumber, numequals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcloneprotected final transient IteratorPool m_clones
protected transient DTM m_cdtm
public transient int m_lastFetched
protected transient int m_context
protected transient int m_currentContextNode
protected transient int m_pos
protected transient int m_length
protected transient XPathContext m_execContext
protected LocPathIterator()
protected LocPathIterator(PrefixResolver nscontext)
nscontext - The namespace context for this iterator, should be OK if null.protected LocPathIterator(int analysis)
throws TransformerException
TransformerException - if anyprotected LocPathIterator(int analysis,
boolean shouldLoadWalkers)
throws TransformerException
shouldLoadWalkers - True if walkers should be loaded, or false if this is a derived
iterator and it doesn't wish to load child walkers.TransformerException - if anypublic int getAnalysisBits()
getAnalysisBits in interface PathComponentpublic DTM getDTM(int nodeHandle)
getDTM in interface DTMIteratornodeHandle - the nodeHandle.public DTMManager getDTMManager()
getDTMManager in interface DTMIteratorpublic XObject execute(XPathContext xctxt) throws TransformerException
execute in class NodeTestxctxt - The XPath runtime context.XObject.TransformerException - if a runtime exception occurs.public DTMIterator asIterator(XPathContext xctxt, int contextNode)
asIterator in class Expressionxctxt - The execution context.contextNode - The node that "." expresses.public int asNode(XPathContext xctxt) throws TransformerException
asNode in class Expressionxctxt - The XPath runtime context.TransformerException - if anypublic boolean bool(XPathContext xctxt) throws TransformerException
bool in class Expressionxctxt - The XPath runtime context.TransformerException - if anypublic void setIsTopLevel(boolean b)
b - true if this location path is at the top level of the expression.public boolean getIsTopLevel()
public void setRoot(int context,
Object environment)
DTMIterator, overriding the value specified when it was
created. Note the root node is not the root node of the document tree, but the context node
from where the iteration begins.setRoot in interface DTMIteratorcontext - int Handle of the context node.environment - The environment object. The environment in which this iterator operates,
which should provide:
At this time the exact implementation of this environment is application dependent. Probably a proper interface will be created fairly soon.
public final int getCurrentPos()
getCurrentPos in interface DTMIteratorpublic void setShouldCacheNodes(boolean b)
%REVIEW% Shouldn't the other random-access methods throw an exception if they're called on a DTMIterator with this flag set false?
setShouldCacheNodes in interface DTMIteratorb - true if the nodes should be cached.public void setCurrentPos(int i)
setCurrentPos in interface DTMIteratori - Must be a valid index.public void incrementCurrentPos()
public int item(int index)
node handle of an item in the collection. If index is
greater than or equal to the number of nodes in the list, this returns null.item in interface DTMIteratorindex - of the item.indexth position in the DTMIterator,
or -1 if that is not a valid index.public int getLength()
length-1
inclusive. Note that this requires running the iterator to completion, and presumably
filling the cache.getLength in interface DTMIteratorpublic boolean isFresh()
isFresh in interface DTMIteratorpublic int previousNode()
DTMIterator
backwards in the set.previousNode in interface DTMIteratorDTM.NULL if
there are no more members in that set.public int getWhatToShow()
NodeFilter interface.getWhatToShow in interface DTMIteratorgetWhatToShow in class NodeTestNodeFilter.public int getRoot()
DTMIterator, as specified when it was created. Note the root
node is not the root node of the document tree, but the context node from where the iteration
begins and ends.getRoot in interface DTMIteratorpublic boolean getExpandEntityReferences()
whatToShow and the filter.
To produce a view of the document that has entity references expanded and does not expose
the entity reference node itself, use the whatToShow flags to hide the entity
reference node and set expandEntityReferences to true when creating the iterator.
To produce a view of the document that has entity reference nodes but no entity expansion, use
the whatToShow flags to show the entity reference node and set
expandEntityReferences to false.
NOTE: In Xalan's use of DTM we will generally have fully expanded entity references when the document tree was built, and thus this flag will have no effect.
getExpandEntityReferences in interface DTMIteratorpublic void detach()
DTMIterator from the set which it iterated over, releasing any
computational resources and placing the iterator in the INVALID state. After detach
has been invoked, calls to nextNode or previousNode will
raise a runtime exception.detach in interface DTMIteratorpublic void reset()
reset in interface DTMIteratorpublic DTMIterator cloneWithReset() throws CloneNotSupportedException
cloneWithReset in interface DTMIteratorCloneNotSupportedException - if anypublic abstract int nextNode()
DTMIterator has setRoot called, the first call to nextNode() returns
that root or (if it is rejected by the filters) the first node within its subtree which is not
filtered out.nextNode in interface DTMIteratorDTM.NULL if there
are no more members in that set.protected int returnNextNode(int nextNode)
nextNode - The next node found, may be null.public int getCurrentNode()
getCurrentNode in interface DTMIteratorpublic void runTo(int index)
runTo in interface DTMIteratorindex - The index to run to, or -1 if the iterator should be run to the end.public final XPathContext getXPathContext()
public final PrefixResolver getPrefixResolver()
public void callVisitors(XPathVisitor visitor)
callVisitors in interface XPathVisitablecallVisitors in class NodeTestvisitor - The visitor whose appropriate method will be called.public boolean isDocOrdered()
isDocOrdered in interface DTMIteratorpublic int getAxis()
getAxis in interface DTMIteratorpublic int getLastPos(XPathContext xctxt)
getLastPos in interface SubContextListgetLastPos in class PredicatedNodeTestxctxt - The XPath runtime context.Copyright © 2022–2025 HtmlUnit. All rights reserved.