public abstract class InnerIterator extends Object implements org.w3c.dom.traversal.NodeIterator
NodeIteratorImpl
can
use either implementations.
This interface defines a reset method required for using the iterator as a node list. The destroy method is required by the care-taker design pattern, which saves the need to use weak references.
The inner iterator object is held by the creating node for the purpose of notification. The outer iterator object is held by the application for the purpose of iterating the list. When the iterator is no longer needed, the application releases the reference to the outer iterator which is garbage collected. The outer iterator's finalize method releases the reference between the node and the inner iterator, allowing the inner iterator to be garbage collected as well.
NodeIterator
Modifier and Type | Field and Description |
---|---|
protected Node |
_current
The current node.
|
protected ParentNodeImpl |
_owner
The top node of the iterated tree and the iterator's owner.
|
protected int |
_whatToShow
Mask of node types.
|
Constructor and Description |
---|
InnerIterator() |
Modifier and Type | Method and Description |
---|---|
void |
detach()
Called by
NodeIteratorImpl when this iterator is no longer
needed. |
boolean |
getExpandEntityReferences() |
org.w3c.dom.traversal.NodeFilter |
getFilter() |
Node |
getRoot()
NOTYET, required method.
|
int |
getWhatToShow() |
void |
removeNode(Node removedNode)
Called to notify this iterator that a particular node has been
removed.
|
void |
reset()
Return to the beginning of the list, so the iteration can start
all over.
|
void |
setExpandEntityReferences(boolean expand) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
nextNode, previousNode
protected ParentNodeImpl _owner
_owner
is ever returned. The iterator is
registered as a listener with this owner.protected Node _current
NodeIterator.nextNode()
or NodeIterator.previousNode()
, and is set to _owner
on initialization.protected int _whatToShow
The mask is defined as follows. For each node type, its node type code is used as the position of the one in the mask, and all masks are combined with a binary and. Thus, the default value is calculated as:
= ( 1 << ELEMENT_NODE ) + ( 1 << TEXT_NODE ) + ( 1 << CDATA_SECTION_NODE ) = ( 1 << 1 ) + ( 1 << 3 ) + ( 1 << 4 ) = 0x02 + 0x08 + 0x10 = 0x1AThis mask is set in the constructor to be one bit off than the constants defined in
NodeIterator
so that it can easily mask 1 <<
getNodeType().public void removeNode(Node removedNode)
This method only affects the iterator if it is pointing at the removed node or a child of the removed node. It does not affect the iterator if it is pointing to a parent of the removed node, or the removed node is on some other branch of the document tree.
removedNode
- The node being removedpublic void reset()
NodeIterator.nextNode()
will return the first
node in the list.public void detach()
NodeIteratorImpl
when this iterator is no longer
needed. NodeIteratorImpl
is being garbage collected when
the application ceases referencing it, but this inner iterator is
still held by the owner node. This method will unregister the
iterator with the node allowing it to be garbage collected.detach
in interface org.w3c.dom.traversal.NodeIterator
public final boolean getExpandEntityReferences()
getExpandEntityReferences
in interface org.w3c.dom.traversal.NodeIterator
public final void setExpandEntityReferences(boolean expand)
public final org.w3c.dom.traversal.NodeFilter getFilter()
getFilter
in interface org.w3c.dom.traversal.NodeIterator
public final int getWhatToShow()
getWhatToShow
in interface org.w3c.dom.traversal.NodeIterator
public Node getRoot()
getRoot
in interface org.w3c.dom.traversal.NodeIterator
Phantom® and NetPhantom® are registered trademarks of Mindus SARL.
© © Mindus SARL, 2024. All rights reserved.