View Javadoc

1   /**
2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3    */
4   package net.sourceforge.pmd.lang.plsql.dfa;
5   
6   import java.util.ArrayList;
7   import java.util.List;
8   
9   import net.sourceforge.pmd.lang.dfa.DFAGraphMethod;
10  import net.sourceforge.pmd.lang.dfa.DFAGraphRule;
11  import net.sourceforge.pmd.lang.plsql.ast.ASTInput;
12  import net.sourceforge.pmd.lang.plsql.ast.ASTProgramUnit;
13  import net.sourceforge.pmd.lang.plsql.ast.ASTTriggerTimingPointSection;
14  import net.sourceforge.pmd.lang.plsql.ast.ASTTriggerUnit;
15  import net.sourceforge.pmd.lang.plsql.ast.ASTTypeMethod;
16  import net.sourceforge.pmd.lang.plsql.rule.AbstractPLSQLRule;
17  
18  public class DFAPLSQLGraphRule extends AbstractPLSQLRule implements DFAGraphRule {
19  
20      private List<DFAGraphMethod> executables;
21  
22      public DFAPLSQLGraphRule() {
23  	super();
24  	super.setUsesDFA();
25      }
26  
27      public List<DFAGraphMethod> getMethods() {
28          return this.executables;
29      }
30  
31  
32      @Override
33      public Object visit(ASTTriggerUnit node, Object data) {
34  	executables.add(node);
35  	return super.visit(node, data);
36      }
37  
38      @Override
39      public Object visit(ASTProgramUnit node, Object data) {
40  	executables.add(node);
41  	return super.visit(node, data);
42      }
43     
44      @Override
45      public Object visit(ASTTypeMethod node, Object data) {
46  	executables.add(node);
47  	return super.visit(node, data);
48      }
49  
50     
51      @Override
52      public Object visit(ASTTriggerTimingPointSection node, Object data) {
53  	executables.add(node);
54  	return super.visit(node, data);
55      }
56  
57      @Override
58      public Object visit(ASTInput acu, Object data) {
59          executables = new ArrayList<DFAGraphMethod>();
60          return super.visit(acu, data);
61      }
62  }