View Javadoc
1   /**
2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3    */
4   /* Generated By:JJTree: Do not edit this line. ASTCompilationUnit.java */
5   
6   package net.sourceforge.pmd.lang.java.ast;
7   
8   import java.util.List;
9   
10  import net.sourceforge.pmd.lang.ast.Node;
11  import net.sourceforge.pmd.lang.ast.RootNode;
12  import net.sourceforge.pmd.lang.java.typeresolution.ClassTypeResolver;
13  
14  // FUTURE Change this class to extend from SimpleJavaNode, as TypeNode is not appropriate (unless I'm wrong)
15  public class ASTCompilationUnit extends AbstractJavaTypeNode implements RootNode {
16  
17      private ClassTypeResolver classTypeResolver;
18  
19      public ASTCompilationUnit(int id) {
20          super(id);
21      }
22  
23      public ASTCompilationUnit(JavaParser p, int id) {
24          super(p, id);
25      }
26  
27      private List<Comment> comments;
28  
29      public List<Comment> getComments() {
30          return comments;
31      }
32  
33      public void setComments(List<Comment> comments) {
34          this.comments = comments;
35      }
36  
37      /**
38       * Accept the visitor. *
39       */
40      @Override
41      public Object jjtAccept(JavaParserVisitor visitor, Object data) {
42          return visitor.visit(this, data);
43      }
44  
45      public boolean declarationsAreInDefaultPackage() {
46          return getPackageDeclaration() == null;
47      }
48  
49      public ASTPackageDeclaration getPackageDeclaration() {
50          if (jjtGetNumChildren() > 0) {
51              Node n = jjtGetChild(0);
52              return n instanceof ASTPackageDeclaration ? (ASTPackageDeclaration) n : null;
53          }
54          return null;
55      }
56  
57      public ClassTypeResolver getClassTypeResolver() {
58          return classTypeResolver;
59      }
60  
61      public void setClassTypeResolver(ClassTypeResolver classTypeResolver) {
62          this.classTypeResolver = classTypeResolver;
63      }
64  }