checkers.util
Class Heuristics
java.lang.Object
checkers.util.Heuristics
public class Heuristics
extends Object
Utilities for determining tree-based heuristics.
- See Also:
for an example
Method Summary
static boolean |
matchParents(TreePath path,
Tree.Kind... kinds)
Determines whether a tree has a particular set of direct parents,
ignoring blocks and parentheses. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Heuristics
public Heuristics()
matchParents
public static boolean matchParents(TreePath path,
Tree.Kind... kinds)
- Determines whether a tree has a particular set of direct parents,
ignoring blocks and parentheses.
For example, to test whether an expression (specified by path)
is immediately contained by an if statement which is immediately
contained in a method, one would invoke:
matchParents(path, Kind.IF, Kind.METHOD)
- Parameters:
path - the path to matchkinds - the tree kinds to match against, in ascending order starting
from the desired kind of the parent
- Returns:
- true if the tree path matches the desired kinds, skipping blocks
and parentheses, for as many kinds as specified