KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > pmd > ast > ASTImportDeclaration


1 /* Generated By:JJTree: Do not edit this line. ASTImportDeclaration.java */
2
3 package net.sourceforge.pmd.ast;
4
5 public class ASTImportDeclaration extends SimpleJavaNode {
6
7     private boolean isImportOnDemand;
8     private boolean isStatic;
9
10     public ASTImportDeclaration(int id) {
11         super(id);
12     }
13
14     public ASTImportDeclaration(JavaParser p, int id) {
15         super(p, id);
16     }
17
18     public void setImportOnDemand() {
19         isImportOnDemand = true;
20     }
21
22     public boolean isImportOnDemand() {
23         return isImportOnDemand;
24     }
25
26     public void setStatic() {
27         isStatic = true;
28     }
29
30     public boolean isStatic() {
31         return isStatic;
32     }
33
34     // TODO - this should go away
35
public ASTName getImportedNameNode() {
36         return (ASTName) jjtGetChild(0);
37     }
38
39     public String JavaDoc getImportedName() {
40         return ((ASTName) jjtGetChild(0)).getImage();
41     }
42
43     public String JavaDoc getPackageName() {
44         String JavaDoc importName = getImportedName();
45         if (isImportOnDemand) {
46             return importName;
47         }
48         if (importName.indexOf('.') == -1) {
49             return "";
50         }
51         int lastDot = importName.lastIndexOf('.');
52         return importName.substring(0, lastDot);
53     }
54
55
56     public void dump(String JavaDoc prefix) {
57         String JavaDoc out = "";
58         if (isStatic()) {
59             out += "(static)";
60         }
61         System.out.println(toString(prefix) + out);
62         dumpChildren(prefix);
63     }
64
65     /**
66      * Accept the visitor. *
67      */

68     public Object JavaDoc jjtAccept(JavaParserVisitor visitor, Object JavaDoc data) {
69         return visitor.visit(this, data);
70     }
71 }
72
Popular Tags