Clover coverage report - PMD - 3.9 Coverage timestamp: Tue Dec 19 2006 09:38:44 EST FRAMES NO FRAMES |
file stats: | LOC: | 135 |  | Methods: | 19
| NCLOC: | 104 |  | Classes: | 1
Source file | Conditionals | Statements | Methods | TOTAL
ASTFieldDeclaration.java | 69.2% | 76% | 94.7% | 77.9% |

1 |  | /* Generated By:JJTree: Do not edit this line. ASTFieldDeclaration.java */
2 |  |
3 |  | package net.sourceforge.pmd.ast;
4 |  |
5 |  | public class ASTFieldDeclaration extends AccessNode implements Dimensionable {
6 |  |
7 | 1 | public ASTFieldDeclaration(int id) {
8 | 1 | super(id);
9 |  | }
10 |  |
11 | 463 | public ASTFieldDeclaration(JavaParser p, int id) {
12 | 463 | super(p, id);
13 |  | }
14 |  |
15 |  | /**
16 |  | * Accept the visitor. *
17 |  | */
18 | 1209 | public Object jjtAccept(JavaParserVisitor visitor, Object data) {
19 | 1209 | return visitor.visit(this, data);
20 |  | }
21 |  |
22 | 10 | public boolean isSyntacticallyPublic() {
23 | 10 | return super.isPublic();
24 |  | }
25 |  |
26 | 9 | public boolean isPublic() {
27 | 9 | if (isInterfaceMember()) {
28 | 1 | return true;
29 |  | }
30 | 8 | return super.isPublic();
31 |  | }
32 |  |
33 | 5 | public boolean isSyntacticallyStatic() {
34 | 5 | return super.isStatic();
35 |  | }
36 |  |
37 | 147 | public boolean isStatic() {
38 | 147 | if (isInterfaceMember()) {
39 | 19 | return true;
40 |  | }
41 | 128 | return super.isStatic();
42 |  | }
43 |  |
44 | 4 | public boolean isSyntacticallyFinal() {
45 | 4 | return super.isFinal();
46 |  | }
47 |  |
48 | 180 | public boolean isFinal() {
49 | 180 | if (isInterfaceMember()) {
50 | 19 | return true;
51 |  | }
52 | 161 | return super.isFinal();
53 |  | }
54 |  |
55 | 85 | public boolean isPrivate() {
56 | 85 | if (isInterfaceMember()) {
57 | 2 | return false;
58 |  | }
59 | 83 | return super.isPrivate();
60 |  | }
61 |  |
62 | 3 | public boolean isPackagePrivate() {
63 | 3 | if (isInterfaceMember()) {
64 | 1 | return false;
65 |  | }
66 | 2 | return super.isPackagePrivate();
67 |  | }
68 |  |
69 | 5 | public boolean isProtected() {
70 | 5 | if (isInterfaceMember()) {
71 | 1 | return false;
72 |  | }
73 | 4 | return super.isProtected();
74 |  | }
75 |  |
76 | 431 | public boolean isInterfaceMember() {
77 | 431 | if (jjtGetParent().jjtGetParent() instanceof ASTEnumBody) {
78 | 1 | return false;
79 |  | }
80 | 430 | ASTClassOrInterfaceDeclaration n = (ASTClassOrInterfaceDeclaration)getFirstParentOfType(ASTClassOrInterfaceDeclaration.class);
81 | 430 | return n instanceof ASTClassOrInterfaceDeclaration && n.isInterface();
82 |  | }
83 |  |
84 | 3 | public boolean isArray() {
85 | 3 | return checkType() + checkDecl() > 0;
86 |  | }
87 |  |
88 | 2 | public int getArrayDepth() {
89 | 2 | if (!isArray()) {
90 | 0 | return 0;
91 |  | }
92 | 2 | return checkType() + checkDecl();
93 |  | }
94 |  |
95 | 5 | private int checkType() {
96 | 5 | if (jjtGetNumChildren() == 0 || !(jjtGetChild(0) instanceof ASTType)) {
97 | 0 | return 0;
98 |  | }
99 | 5 | return ((ASTType) jjtGetChild(0)).getArrayDepth();
100 |  | }
101 |  |
102 | 5 | private int checkDecl() {
103 | 5 | if (jjtGetNumChildren() < 2 || !(jjtGetChild(1) instanceof ASTVariableDeclarator)) {
104 | 0 | return 0;
105 |  | }
106 | 5 | return ((ASTVariableDeclaratorId) (jjtGetChild(1).jjtGetChild(0))).getArrayDepth();
107 |  | }
108 |  |
109 | 0 | public void dump(String prefix) {
110 | 0 | String out = collectDumpedModifiers(prefix);
111 | 0 | if (isArray()) {
112 | 0 | out += "(array";
113 | 0 | for (int i = 0; i < getArrayDepth(); i++) {
114 | 0 | out += "[";
115 |  | }
116 | 0 | out += ")";
117 |  | }
118 | 0 | System.out.println(out);
119 | 0 | dumpChildren(prefix);
120 |  | }
121 |  |
122 |  | /**
123 |  | * Gets the variable name of this field.
124 |  | * This method searches the first VariableDeclartorId node and returns it's image or <code>null</code> if the child node is not found.
125 |  | *
126 |  | * @return a String representing the name of the variable
127 |  | */
128 | 18 | public String getVariableName() {
129 | 18 | ASTVariableDeclaratorId decl = (ASTVariableDeclaratorId) getFirstChildOfType(ASTVariableDeclaratorId.class);
130 | 18 | if (decl != null) {
131 | 18 | return decl.getImage();
132 |  | }
133 | 0 | return null;
134 |  | }
135 |  | }