## org.exist.storage.dom
Class NodeIterator

    java.lang.Object
      org.exist.storage.dom.NodeIterator

All Implemented Interfaces:
  java.util.Iterator

public final class NodeIterator
extends java.lang.Object
implements java.util.Iterator

Class NodeIterator is used to iterate over nodes in the DOM storage. This implementation locks the DOM file to read the node and unlocks it afterwards. It is thus safer than DOMFileIterator, since the node's value will not change.

Author:
  wolf

Constructor Summary
`NodeIterator(java.lang.Object lock, DOMFile db, DocumentImpl doc, long address)`
`NodeIterator(java.lang.Object lock, DOMFile db, StoredNode node, boolean poolable)`

Method Summary
`long` `currentAddress()` Returns the internal virtual address of the node at the iterator's current position.
`boolean` `hasNext()` Are there more nodes to be read?
`java.lang.Object` `next()` Returns the next node in document order.
`void` `remove()` Remove the current node.
`void` `setTo(long address)` Reposition the iterate at a given address.
`void` `setTo(StoredNode node)` Reposition the iterator at the address of the proxy node.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### NodeIterator

    public NodeIterator(java.lang.Object lock,
                        DOMFile db,
                        StoredNode node,
                        boolean poolable)
                 throws BTreeException,
                        java.io.IOException

### NodeIterator

    public NodeIterator(java.lang.Object lock,
                        DOMFile db,
                        DocumentImpl doc,
                        long address)

Method Detail

### currentAddress

    public long currentAddress()

  Returns the internal virtual address of the node at the iterator's current position.

  Returns:
    The currentAddress value

### hasNext

    public boolean hasNext()

  Are there more nodes to be read?

  Specified by:
    `hasNext` in interface `java.util.Iterator`
  Returns:
    Description of the Return Value

### next

    public java.lang.Object next()

  Returns the next node in document order.

  Specified by:
    `next` in interface `java.util.Iterator`

### remove

    public void remove()

  Remove the current node. This implementation just decrements the node count. It does not actually remove the node's value, but removes a page if node count == 0. Use this method only if you want to delete an entire document, not to remove a single node.

  Specified by:
    `remove` in interface `java.util.Iterator`

### setTo

    public void setTo(StoredNode node)

  Reposition the iterator at the address of the proxy node.

  Parameters:
    `node` - The new to value

### setTo

    public void setTo(long address)

  Reposition the iterate at a given address.

  Parameters:
    `address` - The new to value

Copyright (C) Wolfgang Meier. All rights reserved.