package at.gv.egovernment.moa.util;
import java.util.ListIterator;
import org.w3c.dom.DOMException;
import org.w3c.dom.Node;
import org.w3c.dom.traversal.NodeFilter;
import org.w3c.dom.traversal.NodeIterator;
/**
* A NodeIterator
implementation based on a
* ListIterator
.
*
* @see java.util.ListIterator
* @see org.w3c.dom.traversal.NodeIterator
*
* @author Patrick Peck
* @version $Id$
*/
public class NodeIteratorAdapter implements NodeIterator {
/** The ListIterator
to wrap. */
private ListIterator nodeIterator;
/**
* Create a new NodeIteratorAdapter
.
* @param nodeIterator The ListIterator
to iterate over.
*/
public NodeIteratorAdapter(ListIterator nodeIterator) {
this.nodeIterator = nodeIterator;
}
/**
* @see org.w3c.dom.traversal.NodeIterator#getRoot()
*/
public Node getRoot() {
return null;
}
/**
* @see org.w3c.dom.traversal.NodeIterator#getWhatToShow()
*/
public int getWhatToShow() {
return NodeFilter.SHOW_ALL;
}
/**
* @see org.w3c.dom.traversal.NodeIterator#getFilter()
*/
public NodeFilter getFilter() {
return null;
}
/**
* @see org.w3c.dom.traversal.NodeIterator#getExpandEntityReferences()
*/
public boolean getExpandEntityReferences() {
return false;
}
/**
* @see org.w3c.dom.traversal.NodeIterator#nextNode()
*/
public Node nextNode() throws DOMException {
if (nodeIterator.hasNext()) {
return (Node) nodeIterator.next();
}
return null;
}
/**
* @see org.w3c.dom.traversal.NodeIterator#previousNode()
*/
public Node previousNode() throws DOMException {
if (nodeIterator.hasPrevious()) {
return (Node) nodeIterator.previous();
}
return null;
}
/**
* @see org.w3c.dom.traversal.NodeIterator#detach()
*/
public void detach() {
}
}