org.exist.storage.dom
Class NodeIterator

java.lang.Object
  extended by org.exist.storage.dom.NodeIterator
All Implemented Interfaces:
Iterator

public final class NodeIterator
extends Object
implements 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(DBBroker broker, 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?
 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(DBBroker broker,
                    DOMFile db,
                    StoredNode node,
                    boolean poolable)
             throws BTreeException,
                    IOException
Throws:
BTreeException
IOException
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 Iterator
Returns:
Description of the Return Value

next

public Object next()
Returns the next node in document order.

Specified by:
next in interface 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 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.