站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JDK 5 Documentation v6.0, Java 2 SDK 英文文档

TreePath (Compiler Tree API) - JDK 5 Documentation v6.0, Java 2 SDK 英文文档


Compiler Tree API

com.sun.source.util
Class TreePath

java.lang.Object
  extended by com.sun.source.util.TreePath
All Implemented Interfaces:
Iterable<Tree>

public class TreePath
extends Object
implements Iterable<Tree>

A path of tree nodes, typically used to represent the sequence of ancestor nodes of a tree node up to the top level CompilationUnitTree node.

Since:
1.6

Constructor Summary
TreePath(CompilationUnitTree t)
          Creates a TreePath for a root node.
TreePath(TreePath p, Tree t)
          Creates a TreePath for a child node.
 
Method Summary
 CompilationUnitTree getCompilationUnit()
          Get the compilation unit associated with this path.
 Tree getLeaf()
          Get the leaf node for this path.
 TreePath getParentPath()
          Get the path for the enclosing node, or null if there is no enclosing node.
static TreePath getPath(CompilationUnitTree unit, Tree target)
          Gets a tree path for a tree node within a compilation unit.
static TreePath getPath(TreePath path, Tree target)
          Gets a tree path for a tree node within a subtree identified by a TreePath object.
 Iterator<Tree> iterator()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreePath

public TreePath(CompilationUnitTree t)
Creates a TreePath for a root node.


TreePath

public TreePath(TreePath p,
                Tree t)
Creates a TreePath for a child node.

Method Detail

getPath

public static TreePath getPath(CompilationUnitTree unit,
                               Tree target)
Gets a tree path for a tree node within a compilation unit.

Returns:
null if the node is not found

getPath

public static TreePath getPath(TreePath path,
                               Tree target)
Gets a tree path for a tree node within a subtree identified by a TreePath object.

Returns:
null if the node is not found

getCompilationUnit

public CompilationUnitTree getCompilationUnit()
Get the compilation unit associated with this path.


getLeaf

public Tree getLeaf()
Get the leaf node for this path.


getParentPath

public TreePath getParentPath()
Get the path for the enclosing node, or null if there is no enclosing node.


iterator

public Iterator<Tree> iterator()
Specified by:
iterator in interface Iterable<Tree>

Compiler Tree API

Report a bug or request a feature.
Copyright 2006 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.