| org.apache.xpath.axes.PredicatedNodeTest org.apache.xpath.axes.LocPathIterator
All known Subclasses: org.apache.xpath.axes.UnionPathIterator, org.apache.xpath.axes.DescendantIterator, org.apache.xpath.axes.FilterExprIteratorSimple, org.apache.xpath.axes.WalkingIterator, org.apache.xpath.axes.BasicTestIterator, org.apache.xpath.axes.SelfIteratorNoPredicate, org.apache.xpath.axes.ChildIterator, org.apache.xpath.axes.MatchPatternIterator,
Field Summary | |
protected boolean | m_allowDetach Control over whether it is OK for detach to reset the iterator. | protected transient DTM | m_cdtm The dtm of the context node. | protected transient IteratorPool | m_clones The pool for cloned iterators. | protected transient int | m_context The context node for this iterator, which doesn't change through
the course of the iteration. | protected transient int | m_currentContextNode The node context from where the expression is being
executed from (i.e. | protected transient XPathContext | m_execContext The XPathContext reference, needed for execution of many
operations. | public transient int | m_lastFetched The last node that was fetched, usually by nextNode. | protected transient int | m_length | protected transient int | m_pos The current position of the context node. | transient int | m_stackFrame The stack frame index for this iterator. | final static long | serialVersionUID |
Constructor Summary | |
protected | LocPathIterator() Create a LocPathIterator object. | protected | LocPathIterator(PrefixResolver nscontext) Create a LocPathIterator object. | protected | LocPathIterator(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. | protected | LocPathIterator(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. |
Method Summary | |
public void | allowDetachToRelease(boolean allowRelease) Specify if it's OK for detach to release the iterator for reuse. | public DTMIterator | asIterator(XPathContext xctxt, int contextNode) Given an select expression and a context, evaluate the XPath
and return the resulting iterator. | public int | asNode(XPathContext xctxt) Return the first node out of the nodeset, if this expression is
a nodeset expression. | public boolean | bool(XPathContext xctxt) Evaluate this operation directly to a boolean.
Parameters: xctxt - The runtime execution context. | public void | callVisitors(ExpressionOwner owner, XPathVisitor visitor) | public DTMIterator | cloneWithReset() Get a cloned Iterator that is reset to the beginning
of the query. | 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. | public XObject | execute(XPathContext xctxt) Execute this iterator, meaning create a clone that can
store state, and initialize it for fast execution from
the current runtime state. | public void | executeCharsToContentHandler(XPathContext xctxt, org.xml.sax.ContentHandler handler) Execute an expression in the XPath runtime context, and return the
result of the expression.
Parameters: xctxt - The XPath runtime context. Parameters: handler - The target content handler. | public int | getAnalysisBits() Get the analysis bits for this walker, as defined in the WalkerFactory. | public int | getAxis() Returns the axis being iterated, if it is known. | final public int | getContext() The node context for the iterator. | final public int | getCurrentContextNode() The node context from where the expression is being
executed from (i.e. | public int | getCurrentNode() Return the last fetched node. | final public int | getCurrentPos() Get the current position, which is one less than
the next nextNode() call will retrieve. | public DTM | getDTM(int nodeHandle) Get an instance of a DTM that "owns" a node handle. | public DTMManager | getDTMManager() Get an instance of the DTMManager. | public boolean | getExpandEntityReferences() The value of this flag determines whether the children of entity
reference nodes are visible to the iterator. | public DTMFilter | getFilter() The filter used to screen nodes. | final public boolean | getFoundLast() Tells if we've found the last node yet. | public boolean | getIsTopLevel() Get if this is an iterator at the upper level of
the XPath. | public int | getLastPos(XPathContext xctxt) | public int | getLength() The number of nodes in the list. | final public PrefixResolver | getPrefixResolver() Return the saved reference to the prefix resolver that
was in effect when this iterator was created. | public int | getRoot() The root node of the Iterator, as specified when it was created. | public int | getWhatToShow() This attribute determines which node types are presented via the
iterator. | final public XPathContext | getXPathContext() The XPath execution context we are operating on. | public void | incrementCurrentPos() Increment the current position in the node set. | public boolean | isDocOrdered() Returns true if all the nodes in the iteration well be returned in document
order. | public 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. | public boolean | isMutable() Tells if this iterator can have nodes added to it or set via
the setItem(int node, int index) method. | public boolean | isNodesetExpr() Tell if the expression is a nodeset expression. | public int | item(int index) Returns the index th item in the collection. | abstract public int | nextNode() Returns the next node in the set and advances the position of the
iterator in the set. | public int | previousNode() Returns the previous node in the set and moves the position of the
iterator backwards in the set. | public void | reset() Reset the iterator. | protected int | returnNextNode(int nextNode) Bottleneck the return of a next node, to make returns
easier from nextNode().
Parameters: nextNode - The next node found, may be null. | public void | runTo(int index) If an index is requested, NodeSetDTM will call this method
to run the iterator to the index. | final public void | setCurrentContextNode(int n) Set the current context node for this iterator. | public void | setCurrentPos(int i) Set the current position in the node set. | public void | setEnvironment(Object environment) Set the environment in which this iterator operates, which should provide:
a node (the context node... | public void | setIsTopLevel(boolean b) Set if this is an iterator at the upper level of
the XPath. | public void | setItem(int node, int index) Sets the node at the specified index of this vector to be the
specified node. | protected void | setNextPosition(int next) Set the next position index of this iterator. | public void | setRoot(int context, Object environment) Initialize the context values for this expression
after it is cloned. | public void | setShouldCacheNodes(boolean b) If setShouldCacheNodes(true) is called, then nodes will
be cached. | public int | size() Get the length of the cached nodes.
Note: for the moment at least, this only returns
the size of the nodes that have been fetched to date,
it doesn't attempt to run to the end to make sure we
have found everything. |
m_allowDetach | protected boolean m_allowDetach(Code) | | Control over whether it is OK for detach to reset the iterator.
|
m_cdtm | protected transient DTM m_cdtm(Code) | | The dtm of the context node. Careful about using this... it may not
be the dtm of the current node.
|
m_clones | protected transient IteratorPool m_clones(Code) | | The pool for cloned iterators. Iterators need to be cloned
because the hold running state, and thus the original iterator
expression from the stylesheet pool can not be used.
|
m_context | protected transient int m_context(Code) | | The context node for this iterator, which doesn't change through
the course of the iteration.
|
m_currentContextNode | protected transient int m_currentContextNode(Code) | | The node context from where the expression is being
executed from (i.e. for current() support). Different
from m_context in that this is the context for the entire
expression, rather than the context for the subexpression.
|
m_execContext | protected transient XPathContext m_execContext(Code) | | The XPathContext reference, needed for execution of many
operations.
|
m_lastFetched | public transient int m_lastFetched(Code) | | The last node that was fetched, usually by nextNode.
|
m_length | protected transient int m_length(Code) | | |
m_pos | protected transient int m_pos(Code) | | The current position of the context node.
|
m_stackFrame | transient int m_stackFrame(Code) | | The stack frame index for this iterator.
|
serialVersionUID | final static long serialVersionUID(Code) | | |
LocPathIterator | protected LocPathIterator()(Code) | | Create a LocPathIterator object.
|
LocPathIterator | protected LocPathIterator(PrefixResolver nscontext)(Code) | | Create a LocPathIterator object.
Parameters: nscontext - The namespace context for this iterator,should be OK if null. |
LocPathIterator | protected LocPathIterator(Compiler compiler, int opPos, int analysis) throws javax.xml.transform.TransformerException(Code) | | Create a LocPathIterator object, including creation
of step walkers from the opcode list, and call back
into the Compiler to create predicate expressions.
Parameters: compiler - The Compiler which is creatingthis expression. Parameters: opPos - The position of this iterator in theopcode list from the compiler. throws: javax.xml.transform.TransformerException - |
LocPathIterator | protected LocPathIterator(Compiler compiler, int opPos, int analysis, boolean shouldLoadWalkers) throws javax.xml.transform.TransformerException(Code) | | Create a LocPathIterator object, including creation
of step walkers from the opcode list, and call back
into the Compiler to create predicate expressions.
Parameters: compiler - The Compiler which is creatingthis expression. Parameters: opPos - The position of this iterator in theopcode list from the compiler. Parameters: shouldLoadWalkers - True if walkers should beloaded, or false if this is a derived iterator andit doesn't wish to load child walkers. throws: javax.xml.transform.TransformerException - |
allowDetachToRelease | public void allowDetachToRelease(boolean allowRelease)(Code) | | Specify if it's OK for detach to release the iterator for reuse.
Parameters: allowRelease - true if it is OK for detach to release this iterator for pooling. |
asNode | public int asNode(XPathContext xctxt) throws javax.xml.transform.TransformerException(Code) | | Return the first node out of the nodeset, if this expression is
a nodeset expression. This is the default implementation for
nodesets. Derived classes should try and override this and return a
value without having to do a clone operation.
Parameters: xctxt - The XPath runtime context. the first node out of the nodeset, or DTM.NULL. |
detach | public void detach()(Code) | | 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.
|
getAnalysisBits | public int getAnalysisBits()(Code) | | Get the analysis bits for this walker, as defined in the WalkerFactory.
One of WalkerFactory#BIT_DESCENDANT, etc. |
getAxis | public int getAxis()(Code) | | Returns the axis being iterated, if it is known.
Axis.CHILD, etc., or -1 if the axis is not known or is of multiple types. |
getContext | final public int getContext()(Code) | | The node context for the iterator.
The node context, same as getRoot(). |
getCurrentContextNode | final public int getCurrentContextNode()(Code) | | The node context from where the expression is being
executed from (i.e. for current() support).
The top-level node context of the entire expression. |
getCurrentNode | public int getCurrentNode()(Code) | | Return the last fetched node. Needed to support the UnionPathIterator.
The last fetched node, or null if the last fetch was null. |
getCurrentPos | final public int getCurrentPos()(Code) | | Get the current position, 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.
A value greater than or equal to zero that indicates the nextnode position to fetch. |
getDTM | public DTM getDTM(int nodeHandle)(Code) | | Get an instance of a DTM that "owns" a node handle. Since a node
iterator may be passed without a DTMManager, this allows the
caller to easily get the DTM using just the iterator.
Parameters: nodeHandle - the nodeHandle. a non-null DTM reference. |
getDTMManager | public DTMManager getDTMManager()(Code) | | Get an instance of the DTMManager. Since a node
iterator may be passed without a DTMManager, this allows the
caller to easily get the DTMManager using just the iterator.
a non-null DTMManager reference. |
getExpandEntityReferences | public boolean getExpandEntityReferences()(Code) | | The value of this flag determines whether the children of entity
reference nodes are visible to the iterator. If false, they will be
skipped over.
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.
Always true, since entity reference nodes are notvisible in the XPath model. |
getFoundLast | final public boolean getFoundLast()(Code) | | Tells if we've found the last node yet.
true if the last nextNode returned null. |
getIsTopLevel | public boolean getIsTopLevel()(Code) | | Get if this is an iterator at the upper level of
the XPath.
true if this location path is at the top level of theexpression. |
getLength | public int getLength()(Code) | | The number of nodes in the list. The range of valid child node indices
is 0 to length-1 inclusive.
The number of nodes in the list, always greater or equal to zero. |
getPrefixResolver | final public PrefixResolver getPrefixResolver()(Code) | | Return the saved reference to the prefix resolver that
was in effect when this iterator was created.
The prefix resolver or this iterator, which may be null. |
getRoot | public int getRoot()(Code) | | The root node of the Iterator, as specified when it was created.
The "root" of this iterator, which, in XPath terms,is the node context for this iterator. |
getWhatToShow | public int getWhatToShow()(Code) | | This attribute determines which node types are presented via the
iterator. The available set of constants is defined in the
NodeFilter interface.
This is somewhat useless at this time, since it doesn't
really return information that tells what this iterator will
show. It is here only to fullfill the DOM NodeIterator
interface.
For now, always NodeFilter.SHOW_ALL & ~NodeFilter.SHOW_ENTITY_REFERENCE. See Also: org.w3c.dom.traversal.NodeIterator |
getXPathContext | final public XPathContext getXPathContext()(Code) | | The XPath execution context we are operating on.
XPath execution context this iterator is operating on,or null if setRoot has not been called. |
incrementCurrentPos | public void incrementCurrentPos()(Code) | | Increment the current position in the node set.
|
isDocOrdered | public boolean isDocOrdered()(Code) | | Returns true if all the nodes in the iteration well be returned in document
order.
true as a default. |
isFresh | public boolean isFresh()(Code) | | Tells if this NodeSetDTM is "fresh", in other words, if
the first nextNode() that is called will return the
first node in the set.
true of nextNode has not been called. |
isMutable | public boolean isMutable()(Code) | | Tells if this iterator can have nodes added to it or set via
the setItem(int node, int index) method.
True if the nodelist can be mutated. |
isNodesetExpr | public boolean isNodesetExpr()(Code) | | Tell if the expression is a nodeset expression.
true if the expression can be represented as a nodeset. |
item | public int item(int index)(Code) | | Returns the index th item in the collection. If
index is greater than or equal to the number of nodes in
the list, this returns null .
Parameters: index - Index into the collection. The node at the index th position in theNodeList , or null if that is not a validindex. |
nextNode | abstract public int nextNode()(Code) | | 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.
The next Node in the set being iterated over, ornull if there are no more members in that set. |
previousNode | public int previousNode()(Code) | | Returns the previous node in the set and moves the position of the
iterator backwards in the set.
The previous Node in the set being iterated over,ornull if there are no more members in that set. |
reset | public void reset()(Code) | | Reset the iterator.
|
returnNextNode | protected int returnNextNode(int nextNode)(Code) | | Bottleneck the return of a next node, to make returns
easier from nextNode().
Parameters: nextNode - The next node found, may be null. The same node that was passed as an argument. |
runTo | public void runTo(int index)(Code) | | If an index is requested, NodeSetDTM will call this method
to run the iterator to the index. By default this sets
m_next to the index. If the index argument is -1, this
signals that the iterator should be run to the end.
Parameters: index - The index to run to, or -1 if the iteratorshould run to the end. |
setCurrentContextNode | final public void setCurrentContextNode(int n)(Code) | | Set the current context node for this iterator.
Parameters: n - Must be a non-null reference to the node context. |
setCurrentPos | public void setCurrentPos(int i)(Code) | | Set the current position in the node set.
Parameters: i - Must be a valid index greaterthan or equal to zero and less than m_cachedNodes.size(). |
setEnvironment | public void setEnvironment(Object environment)(Code) | | Set the environment in which this iterator operates, which should provide:
a node (the context node... same value as "root" defined below)
a pair of non-zero positive integers (the context position and the context size)
a set of variable bindings
a function library
the set of namespace declarations in scope for the expression.
At this time the exact implementation of this environment is application
dependent. Probably a proper interface will be created fairly soon.
Parameters: environment - The environment object. |
setIsTopLevel | public void setIsTopLevel(boolean b)(Code) | | Set if this is an iterator at the upper level of
the XPath.
Parameters: b - true if this location path is at the top level of theexpression. |
setItem | public void setItem(int node, int index)(Code) | | Sets the node at the specified index of this vector to be the
specified node. The previous component at that position is discarded.
The index must be a value greater than or equal to 0 and less
than the current size of the vector.
The iterator must be in cached mode.
Meant to be used for sorted iterators.
Parameters: node - Node to set Parameters: index - Index of where to set the node |
setNextPosition | protected void setNextPosition(int next)(Code) | | Set the next position index of this iterator.
Parameters: next - A value greater than or equal to zero that indicates the nextnode position to fetch. |
setRoot | public void setRoot(int context, Object environment)(Code) | | Initialize the context values for this expression
after it is cloned.
Parameters: context - The XPath runtime context for thistransformation. |
setShouldCacheNodes | public void setShouldCacheNodes(boolean b)(Code) | | If setShouldCacheNodes(true) is called, then nodes will
be cached. They are not cached by default.
Parameters: b - True if this iterator should cache nodes. |
size | public int size()(Code) | | Get the length of the cached nodes.
Note: for the moment at least, this only returns
the size of the nodes that have been fetched to date,
it doesn't attempt to run to the end to make sure we
have found everything. This should be reviewed.
The size of the current cache list. |
|
|