Class ASTPathCriterion

java.lang.Object
org.checkerframework.afu.annotator.find.ASTPathCriterion
All Implemented Interfaces:
Criterion

public class ASTPathCriterion extends Object implements Criterion
A criterion to determine if a node matches a path through the AST.
  • Field Details

    • debug

      public static boolean debug
  • Constructor Details

    • ASTPathCriterion

      public ASTPathCriterion(ASTPath astPath)
      Constructs a new ASTPathCriterion to match the given AST path.

      This assumes that the astPath is valid. Specifically, that all of its arguments have been previously validated.

      Parameters:
      astPath - the AST path to match
  • Method Details

    • isSatisfiedBy

      public boolean isSatisfiedBy(@Nullable TreePath path, @FindDistinct Tree leaf)
      Description copied from interface: Criterion
      Determines if the given tree path is satisfied by this criterion.
      Specified by:
      isSatisfiedBy in interface Criterion
      Parameters:
      path - the tree path to check against. May be null (in which case the result is false), for example in a call such as this.isSatisfiedBy(path.getParentPath()).
      Returns:
      true if this criterion is satisfied by the given path, false otherwise
    • isSatisfiedBy

      public boolean isSatisfiedBy(@Nullable TreePath path)
      Description copied from interface: Criterion
      Determines if the given tree path is satisfied by this criterion.
      Specified by:
      isSatisfiedBy in interface Criterion
      Parameters:
      path - the tree path to check against. May be null (in which case the result is false), for example in a call such as this.isSatisfiedBy(path.getParentPath()).
      Returns:
      true if this criterion is satisfied by the given path, false otherwise
    • isOnlyTypeAnnotationCriterion

      public boolean isOnlyTypeAnnotationCriterion()
      Description copied from interface: Criterion
      Returns true if this Criterion only permits type annotations, not declaration annotations.
      Specified by:
      isOnlyTypeAnnotationCriterion in interface Criterion
      Returns:
      true if this Criterion only permits type annotations, not declaration annotations
    • isBinaryOperator

      public boolean isBinaryOperator(Tree.Kind kind)
      Determines if the given kind is a binary operator.
      Parameters:
      kind - the kind to test
      Returns:
      true if the given kind is a binary operator
    • isExpression

      public boolean isExpression(Tree.Kind kind)
    • getKind

      public Criterion.Kind getKind()
      Description copied from interface: Criterion
      Gets the type of this criterion.
      Specified by:
      getKind in interface Criterion
      Returns:
      this criterion's kind
    • toString

      public String toString()
      Overrides:
      toString in class Object