org.apache.batik.dom.traversal
Class DOMTreeWalker

java.lang.Object
  extended by org.apache.batik.dom.traversal.DOMTreeWalker
All Implemented Interfaces:
TreeWalker

public class DOMTreeWalker
extends Object
implements TreeWalker

This class implements the NodeIterator interface.


Field Summary
protected  Node currentNode
          The current node.
protected  boolean expandEntityReferences
          Whether the children of entity reference nodes are visible to the iterator.
protected  NodeFilter filter
          The NodeFilter used to screen nodes.
protected  Node root
          The root node.
protected  int whatToShow
          Which node types are presented via the iterator.
 
Constructor Summary
DOMTreeWalker(Node n, int what, NodeFilter nf, boolean exp)
          Creates a new TreeWalker object.
 
Method Summary
protected  short acceptNode(Node n)
          Whether or not the given node is accepted by this tree walker.
 Node firstChild()
          DOM: Implements TreeWalker.firstChild().
protected  Node firstChild(Node n)
          Returns the first child of the given node.
 Node getCurrentNode()
          DOM: Implements TreeWalker.getCurrentNode().
 boolean getExpandEntityReferences()
          DOM: Implements TreeWalker.getExpandEntityReferences().
 NodeFilter getFilter()
          DOM: Implements TreeWalker.getFilter().
 Node getRoot()
          DOM: Implements TreeWalker.getRoot().
 int getWhatToShow()
          DOM: Implements TreeWalker.getWhatToShow().
 Node lastChild()
          DOM: Implements TreeWalker.lastChild().
protected  Node lastChild(Node n)
          Returns the last child of the given node.
 Node nextNode()
          DOM: Implements TreeWalker.nextNode().
 Node nextSibling()
          DOM: Implements TreeWalker.nextSibling().
protected  Node nextSibling(Node n, Node root)
          Returns the next sibling of the given node.
 Node parentNode()
          DOM: Implements TreeWalker.parentNode().
protected  Node parentNode(Node n)
          Returns the parent node of the given node.
 Node previousNode()
          DOM: Implements TreeWalker.previousNode().
 Node previousSibling()
          DOM: Implements TreeWalker.previousSibling().
protected  Node previousSibling(Node n, Node root)
          Returns the previous sibling of the given node.
 void setCurrentNode(Node n)
          DOM: Implements TreeWalker.setCurrentNode(Node).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

root

protected Node root
The root node.


whatToShow

protected int whatToShow
Which node types are presented via the iterator.


filter

protected NodeFilter filter
The NodeFilter used to screen nodes.


expandEntityReferences

protected boolean expandEntityReferences
Whether the children of entity reference nodes are visible to the iterator.


currentNode

protected Node currentNode
The current node.

Constructor Detail

DOMTreeWalker

public DOMTreeWalker(Node n,
                     int what,
                     NodeFilter nf,
                     boolean exp)
Creates a new TreeWalker object.

Parameters:
n - The root node.
what - Which node types are presented via the iterator.
nf - The NodeFilter used to screen nodes.
exp - Whether the children of entity reference nodes are visible to the tree walker.
Method Detail

getRoot

public Node getRoot()
DOM: Implements TreeWalker.getRoot().

Specified by:
getRoot in interface TreeWalker

getWhatToShow

public int getWhatToShow()
DOM: Implements TreeWalker.getWhatToShow().

Specified by:
getWhatToShow in interface TreeWalker

getFilter

public NodeFilter getFilter()
DOM: Implements TreeWalker.getFilter().

Specified by:
getFilter in interface TreeWalker

getExpandEntityReferences

public boolean getExpandEntityReferences()
DOM: Implements TreeWalker.getExpandEntityReferences().

Specified by:
getExpandEntityReferences in interface TreeWalker

getCurrentNode

public Node getCurrentNode()
DOM: Implements TreeWalker.getCurrentNode().

Specified by:
getCurrentNode in interface TreeWalker

setCurrentNode

public void setCurrentNode(Node n)
DOM: Implements TreeWalker.setCurrentNode(Node).

Specified by:
setCurrentNode in interface TreeWalker

parentNode

public Node parentNode()
DOM: Implements TreeWalker.parentNode().

Specified by:
parentNode in interface TreeWalker

firstChild

public Node firstChild()
DOM: Implements TreeWalker.firstChild().

Specified by:
firstChild in interface TreeWalker

lastChild

public Node lastChild()
DOM: Implements TreeWalker.lastChild().

Specified by:
lastChild in interface TreeWalker

previousSibling

public Node previousSibling()
DOM: Implements TreeWalker.previousSibling().

Specified by:
previousSibling in interface TreeWalker

nextSibling

public Node nextSibling()
DOM: Implements TreeWalker.nextSibling().

Specified by:
nextSibling in interface TreeWalker

previousNode

public Node previousNode()
DOM: Implements TreeWalker.previousNode().

Specified by:
previousNode in interface TreeWalker

nextNode

public Node nextNode()
DOM: Implements TreeWalker.nextNode().

Specified by:
nextNode in interface TreeWalker

parentNode

protected Node parentNode(Node n)
Returns the parent node of the given node.


firstChild

protected Node firstChild(Node n)
Returns the first child of the given node.


lastChild

protected Node lastChild(Node n)
Returns the last child of the given node.


previousSibling

protected Node previousSibling(Node n,
                               Node root)
Returns the previous sibling of the given node.


nextSibling

protected Node nextSibling(Node n,
                           Node root)
Returns the next sibling of the given node.


acceptNode

protected short acceptNode(Node n)
Whether or not the given node is accepted by this tree walker.



Copyright © 2008 Apache Software Foundation. All Rights Reserved.