public class Heuristics
extends java.lang.Object
For an example, see org.checkerframework.checker.interning.InterningVisitor
.
Modifier and Type | Class and Description |
---|---|
static class |
Heuristics.Matcher
A convenience class for tree-matching algorithms.
|
static class |
Heuristics.Matchers |
static class |
Heuristics.OfKind |
static class |
Heuristics.OrMatcher |
static class |
Heuristics.PreceededBy |
static class |
Heuristics.WithIn |
static class |
Heuristics.WithinTrueBranch |
Constructor and Description |
---|
Heuristics() |
Modifier and Type | Method and Description |
---|---|
static boolean |
matchParents(com.sun.source.util.TreePath path,
com.sun.source.tree.Tree.Kind... kinds)
Determines whether a tree has a particular set of direct parents, ignoring blocks and
parentheses.
|
public static boolean matchParents(com.sun.source.util.TreePath path, com.sun.source.tree.Tree.Kind... kinds)
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)
path
- the path to matchkinds
- the tree kinds to match against, in ascending order starting from the desired
kind of the parent