| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.xpath.Expression
org.apache.xpath.patterns.NodeTest
org.apache.xpath.axes.PredicatedNodeTest
org.apache.xpath.axes.LocPathIterator
public abstract class LocPathIterator
This class extends NodeSetDTM, which implements NodeIterator,
 and fetches nodes one at a time in document order based on a XPath
 
 
 
| Nested Class Summary | 
|---|
| Nested classes/interfaces inherited from class org.apache.xpath.axes.PredicatedNodeTest | 
|---|
| PredicatedNodeTest.PredOwner | 
| Field Summary | |
|---|---|
| protected  boolean | m_allowDetachControl over whether it is OK for detach to reset the iterator. | 
| protected  DTM | m_cdtmThe dtm of the context node. | 
| protected  IteratorPool | m_clonesThe pool for cloned iterators. | 
| protected  int | m_contextThe context node for this iterator, which doesn't change through the course of the iteration. | 
| protected  int | m_currentContextNodeThe node context from where the expression is being executed from (i.e. | 
| protected  XPathContext | m_execContextThe XPathContext reference, needed for execution of many operations. | 
| private  boolean | m_isTopLevelValue determined at compile time, indicates that this is an iterator at the top level of the expression, rather than inside a predicate. | 
|  int | m_lastFetchedThe last node that was fetched, usually by nextNode. | 
| protected  int | m_length | 
| protected  int | m_posThe current position of the context node. | 
| private  PrefixResolver | m_prefixResolverFast access to the current prefix resolver. | 
| (package private)  int | m_stackFrameThe stack frame index for this iterator. | 
| (package private) static long | serialVersionUID | 
| Fields inherited from class org.apache.xpath.axes.PredicatedNodeTest | 
|---|
| DEBUG_PREDICATECOUNTING, m_foundLast, m_lpi, m_predCount, m_predicateIndex, m_proximityPositions | 
| Fields inherited from class org.apache.xpath.patterns.NodeTest | 
|---|
| m_name, m_whatToShow, SCORE_NODETEST, SCORE_NONE, SCORE_NSWILD, SCORE_OTHER, SCORE_QNAME, SHOW_BYFUNCTION, SUPPORTS_PRE_STRIPPING, WILD | 
| Fields inherited from interface org.apache.xml.dtm.DTMIterator | 
|---|
| FILTER_ACCEPT, FILTER_REJECT, FILTER_SKIP | 
| Constructor Summary | |
|---|---|
| protected  | LocPathIterator()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. | 
| protected  | LocPathIterator(PrefixResolver nscontext)Create a LocPathIterator object. | 
| Method Summary | |
|---|---|
|  void | allowDetachToRelease(boolean allowRelease)Specify if it's OK for detach to release the iterator for reuse. | 
|  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 this operation directly to a boolean. | 
|  void | callVisitors(ExpressionOwner owner,
                         XPathVisitor visitor)This will traverse the heararchy, calling the visitor for each member. | 
|  DTMIterator | cloneWithReset()Get a cloned Iterator that is reset to the beginning of the query. | 
|  void | detach()Detaches the iterator from the set which it iterated over, releasing any computational resources and placing the iterator in the INVALID state. | 
|  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. | 
|  void | executeCharsToContentHandler(XPathContext xctxt,
                                                         org.xml.sax.ContentHandler handler)Execute an expression in the XPath runtime context, and return the result of the expression. | 
|  int | getAnalysisBits()Get the analysis bits for this walker, as defined in the WalkerFactory. | 
|  int | getAxis()Returns the axis being iterated, if it is known. | 
|  int | getContext()The node context for the iterator. | 
|  int | getCurrentContextNode()The node context from where the expression is being executed from (i.e. | 
|  int | getCurrentNode()Return the last fetched node. | 
|  int | getCurrentPos()Get the current position, which is one less than the next nextNode() call will retrieve. | 
|  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. | 
|  DTMFilter | getFilter()The filter used to screen nodes. | 
|  boolean | getFoundLast()Tells if we've found the last node yet. | 
|  boolean | getIsTopLevel()Get if this is an iterator at the upper level of the XPath. | 
|  int | getLastPos(XPathContext xctxt)Get the index of the last node that can be itterated to. | 
|  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 Iterator, as specified when it was created. | 
|  int | getWhatToShow()This attribute determines which node types are presented via the iterator. | 
|  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. | 
|  boolean | isMutable()Tells if this iterator can have nodes added to it or set via the setItem(int node, int index)method. | 
|  boolean | isNodesetExpr()Tell if the expression is a nodeset expression. | 
|  int | item(int index)Returns the indexth 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 iterator backwards in the set. | 
| private  void | readObject(java.io.ObjectInputStream stream)Read the object from a serialization stream. | 
|  void | reset()Reset the iterator. | 
| 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 | setCurrentContextNode(int n)Set the current context node for this iterator. | 
|  void | setCurrentPos(int i)Set the current position in the node set. | 
|  void | setEnvironment(java.lang.Object environment)Set the environment in which this iterator operates, which should provide: a node (the context node... | 
|  void | setIsTopLevel(boolean b)Set if this is an iterator at the upper level of the XPath. | 
|  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. | 
|  void | setRoot(int context,
               java.lang.Object environment)Initialize the context values for this expression after it is cloned. | 
|  void | setShouldCacheNodes(boolean b)If setShouldCacheNodes(true) is called, then nodes will be cached. | 
|  int | size()Get the length of the cached nodes. | 
| Methods inherited from class org.apache.xpath.patterns.NodeTest | 
|---|
| calcScore, debugWhatToShow, execute, execute, getDefaultScore, getLocalName, getNamespace, getNodeTypeTest, getStaticScore, initNodeTest, initNodeTest, setLocalName, setNamespace, setStaticScore, setWhatToShow | 
| Methods inherited from class org.apache.xpath.Expression | 
|---|
| asIteratorRaw, assertion, error, execute, exprAddChild, exprGetChild, exprGetNumChildren, exprGetParent, exprSetParent, getColumnNumber, getExpressionOwner, getLineNumber, getPublicId, getSystemId, isSameClass, isStableNumber, num, warn, xstr | 
| Methods inherited from class java.lang.Object | 
|---|
| equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Methods inherited from interface org.apache.xml.dtm.DTMIterator | 
|---|
| clone | 
| Field Detail | 
|---|
static final long serialVersionUID
protected boolean m_allowDetach
protected transient IteratorPool m_clones
protected transient DTM m_cdtm
transient int m_stackFrame
private boolean m_isTopLevel
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
private PrefixResolver m_prefixResolver
protected transient XPathContext m_execContext
| Constructor Detail | 
|---|
protected LocPathIterator()
protected LocPathIterator(PrefixResolver nscontext)
nscontext - The namespace context for this iterator,
 should be OK if null.
protected LocPathIterator(Compiler compiler,
                          int opPos,
                          int analysis)
                   throws javax.xml.transform.TransformerException
compiler - The Compiler which is creating
 this expression.opPos - The position of this iterator in the
 opcode list from the compiler.
javax.xml.transform.TransformerException
protected LocPathIterator(Compiler compiler,
                          int opPos,
                          int analysis,
                          boolean shouldLoadWalkers)
                   throws javax.xml.transform.TransformerException
compiler - The Compiler which is creating
 this expression.opPos - The position of this iterator in the
 opcode list from the compiler.shouldLoadWalkers - True if walkers should be
 loaded, or false if this is a derived iterator and
 it doesn't wish to load child walkers.
javax.xml.transform.TransformerException| Method Detail | 
|---|
public int getAnalysisBits()
getAnalysisBits in interface PathComponent
private void readObject(java.io.ObjectInputStream stream)
                 throws java.io.IOException,
                        javax.xml.transform.TransformerException
stream - Input stream to read from
java.io.IOException
javax.xml.transform.TransformerExceptionpublic void setEnvironment(java.lang.Object environment)
At this time the exact implementation of this environment is application dependent. Probably a proper interface will be created fairly soon.
environment - The environment object.public DTM getDTM(int nodeHandle)
getDTM in interface DTMIteratornodeHandle - the nodeHandle.
public DTMManager getDTMManager()
getDTMManager in interface DTMIterator
public XObject execute(XPathContext xctxt)
                throws javax.xml.transform.TransformerException
execute in class NodeTestxctxt - The XPath execution context.
javax.xml.transform.TransformerException
public void executeCharsToContentHandler(XPathContext xctxt,
                                         org.xml.sax.ContentHandler handler)
                                  throws javax.xml.transform.TransformerException,
                                         org.xml.sax.SAXException
executeCharsToContentHandler in class Expressionxctxt - The XPath runtime context.handler - The target content handler.
javax.xml.transform.TransformerException - if a runtime exception
         occurs.
org.xml.sax.SAXException
public DTMIterator asIterator(XPathContext xctxt,
                              int contextNode)
                       throws javax.xml.transform.TransformerException
asIterator in class Expressionxctxt - The execution context.contextNode - The node that "." expresses.
TransformerException - thrown if the active ProblemListener decides
 the error condition is severe enough to halt processing.
javax.xml.transform.TransformerExceptionpublic boolean isNodesetExpr()
isNodesetExpr in class Expression
public int asNode(XPathContext xctxt)
           throws javax.xml.transform.TransformerException
asNode in class Expressionxctxt - The XPath runtime context.
javax.xml.transform.TransformerException
public boolean bool(XPathContext xctxt)
             throws javax.xml.transform.TransformerException
bool in class Expressionxctxt - The runtime execution context.
javax.xml.transform.TransformerExceptionpublic 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,
                    java.lang.Object environment)
setRoot in interface DTMIteratorcontext - The XPath runtime context for this
 transformation.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.
protected void setNextPosition(int next)
next - A value greater than or equal to zero that indicates the next
 node position to fetch.public final int getCurrentPos()
getCurrentPos in interface DTMIteratorpublic void setShouldCacheNodes(boolean b)
setShouldCacheNodes in interface DTMIteratorb - True if this iterator should cache nodes.public boolean isMutable()
setItem(int node, int index) method.
isMutable in interface DTMIteratorpublic void setCurrentPos(int i)
setCurrentPos in interface DTMIteratori - Must be a valid index greater
 than or equal to zero and less than m_cachedNodes.size().public void incrementCurrentPos()
public int size()
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.
public int item(int index)
index th 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 - Index into the collection.
index th position in the
   NodeList , or null if that is not a valid
   index.
public void setItem(int node,
                    int index)
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.
setItem in interface DTMIteratornode - Node to setindex - Index of where to set the nodepublic int getLength()
length-1 inclusive.
getLength in interface DTMIteratorpublic boolean isFresh()
isFresh in interface DTMIteratorpublic int previousNode()
previousNode in interface DTMIteratorNode in the set being iterated over,
   ornull if there are no more members in that set.public int getWhatToShow()
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.
getWhatToShow in interface DTMIteratorgetWhatToShow in class NodeTestNodeIteratorpublic DTMFilter getFilter()
NodeIteratorpublic int getRoot()
getRoot in interface DTMIteratorpublic boolean getExpandEntityReferences()
getExpandEntityReferences in interface DTMIteratorpublic void allowDetachToRelease(boolean allowRelease)
allowDetachToRelease in interface DTMIteratorallowRelease - true if it is OK for detach to release this iterator 
 for pooling.public void detach()
detach has been invoked, calls to
 nextNode orpreviousNode will raise the
 exception INVALID_STATE_ERR.
detach in interface DTMIteratorpublic void reset()
reset in interface DTMIterator
public DTMIterator cloneWithReset()
                           throws java.lang.CloneNotSupportedException
cloneWithReset in interface DTMIteratorjava.lang.CloneNotSupportedExceptionpublic abstract int nextNode()
nextNode in interface DTMIteratorNode in the set being iterated over, or
   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 run to the end.public final boolean getFoundLast()
public final XPathContext getXPathContext()
public final int getContext()
public final int getCurrentContextNode()
public final void setCurrentContextNode(int n)
n - Must be a non-null reference to the node context.public final PrefixResolver getPrefixResolver()
public void callVisitors(ExpressionOwner owner,
                         XPathVisitor visitor)
XPathVisitable
callVisitors in interface XPathVisitablecallVisitors in class NodeTestowner - The owner of the visitor, where that path may be 
              rewritten if needed.visitor - The visitor whose appropriate method will be called.XPathVisitable.callVisitors(ExpressionOwner, XPathVisitor)public boolean isDocOrdered()
isDocOrdered in interface DTMIteratorpublic int getAxis()
getAxis in interface DTMIteratorpublic int getLastPos(XPathContext xctxt)
PredicatedNodeTest
getLastPos in interface SubContextListgetLastPos in class PredicatedNodeTestxctxt - XPath runtime context.
PredicatedNodeTest.getLastPos(XPathContext)| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||