Clover coverage report - PMD - 3.7 Coverage timestamp: Wed May 31 2006 09:25:59 EDT FRAMES NO FRAMES |

file stats: | LOC: | 132 |  | Methods: | 19
| NCLOC: | 101 |  | Classes: | 1

Source file | Conditionals | Statements | Methods | TOTAL
ASTFieldDeclaration.java | 66.7% | 75% | 94.7% | 76.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 | 383 | public ASTFieldDeclaration(JavaParser p, int id) {
12 | 383 | super(p, id);
13 |  | }
14 |  |
15 |  | /**
16 |  | * Accept the visitor. *
17 |  | */
18 | 884 | public Object jjtAccept(JavaParserVisitor visitor, Object data) {
19 | 884 | return visitor.visit(this, data);
20 |  | }
21 |  |
22 | 10 | public boolean isSyntacticallyPublic() {
23 | 10 | return super.isPublic();
24 |  | }
25 |  |
26 | 11 | public boolean isPublic() {
27 | 11 | if (isInterfaceMember()) {
28 | 1 | return true;
29 |  | }
30 | 10 | return super.isPublic();
31 |  | }
32 |  |
33 | 5 | public boolean isSyntacticallyStatic() {
34 | 5 | return super.isStatic();
35 |  | }
36 |  |
37 | 109 | public boolean isStatic() {
38 | 109 | if (isInterfaceMember()) {
39 | 19 | return true;
40 |  | }
41 | 90 | return super.isStatic();
42 |  | }
43 |  |
44 | 4 | public boolean isSyntacticallyFinal() {
45 | 4 | return super.isFinal();
46 |  | }
47 |  |
48 | 172 | public boolean isFinal() {
49 | 172 | if (isInterfaceMember()) {
50 | 19 | return true;
51 |  | }
52 | 153 | return super.isFinal();
53 |  | }
54 |  |
55 | 61 | public boolean isPrivate() {
56 | 61 | if (isInterfaceMember()) {
57 | 2 | return false;
58 |  | }
59 | 59 | 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 | 362 | public boolean isInterfaceMember() {
77 | 362 | ASTClassOrInterfaceDeclaration n = (ASTClassOrInterfaceDeclaration)getFirstParentOfType(ASTClassOrInterfaceDeclaration.class);
78 | 362 | return n instanceof ASTClassOrInterfaceDeclaration && n.isInterface();
79 |  | }
80 |  |
81 | 3 | public boolean isArray() {
82 | 3 | return checkType() + checkDecl() > 0;
83 |  | }
84 |  |
85 | 2 | public int getArrayDepth() {
86 | 2 | if (!isArray()) {
87 | 0 | return 0;
88 |  | }
89 | 2 | return checkType() + checkDecl();
90 |  | }
91 |  |
92 | 5 | private int checkType() {
93 | 5 | if (jjtGetNumChildren() == 0 || !(jjtGetChild(0) instanceof ASTType)) {
94 | 0 | return 0;
95 |  | }
96 | 5 | return ((ASTType) jjtGetChild(0)).getArrayDepth();
97 |  | }
98 |  |
99 | 5 | private int checkDecl() {
100 | 5 | if (jjtGetNumChildren() < 2 || !(jjtGetChild(1) instanceof ASTVariableDeclarator)) {
101 | 0 | return 0;
102 |  | }
103 | 5 | return ((ASTVariableDeclaratorId) (jjtGetChild(1).jjtGetChild(0))).getArrayDepth();
104 |  | }
105 |  |
106 | 0 | public void dump(String prefix) {
107 | 0 | String out = collectDumpedModifiers(prefix);
108 | 0 | if (isArray()) {
109 | 0 | out += "(array";
110 | 0 | for (int i = 0; i < getArrayDepth(); i++) {
111 | 0 | out += "[";
112 |  | }
113 | 0 | out += ")";
114 |  | }
115 | 0 | System.out.println(out);
116 | 0 | dumpChildren(prefix);
117 |  | }
118 |  |
119 |  | /**
120 |  | * Gets the variable name of this field.
121 |  | * This method searches the first VariableDeclartorId node and returns it's image or <code>null</code> if the child node is not found.
122 |  | *
123 |  | * @return a String representing the name of the variable
124 |  | */
125 | 9 | public String getVariableName() {
126 | 9 | ASTVariableDeclaratorId decl = (ASTVariableDeclaratorId) getFirstChildOfType(ASTVariableDeclaratorId.class);
127 | 9 | if (decl != null) {
128 | 9 | return decl.getImage();
129 |  | }
130 | 0 | return null;
131 |  | }
132 |  | }