View Javadoc

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