FileDocCategorySizeDatePackage
TreePathScanner.javaAPI DocJava SE 6 API1609Tue Jun 10 00:23:26 BST 2008com.sun.source.util

TreePathScanner

public class TreePathScanner extends TreeScanner
A TreeVisitor that visits all the child tree nodes, and provides support for maintaining a path for the parent nodes. To visit nodes of a particular type, just override the corresponding visitorXYZ method. Inside your method, call super.visitXYZ to visit descendant nodes.
author
Jonathan Gibbons
since
1.6

Fields Summary
private TreePath
path
Constructors Summary
Methods Summary
public TreePathgetCurrentPath()
Get the current path for the node, as built up by the currently active set of scan calls.

	return path;
    
public Rscan(TreePath path, P p)
Scan a tree from a position identified by a TreePath.

	this.path = path;
	try {
	    return path.getLeaf().accept(this, p);
	} finally {
	    this.path = null;
	}
    
public Rscan(Tree tree, P p)
Scan a single node. The current path is updated for the duration of the scan.

	if (tree == null)
	    return null;
	
        TreePath prev = path;
        path = new TreePath(path, tree);      
	try {
	    return tree.accept(this, p);
	} finally {
	    path = prev;
	}