| Modifier and Type | Class and Description |
|---|---|
| private static class | NodeSequence.
Each NodeSequence object has an iterator which is "walked". |
| Modifier and Type | Field and Description |
|---|---|
| private NodeSequence. | m_cache
A cache of a list of nodes obtained from the iterator so far. |
| protected DTMManager | m_dtmMgr
The DTMManager to use if we're using a NodeVector only. |
| protected DTMIterator | m_iter
The functional iterator that fetches nodes. |
| protected int | m_last
The index of the last node in the iteration. |
| protected int | m_next
The index of the next node to be fetched. |
| pack-priv static final long |
| Access | Constructor and Description |
|---|---|
| private | NodeSequence(DTMIterator
Cloned (not static) DTMIterator. iter, int The initial context node. context, XPathContext The execution context. xctxt, boolean True if this sequence can random access. shouldCacheNodes)Create a new NodeSequence from a (already cloned) iterator. |
| public | |
| private | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected int | Returns: insertIndex.The node to be added. node)Add the node into a vector of nodes where it should occur in document order. |
| public void | allowDetachToRelease(boolean allowRelease)
Overrides com. Implements com. Calling this with a value of false will cause the nodeset to be cached. |
| private boolean | cacheComplete()
If this NodeSequence has a cache, and that cache is fully populated then this method returns true, otherwise if there is no cache or it is not complete it returns false. |
| public Object | Returns: A clone of this object.Overrides java. Implements com. Get a clone of this iterator, but don't reset the iteration in the process, so that it may be used from the current position. |
| public DTMIterator | cloneWithReset()
Implements com. Note Not a deep clone. |
| public void | detach()
Overrides com. Implements com. Detaches the |
| public void | fixupVariables(List<QName> vars, int globalsSize)
Overrides com. XObjects should not normally need to fix up variables. |
| public int | getAnalysisBits()
Implements com. Get the analysis bits for this path component, as defined in the WalkerFactory. |
| public int | getAxis()
Implements com. Returns the axis being iterated, if it is known. |
| private NodeSequence. | |
| public final DTMIterator | |
| public int | getCurrentNode()
Implements com. Get the current node in the iterator. |
| public int | getCurrentPos()
Implements com. Get the current position within the cached list, which is one less than the next nextNode() call will retrieve. |
| public DTM | getDTM(int nodeHandle)
Implements com. Get an instance of a DTM that "owns" a node handle. |
| public DTMManager | getDTMManager()
Implements com. Get an instance of the DTMManager. |
| public boolean | getExpandEntityReferences()
Implements com. The value of this flag determines whether the children of entity reference nodes are visible to the iterator. |
| protected NodeSequence. | getIteratorCache()
Get the cached list of nodes appended with values obtained from the iterator as a NodeSequence is walked when its nextNode() method is called. |
| public int | getLength()
Implements com. The number of nodes in the list. |
| public int | getRoot()
Implements com. The root node of the |
| protected NodeVector | getVector()
If this iterator needs to cache nodes that are fetched, they are stored in the Vector in the generic object. |
| public int | getWhatToShow()
Implements com. This attribute determines which node types are presented via the iterator. |
| public boolean | |
| public boolean | isDocOrdered()
Implements com. Returns true if all the nodes in the iteration well be returned in document order. |
| public boolean | isFresh()
Implements com. 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()
Implements com. Tells if this iterator can have nodes added to it or set via
the |
| public int | item(int index)
Implements com. Returns the |
| private void | |
| public int | nextNode()
Implements com. Returns the next node in the set and advances the position of the iterator in the set. |
| public int | previousNode()
Implements com. Returns the previous node in the set and moves the position of the
|
| public void | reset()
Overrides com. Implements com. Reset the iterator to the start. |
| public void | runTo(int index)
Implements com. If an index is requested, NodeSetDTM will call this method to run the iterator to the index. |
| public void | setCurrentPos(int i)
Implements com. Set the current position in the node set. |
| public void | setItem(int node, int index)
Implements com. Sets the node at the specified index of this vector to be the specified node. |
| public final void | setIter(DTMIterator
The iterator that is to be contained. iter)Set the functional iterator that fetches nodes. |
| protected void | setObject(Object obj)
Overrides com. It used to be that many locations in the code simply did an assignment to this.m_obj directly, rather than calling the setObject(Object) method. |
| public void | setRoot(int nodeHandle, Object environment)
Implements com. Reset the root node of the |
| public void | setShouldCacheNodes(boolean b)
Implements com. If setShouldCacheNodes(true) is called, then nodes will be cached, enabling random access, and giving the ability to do sorts and the like. |
| protected void |
| m_cache | back to summary |
|---|---|
| private NodeSequence. A cache of a list of nodes obtained from the iterator so far. This list is appended to until the iterator is exhausted and the cache is complete. Multiple NodeSequence objects may share the same cache.
| |
| m_dtmMgr | back to summary |
|---|---|
| protected DTMManager m_dtmMgr The DTMManager to use if we're using a NodeVector only. We may well want to do away with this, and store it in the NodeVector.
| |
| m_iter | back to summary |
|---|---|
| protected DTMIterator m_iter The functional iterator that fetches nodes.
| |
| m_last | back to summary |
|---|---|
| protected int m_last The index of the last node in the iteration. | |
| m_next | back to summary |
|---|---|
| protected int m_next The index of the next node to be fetched. Useful if this is a cached iterator, and is being used as random access NodeList. | |
| serialVersionUID | back to summary |
|---|---|
| pack-priv static final long serialVersionUID Hides com. | |
| NodeSequence | back to summary |
|---|---|
| private NodeSequence(DTMIterator iter, int context, XPathContext xctxt, boolean shouldCacheNodes) Create a new NodeSequence from a (already cloned) iterator.
| |
| NodeSequence | back to summary |
|---|---|
| public NodeSequence(Object nodeVector) Create a new NodeSequence from a (already cloned) iterator. | |
| NodeSequence | back to summary |
|---|---|
| private NodeSequence(DTMManager dtmMgr) Construct an empty XNodeSet object. This is used to create a mutable nodeset to which random nodes may be added. | |
| NodeSequence | back to summary |
|---|---|
| public NodeSequence() Create a new NodeSequence in an invalid (null) state. | |
| addNodeInDocOrder | back to summary |
|---|---|
| protected int addNodeInDocOrder(int node) Add the node into a vector of nodes where it should occur in document order.
| |
| allowDetachToRelease | back to summary |
|---|---|
| public void allowDetachToRelease(boolean allowRelease) Overrides com. Implements com. Calling this with a value of false will cause the nodeset to be cached. | |
| cacheComplete | back to summary |
|---|---|
| private boolean cacheComplete() If this NodeSequence has a cache, and that cache is fully populated then this method returns true, otherwise if there is no cache or it is not complete it returns false. | |
| clone | back to summary |
|---|---|
| public Object clone() throws CloneNotSupportedException Overrides java. Implements com. Get a clone of this iterator, but don't reset the iteration in the process, so that it may be used from the current position. Note Not a deep clone.
| |
| cloneWithReset | back to summary |
|---|---|
| public DTMIterator cloneWithReset() throws CloneNotSupportedException Implements com. Note Not a deep clone.
| |
| detach | back to summary |
|---|---|
| public void detach() Overrides com. Implements com. Doc from com. Detaches the
| |
| fixupVariables | back to summary |
|---|---|
| public void fixupVariables(List<QName> vars, int globalsSize) Overrides com. Doc from com. XObjects should not normally need to fix up variables. | |
| getAnalysisBits | back to summary |
|---|---|
| public int getAnalysisBits() Implements com. Doc from com. Get the analysis bits for this path component, as defined in the WalkerFactory.
| |
| getAxis | back to summary |
|---|---|
| public int getAxis() Implements com. Doc from com. Returns the axis being iterated, if it is known.
| |
| getCache | back to summary |
|---|---|
| private NodeSequence. Get the cache (if any) of nodes obtained from the iterator so far. Note that the cache keeps growing until the iterator is walked to exhaustion, at which point the cache is "complete". | |
| getContainedIter | back to summary |
|---|---|
| public final DTMIterator getContainedIter() Get the functional iterator that fetches nodes.
| |
| getCurrentNode | back to summary |
|---|---|
| public int getCurrentNode() Implements com. Doc from com. Get the current node in the iterator. Note that this differs from the DOM's NodeIterator, where the current position lies between two nodes (as part of the maintain-relative-position semantic).
| |
| getCurrentPos | back to summary |
|---|---|
| public int getCurrentPos() Implements com. Doc from com. 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.
| |
| getDTM | back to summary |
|---|---|
| public DTM getDTM(int nodeHandle) Implements com. Doc from com. 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.
| |
| getDTMManager | back to summary |
|---|---|
| public DTMManager getDTMManager() Implements com. Doc from com. 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.
| |
| getExpandEntityReferences | back to summary |
|---|---|
| public boolean getExpandEntityReferences() Implements com. Doc from com. The value of this flag determines whether the children of entity
reference nodes are visible to the iterator. If false, they and
their descendants will be rejected. Note that this rejection takes
precedence over To produce a view of the document that has entity references
expanded and does not expose the entity reference node itself, use
the 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. | |
| getIteratorCache | back to summary |
|---|---|
| protected NodeSequence. Get the cached list of nodes appended with values obtained from the iterator as a NodeSequence is walked when its nextNode() method is called. | |
| getLength | back to summary |
|---|---|
| public int getLength() Implements com. Doc from com. The number of nodes in the list. The range of valid child node indices
is 0 to
| |
| getRoot | back to summary |
|---|---|
| public int getRoot() Implements com. Doc from com. The root node of the
| |
| getVector | back to summary |
|---|---|
| protected NodeVector getVector() If this iterator needs to cache nodes that are fetched, they are stored in the Vector in the generic object. | |
| getWhatToShow | back to summary |
|---|---|
| public int getWhatToShow() Implements com. Doc from com. This attribute determines which node types are presented via the
iterator. The available set of constants is defined above.
Nodes not accepted by
| |
| hasCache | back to summary |
|---|---|
| public boolean hasCache() If the iterator needs to cache nodes as they are fetched, then this method returns true. | |
| isDocOrdered | back to summary |
|---|---|
| public boolean isDocOrdered() Implements com. Doc from com. Returns true if all the nodes in the iteration well be returned in document order.
| |
| isFresh | back to summary |
|---|---|
| public boolean isFresh() Implements com. Doc from com. Tells if this NodeSetDTM is "fresh", in other words, if the first nextNode() that is called will return the first node in the set.
| |
| isMutable | back to summary |
|---|---|
| public boolean isMutable() Implements com. Doc from com. Tells if this iterator can have nodes added to it or set via
the
| |
| item | back to summary |
|---|---|
| public int item(int index) Implements com. Doc from com. Returns the
| |
| markCacheComplete | back to summary |
|---|---|
| private void markCacheComplete() If this NodeSequence has a cache, mark that it is complete. This method should be called after the iterator is exhausted. | |
| nextNode | back to summary |
|---|---|
| public int nextNode() Implements com. Doc from com. Returns the next node in the set and advances the position of the
iterator in the set. After a
| |
| previousNode | back to summary |
|---|---|
| public int previousNode() Implements com. Doc from com. Returns the previous node in the set and moves the position of the
| |
| reset | back to summary |
|---|---|
| public void reset() Overrides com. Implements com. Doc from com. Reset the iterator to the start. After resetting, the next node returned will be the root node -- or, if that's filtered out, the first node within the root's subtree which is _not_ skipped by the filters.
| |
| runTo | back to summary |
|---|---|
| public void runTo(int index) Implements com. Doc from com. 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 and completely fill the cache.
| |
| setCurrentPos | back to summary |
|---|---|
| public void setCurrentPos(int i) Implements com. Doc from com. Set the current position in the node set.
| |
| setItem | back to summary |
|---|---|
| public void setItem(int node, int index) Implements com. Doc from com. 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.
| |
| setIter | back to summary |
|---|---|
| public final void setIter(DTMIterator iter) Set the functional iterator that fetches nodes.
| |
| setObject | back to summary |
|---|---|
| protected void setObject(Object obj) Overrides com. It used to be that many locations in the code simply did an assignment to this.m_obj directly, rather than calling the setObject(Object) method. The problem is that our super-class would be updated on what the cache associated with this NodeSequence, but we wouldn't know ourselves. All setting of m_obj is done through setObject() now, and this method over-rides the super-class method. So now we are in the loop have an opportunity to update some caching information. | |
| setRoot | back to summary |
|---|---|
| public void setRoot(int nodeHandle, Object environment) Implements com. Doc from com. Reset the root node of the
| |
| setShouldCacheNodes | back to summary |
|---|---|
| public void setShouldCacheNodes(boolean b) Implements com. Doc from com. If setShouldCacheNodes(true) is called, then nodes will be cached, enabling random access, and giving the ability to do sorts and the like. They are not cached by default. %REVIEW% Shouldn't the other random-access methods throw an exception if they're called on a DTMIterator with this flag set false? | |
| SetVector | back to summary |
|---|---|
| protected void SetVector(NodeVector v) Set the vector where nodes will be cached. | |
Note that multiple NodeSequence objects may hold a reference to the same cache, and also (and this is important) the same iterator. The iterator and its cache may be shared among many NodeSequence objects.
If one of the NodeSequence objects walks ahead of the others it fills in the cache. As the others NodeSequence objects catch up they get their values from the cache rather than the iterator itself, so the iterator is only ever walked once and everyone benefits from the cache.
At some point the cache may be complete due to walking to the end of one of the copies of the iterator, and the cache is then marked as "complete". and the cache will have no more nodes added to it.
Its use-count is the number of NodeSequence objects that use it.
| Modifier and Type | Field and Description |
|---|---|
| private boolean | m_isComplete2
true if the associated iterator is exhausted and all nodes obtained from it are in the cache. |
| private int | |
| private NodeVector | m_vec2
A list of nodes already obtained from the iterator. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| private NodeVector | |
| private void | increaseUseCount()
This method is called when yet another NodeSequence object uses, or shares this same cache. |
| private boolean | |
| private void | setCacheComplete(boolean b)
Call this method with 'true' if the iterator is exhausted and the cached list is complete, or no longer growing. |
| private void | setVector(NodeVector nv)
Sets the NodeVector that holds the growing list of nodes as they are appended to the cached list. |
| private int |
| m_isComplete2 | back to summary |
|---|---|
| private boolean m_isComplete2 true if the associated iterator is exhausted and all nodes obtained from it are in the cache. | |
| m_useCount2 | back to summary |
|---|---|
| private int m_useCount2 | |
| m_vec2 | back to summary |
|---|---|
| private NodeVector m_vec2 A list of nodes already obtained from the iterator. As the iterator is walked the nodes obtained from it are appended to this list. Both an iterator and its corresponding cache can be shared by multiple NodeSequence objects. For example, consider three NodeSequence objects ns1, ns2 and ns3 doing such sharing, and the nodes to be obtaind from the iterator being the sequence { 33, 11, 44, 22, 55 }. If ns3.nextNode() is called 3 times the the underlying iterator will have walked through 33, 11, 55 and these three nodes will have been put in the cache. If ns2.nextNode() is called 2 times it will return 33 and 11 from the cache, leaving the iterator alone. If ns1.nextNode() is called 6 times it will return 33 and 11 from the cache, then get 44, 22, 55 from the iterator, and appending 44, 22, 55 to the cache. On the sixth call it is found that the iterator is exhausted and the cache is marked complete. Should ns2 or ns3 have nextNode() called they will know that the cache is complete, and they will obtain all subsequent nodes from the cache. Note that the underlying iterator, though shared is only ever walked once. | |
| IteratorCache | back to summary |
|---|---|
| pack-priv IteratorCache() | |
| getVector | back to summary |
|---|---|
| private NodeVector getVector() Get the cached list of nodes obtained from the iterator so far. | |
| increaseUseCount | back to summary |
|---|---|
| private void increaseUseCount() This method is called when yet another NodeSequence object uses, or shares this same cache. | |
| isComplete | back to summary |
|---|---|
| private boolean isComplete() Returns true if no cache is complete and immutable. | |
| setCacheComplete | back to summary |
|---|---|
| private void setCacheComplete(boolean b) Call this method with 'true' if the iterator is exhausted and the cached list is complete, or no longer growing. | |
| setVector | back to summary |
|---|---|
| private void setVector(NodeVector nv) Sets the NodeVector that holds the growing list of nodes as they are appended to the cached list. | |
| useCount | back to summary |
|---|---|
| private int useCount() Returns count of how many NodeSequence objects share this IteratorCache object. | |