|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.aspectj.org.eclipse.jdt.core.dom.NodeFinder
public final class NodeFinder
For a given selection range, finds the covered node and the covering node.
| Constructor Summary | |
|---|---|
NodeFinder(ASTNode root,
int start,
int length)
Instantiate a new node finder using the given root node, the given start and the given length. |
|
| Method Summary | |
|---|---|
ASTNode |
getCoveredNode()
If the AST contains nodes whose range is equal to the selection, returns the innermost of those nodes. |
ASTNode |
getCoveringNode()
Returns the innermost node that fully contains the selection. |
static ASTNode |
perform(ASTNode root,
int start,
int length)
Maps a selection to an ASTNode, where the selection is defined using a start and a length. |
static ASTNode |
perform(ASTNode root,
int start,
int length,
ITypeRoot source)
Maps a selection to an ASTNode, where the selection is given by a start and a length. |
static ASTNode |
perform(ASTNode root,
ISourceRange range)
Maps a selection to an ASTNode, where the selection is defined using a source range. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public NodeFinder(ASTNode root,
int start,
int length)
root - the given root nodestart - the given startlength - the given length| Method Detail |
|---|
public static ASTNode perform(ASTNode root,
int start,
int length)
root - the root node from which the search startsstart - the start of the selectionlength - the length of the selection
public static ASTNode perform(ASTNode root,
ISourceRange range)
perform(root, range.getOffset(), range.getLength()).
root - the root node from which the search startsrange - the selection range
perform(ASTNode, int, int)
public static ASTNode perform(ASTNode root,
int start,
int length,
ITypeRoot source)
throws JavaModelException
getCoveredNode() doesn't find a node, returns null.covering node.
root - the root node from which the search startsstart - the start of the selectionlength - the length of the selectionsource - the source of the compilation unit
JavaModelException - if an error occurs in the Java modelpublic ASTNode getCoveredNode()
Example: For a SimpleType whose name is a SimpleName and a selection that equals both nodes' range,
the covered node is the SimpleName.
But if the selection is expanded to include a whitespace before or after the SimpleType,
then the covered node is the SimpleType.
null if the selection is empty or too short to cover an entire nodepublic ASTNode getCoveringNode()
If more than one node covers the selection, the returned node is the last covering node found in a preorder traversal of the AST. This implies that for a zero-length selection between two adjacent sibling nodes, the node on the right is returned.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||