The NodeSetDTM class can act as either a NodeVector, NodeList, or NodeIterator. However, in order for it to act as a NodeVector or NodeList, it's required that setShouldCacheNodes(true) be called before the first nextNode() is called, in order that nodes can be added as they are fetched. Derived classes that implement iterators must override runTo(int index), in order that they may run the iteration to the given index.
Note that we directly implement the DOM's NodeIterator interface. We do not emulate all the behavior of the standard NodeIterator. In particular, we do not guarantee to present a "live view" of the document ... but in XSLT, the source document should never be mutated, so this should never be an issue.
Thought: Should NodeSetDTM really implement NodeList and NodeIterator, or should there be specific subclasses of it which do so? The advantage of doing it all here is that all NodeSetDTMs will respond to the same calls; the disadvantage is that some of them may return less-than-enlightening results when you do so.
| Modifier and Type | Field and Description |
|---|---|
| protected transient boolean | m_cacheNodes
True if this list is cached. |
| private transient int | |
| pack-priv DTMManager | |
| protected transient int | m_next
If this node is being used as an iterator, the next index that nextNode() will return. |
| protected int | m_root
The root of the iteration, if available. |
| pack-priv static final long |
| Access | Constructor and Description |
|---|---|
| public | |
| public | NodeSetDTM(int
Size of blocks to allocate blocksize, int pass zero for right now... dummy, DTMManager dtmManager)Create an empty, using the given block size. |
| public | NodeSetDTM(NodeSetDTM
Set of Nodes to be made members of the new set. nodelist)Create a NodeSetDTM, and copy the members of the given NodeSetDTM into it. |
| public | NodeSetDTM(DTMIterator
Iterator which yields Nodes to be made members of the new set. ni)Create a NodeSetDTM, and copy the members of the given DTMIterator into it. |
| public | NodeSetDTM(NodeIterator
Iterator which yields Nodes to be made members of the new set. iterator, XPathContext xctxt)Create a NodeSetDTM, and copy the members of the given DTMIterator into it. |
| public | NodeSetDTM(NodeList nodeList, XPathContext xctxt)
Create a NodeSetDTM, and copy the members of the given DTMIterator into it. |
| public | NodeSetDTM(int
Single node to be added to the new set. node, DTMManager dtmManager)Create a NodeSetDTM which contains the given Node. |
| Modifier and Type | Method and Description |
|---|---|
| public void | addElement(int
The node to be added. value)Overrides com. Append a Node onto the vector. |
| public void | |
| public int | Returns: insertIndex.The node to be added. node, boolean true if we should test for doc order test, XPathContext The XPath runtime context. support)Add the node into a vector of nodes where it should occur in document order. |
| public int | Returns: The index where it was inserted.The node to be added. node, XPathContext The XPath runtime context. support)Add the node into a vector of nodes where it should occur in document order. |
| public void | addNodes(DTMIterator
DTMIterator which yields the nodes to be added. iterator)Copy NodeList members into this nodelist, adding in document order. |
| public void | addNodesInDocOrder(DTMIterator
DTMIterator which yields the nodes to be added. iterator, XPathContext The XPath runtime context. support)Copy NodeList members into this nodelist, adding in document order. |
| public void | allowDetachToRelease(boolean
true if it is OK for detach to release this iterator
for pooling. allowRelease)Implements com. Specify if it's OK for detach to release the iterator for reuse. |
| public void | appendNodes(NodeVector
The nodes to be appended to this node set. nodes)Overrides com. Append the nodes to the list. |
| public Object | Returns: a new NodeSetDTM of the same type, having the same state... though unless overridden in the subclasses, it may not copy all the state information.Overrides com. Implements com. Clone this NodeSetDTM. |
| public DTMIterator | Returns: a new NodeSetDTM of the same type, having the same state... except that the reset() operation has been called.Implements com. Get a cloned Iterator, and reset its state to the beginning of the iteration. |
| public boolean | Returns: True if the given node was found.Node to look for s)Overrides com. Tell if the table contains the given node. |
| public void | detach()
Implements com. Detaches the iterator from the set which it iterated over, releasing any computational resources and placing the iterator in the INVALID state. |
| public int | Returns: Node at specified index.The index of the requested node. i)Overrides com. Get the nth element. |
| public int | Returns: Axis.CHILD, etc., or -1 if the axis is not known or is of multiple types.Implements com. Returns the axis being iterated, if it is known. |
| public int | Returns: the last fetched node.Implements com. Return the last fetched node. |
| public int | Returns: The the current position index.Implements com. Get the current position, which is one less than the next nextNode() call will retrieve. |
| public DTM | Returns: a non-null DTM reference.the nodeHandle. nodeHandle)Implements com. Get an instance of a DTM that "owns" a node handle. |
| public DTMManager | Returns: a non-null DTMManager reference.Implements com. Get an instance of the DTMManager. |
| public boolean | Returns: true for all iterators based on NodeSetDTM, meaning that the contents of EntityRefrence nodes may be returned (though whatToShow says that the EntityReferences themselves are not shown.)Implements com. The value of this flag determines whether the children of entity reference nodes are visible to the iterator. |
| public DTMFilter | Returns: null, which is slightly misleading. True, there is no user-written filter object, but in fact we are doing some very sophisticated custom filtering. A DOM purist might suggest returning a placeholder object just to indicate that this is not going to return all nodes selected by whatToShow.The filter object used to screen nodes. |
| public int | |
| public int | Returns: integer indicating how many nodes are represented by this list.Implements com. The number of nodes in the list. |
| public int | Returns: The root node of the Iterator, as specified when it was created. For non-Iterator NodeSetDTMs, this will be null.Implements com. The root node of the |
| public boolean | Returns: True if this list is cached.Get whether or not this is a cached node set. |
| public int | Returns: integer used as a bit-array, containing flags defined in the DOM's DTMFilter class. The value will beSHOW_ALL & ~SHOW_ENTITY_REFERENCE, meaning that
only entity references are suppressed.Implements com. This attribute determines which node types are presented via the iterator. |
| public int | Returns: the index of the first occurrence of the object argument in this vector at position index or later in the vector; returns -1 if the object is not found.Node to look for elem, int Index of where to start the search index)Overrides com. Searches for the first occurence of the given argument, beginning the search at index, and testing for equality using the equals method. |
| public int | Returns: the index of the first occurrence of the object argument in this vector at position index or later in the vector; returns -1 if the object is not found.Node to look for elem)Overrides com. Searches for the first occurence of the given argument, beginning the search at index, and testing for equality using the equals method. |
| public void | insertElementAt(int
The node to be inserted. value, int The index where the insert should occur. at)Overrides com. Inserts the specified node in this vector at the specified index. |
| public void | insertNode(int
Node to be added n, int Offset at which the node is to be inserted,
with 0 being the first position. pos)Insert a node at a given position. |
| public boolean | Returns: true as a default.Implements com. Returns true if all the nodes in the iteration well be returned in document order. |
| public boolean | Returns: true if nextNode() would return the first node in the set, false if it would return a later one.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 | Returns: True if the nodelist can be mutated.Implements com. Tells if this iterator can have nodes added to it or set via
the |
| public int | Returns: The node at theindexth position in the
NodeList, or null if that is not a valid
index.Index into the collection. index)Implements com. Returns the |
| public int | Returns: The nextNode in the set being iterated over, or
DTM.NULL if there are no more members in that set.Implements com. Returns the next node in the set and advances the position of the iterator in the set. |
| public int | Returns: The previousNode in the set being iterated over,
orDTM.NULL if there are no more members in that set.Implements com. Returns the previous node in the set and moves the position of the iterator backwards in the set. |
| public void | removeAllElements()
Overrides com. Inserts the specified node in this vector at the specified index. |
| public boolean | Returns: True if the node was successfully removedThe node to be removed. s)Overrides com. Removes the first occurrence of the argument from this vector. |
| public void | removeElementAt(int
The index of the node to be removed. i)Overrides com. Deletes the component at the specified index. |
| public void | |
| public void | |
| public void | runTo(int
Position to advance (or retreat) to, with
0 requesting the reset ("fresh") position and -1 (or indeed
any out-of-bounds value) requesting the final position. index)Implements com. If an index is requested, NodeSetDTM will call this method to run the iterator to the index. |
| public void | setCurrentPos(int
Must be a valid index. i)Implements com. Set the current position in the node set. |
| public void | setElementAt(int
The node to be set. node, int The index of the node to be replaced. index)Overrides com. Sets the component at the specified index of this vector to be the specified object. |
| public void | setEnvironment(Object
The environment object. environment)Set the environment in which this iterator operates, which should provide: a node (the context node... |
| public void | setItem(int
The node to be set. node, int The index of the node to be replaced. index)Implements com. Same as setElementAt. |
| public void | |
| public void | setRoot(int
The XPath runtime context for this
transformation. context, Object environment)Implements com. Initialize the context values for this expression after it is cloned. |
| public void | setShouldCacheNodes(boolean
true if this node set should be cached. b)Implements com. If setShouldCacheNodes(true) is called, then nodes will be cached. |
| public int | Returns: The size of this node set.Overrides com. Get the length of the list. |
| m_cacheNodes | back to summary |
|---|---|
| protected transient boolean m_cacheNodes True if this list is cached. | |
| m_last | back to summary |
|---|---|
| private transient int m_last | |
| m_manager | back to summary |
|---|---|
pack-priv DTMManager m_manager
| |
| m_next | back to summary |
|---|---|
| protected transient int m_next If this node is being used as an iterator, the next index that nextNode() will return. | |
| m_root | back to summary |
|---|---|
| protected int m_root The root of the iteration, if available. | |
| serialVersionUID | back to summary |
|---|---|
| pack-priv static final long serialVersionUID Hides com. | |
| NodeSetDTM | back to summary |
|---|---|
| public NodeSetDTM(DTMManager dtmManager) Create an empty nodelist. | |
| NodeSetDTM | back to summary |
|---|---|
| public NodeSetDTM(int blocksize, int dummy, DTMManager dtmManager) Create an empty, using the given block size.
| |
| NodeSetDTM | back to summary |
|---|---|
| public NodeSetDTM(NodeSetDTM nodelist) Create a NodeSetDTM, and copy the members of the given NodeSetDTM into it.
| |
| NodeSetDTM | back to summary |
|---|---|
| public NodeSetDTM(DTMIterator ni) Create a NodeSetDTM, and copy the members of the given DTMIterator into it.
| |
| NodeSetDTM | back to summary |
|---|---|
| public NodeSetDTM(NodeIterator iterator, XPathContext xctxt) Create a NodeSetDTM, and copy the members of the given DTMIterator into it.
| |
| NodeSetDTM | back to summary |
|---|---|
| public NodeSetDTM(NodeList nodeList, XPathContext xctxt) Create a NodeSetDTM, and copy the members of the given DTMIterator into it. | |
| NodeSetDTM | back to summary |
|---|---|
| public NodeSetDTM(int node, DTMManager dtmManager) Create a NodeSetDTM which contains the given Node.
| |
| addElement | back to summary |
|---|---|
| public void addElement(int value) Overrides com. Append a Node onto the vector.
| |
| addNode | back to summary |
|---|---|
| public void addNode(int n) Add a node to the NodeSetDTM. Not all types of NodeSetDTMs support this operation
| |
| addNodeInDocOrder | back to summary |
|---|---|
| public int addNodeInDocOrder(int node, boolean test, XPathContext support) Add the node into a vector of nodes where it should occur in document order.
| |
| addNodeInDocOrder | back to summary |
|---|---|
| public int addNodeInDocOrder(int node, XPathContext support) Add the node into a vector of nodes where it should occur in document order.
| |
| addNodes | back to summary |
|---|---|
| public void addNodes(DTMIterator iterator) Copy NodeList members into this nodelist, adding in document order. Null references are not added.
| |
| addNodesInDocOrder | back to summary |
|---|---|
| public void addNodesInDocOrder(DTMIterator iterator, XPathContext support) Copy NodeList members into this nodelist, adding in document order. If a node is null, don't add it.
| |
| allowDetachToRelease | back to summary |
|---|---|
| public void allowDetachToRelease(boolean allowRelease) Implements com. Specify if it's OK for detach to release the iterator for reuse.
| |
| appendNodes | back to summary |
|---|---|
| public void appendNodes(NodeVector nodes) Overrides com. Append the nodes to the list.
| |
| clone | back to summary |
|---|---|
| public Object clone() throws CloneNotSupportedException Overrides com. Implements com. Clone this NodeSetDTM. At this time, we only expect this to be used with LocPathIterators; it may not work with other kinds of NodeSetDTMs.
| |
| cloneWithReset | back to summary |
|---|---|
| public DTMIterator cloneWithReset() throws CloneNotSupportedException Implements com. Get a cloned Iterator, and reset its state to the beginning of the iteration.
| |
| contains | back to summary |
|---|---|
| public boolean contains(int s) Overrides com. Tell if the table contains the given node.
| |
| detach | back to summary |
|---|---|
| public void detach() Implements com. Detaches the iterator from the set which it iterated over, releasing
any computational resources and placing the iterator in the INVALID
state. After This operation is a no-op in NodeSetDTM, and will not cause INVALID_STATE_ERR to be raised by later operations. | |
| elementAt | back to summary |
|---|---|
| public int elementAt(int i) Overrides com. Get the nth element.
| |
| getAxis | back to summary |
|---|---|
| public int getAxis() Implements com. Returns the axis being iterated, if it is known.
| |
| getCurrentNode | back to summary |
|---|---|
| public int getCurrentNode() Implements com. Return the last fetched node. Needed to support the UnionPathIterator.
| |
| getCurrentPos | back to summary |
|---|---|
| public int getCurrentPos() Implements com. 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.
| |
| getDTM | back to summary |
|---|---|
| public DTM getDTM(int nodeHandle) Implements 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. 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. 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.
| |
| getFilter | back to summary |
|---|---|
| public DTMFilter getFilter() The filter object used to screen nodes. Filters are applied to further reduce (and restructure) the DTMIterator's view of the document. In our case, we will be using hardcoded filters built into our iterators... but getFilter() is part of the DOM's DTMIterator interface, so we have to support it.
| |
| getLast | back to summary |
|---|---|
| public int getLast() | |
| getLength | back to summary |
|---|---|
| public int getLength() Implements 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
| |
| getShouldCacheNodes | back to summary |
|---|---|
| public boolean getShouldCacheNodes() Get whether or not this is a cached node set.
| |
| getWhatToShow | back to summary |
|---|---|
| public int getWhatToShow() Implements com. This attribute determines which node types are presented via the
iterator. The available set of constants is defined in the
| |
| indexOf | back to summary |
|---|---|
| public int indexOf(int elem, int index) Overrides com. Searches for the first occurence of the given argument, beginning the search at index, and testing for equality using the equals method.
| |
| indexOf | back to summary |
|---|---|
| public int indexOf(int elem) Overrides com. Searches for the first occurence of the given argument, beginning the search at index, and testing for equality using the equals method.
| |
| insertElementAt | back to summary |
|---|---|
| public void insertElementAt(int value, int at) Overrides com. Inserts the specified node in this vector at the specified index. Each component in this vector with an index greater or equal to the specified index is shifted upward to have an index one greater than the value it had previously.
| |
| insertNode | back to summary |
|---|---|
| public void insertNode(int n, int pos) Insert a node at a given position.
| |
| isDocOrdered | back to summary |
|---|---|
| public boolean isDocOrdered() Implements 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. 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. 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. Returns the Todo What happens if index is out of range?
| |
| nextNode | back to summary |
|---|---|
| public int nextNode() Implements com. Returns the next node in the set and advances the position of the iterator in the set. After a DTMIterator is created, the first call to nextNode() returns the first node in the set.
| |
| previousNode | back to summary |
|---|---|
| public int previousNode() Implements com. Returns the previous node in the set and moves the position of the iterator backwards in the set.
| |
| removeAllElements | back to summary |
|---|---|
| public void removeAllElements() Overrides com. Inserts the specified node in this vector at the specified index. Each component in this vector with an index greater or equal to the specified index is shifted upward to have an index one greater than the value it had previously.
| |
| removeElement | back to summary |
|---|---|
| public boolean removeElement(int s) Overrides com. Removes the first occurrence of the argument from this vector. If the object is found in this vector, each component in the vector with an index greater or equal to the object's index is shifted downward to have an index one smaller than the value it had previously.
| |
| removeElementAt | back to summary |
|---|---|
| public void removeElementAt(int i) Overrides com. Deletes the component at the specified index. Each component in this vector with an index greater or equal to the specified index is shifted downward to have an index one smaller than the value it had previously.
| |
| removeNode | back to summary |
|---|---|
| public void removeNode(int n) Remove a node.
| |
| reset | back to summary |
|---|---|
| public void reset() Implements com. Reset the iterator. May have no effect on non-iterator Nodesets. | |
| runTo | back to summary |
|---|---|
| public void runTo(int index) Implements 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.
| |
| setCurrentPos | back to summary |
|---|---|
| public void setCurrentPos(int i) Implements com. Set the current position in the node set.
| |
| setElementAt | back to summary |
|---|---|
| public void setElementAt(int node, int index) Overrides com. Sets the component at the specified index of this vector to be the specified object. 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.
| |
| setEnvironment | back to summary |
|---|---|
| public void setEnvironment(Object environment) 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.
| |
| setItem | back to summary |
|---|---|
| public void setItem(int node, int index) Implements com. Same as setElementAt.
| |
| setLast | back to summary |
|---|---|
| public void setLast(int last) | |
| setRoot | back to summary |
|---|---|
| public void setRoot(int context, Object environment) Implements com. Initialize the context values for this expression after it is cloned.
| |
| setShouldCacheNodes | back to summary |
|---|---|
| public void setShouldCacheNodes(boolean b) Implements com. If setShouldCacheNodes(true) is called, then nodes will be cached. They are not cached by default. This switch must be set before the first call to nextNode is made, to ensure that all nodes are cached.
| |
| size | back to summary |
|---|---|
| public int size() Overrides com. Get the length of the list.
| |