View Javadoc

    1   package net.sourceforge.pmd.util.designer;
    2
    3   import net.sourceforge.pmd.AbstractRule;
    4   import net.sourceforge.pmd.ast.ASTCompilationUnit;
    5   import net.sourceforge.pmd.ast.ASTMethodDeclaration;
    6
    7   import java.util.List;
    8
    9   public class DFAGraphRule extends AbstractRule {
    10
    11      private List<ASTMethodDeclaration> methods;
    12      private List<ASTMethodDeclaration> constructors;
    13
    14      public DFAGraphRule() {
    15          super.setUsesDFA();
    16      }
    17
    18      public List<ASTMethodDeclaration> getMethods() {
    19          return this.methods;
    20      }
    21
    22      public List<ASTMethodDeclaration> getConstructors() {
    23          return this.constructors;
    24      }
    25
    26      public Object visit(ASTCompilationUnit acu, Object data) {
    27          methods = acu.findChildrenOfType(ASTMethodDeclaration.class);
    28          constructors = acu.findChildrenOfType(ASTMethodDeclaration.class);
    29          return data;
    30      }
    31  }
    32
    33