Clover coverage report - PMD - 3.9 Coverage timestamp: Tue Dec 19 2006 09:38:44 EST FRAMES NO FRAMES |
file stats: | LOC: | 85 |  | Methods: | 13
| NCLOC: | 62 |  | Classes: | 1
Source file | Conditionals | Statements | Methods | TOTAL
ASTVariableDeclaratorId.java | 70% | 80.8% | 92.3% | 81.6% |

1 |  | /* Generated By:JJTree: Do not edit this line. ASTVariableDeclaratorId.java */
2 |  |
3 |  | package net.sourceforge.pmd.ast;
4 |  |
5 |  | import net.sourceforge.pmd.symboltable.VariableNameDeclaration;
6 |  |
7 |  | import java.util.List;
8 |  |
9 |  | public class ASTVariableDeclaratorId extends SimpleJavaNode {
10 |  |
11 | 8 | public ASTVariableDeclaratorId(int id) {
12 | 8 | super(id);
13 |  | }
14 |  |
15 | 1506 | public ASTVariableDeclaratorId(JavaParser p, int id) {
16 | 1506 | super(p, id);
17 |  | }
18 |  |
19 |  | /**
20 |  | * Accept the visitor. *
21 |  | */
22 | 4040 | public Object jjtAccept(JavaParserVisitor visitor, Object data) {
23 | 4040 | return visitor.visit(this, data);
24 |  | }
25 |  |
26 |  | private int arrayDepth;
27 |  | private VariableNameDeclaration nameDeclaration;
28 |  |
29 | 150 | public VariableNameDeclaration getNameDeclaration() {
30 | 150 | return nameDeclaration;
31 |  | }
32 |  |
33 | 1452 | public void setNameDeclaration(VariableNameDeclaration decl) {
34 | 1452 | nameDeclaration = decl;
35 |  | }
36 |  |
37 | 127 | public List getUsages() {
38 | 127 | return (List) getScope().getVariableDeclarations().get(nameDeclaration);
39 |  | }
40 |  |
41 | 31 | public void bumpArrayDepth() {
42 | 31 | arrayDepth++;
43 |  | }
44 |  |
45 | 78 | public int getArrayDepth() {
46 | 78 | return arrayDepth;
47 |  | }
48 |  |
49 | 0 | public boolean isArray() {
50 | 0 | return arrayDepth > 0;
51 |  | }
52 |  |
53 | 2 | public boolean isExceptionBlockParameter() {
54 | 2 | return jjtGetParent().jjtGetParent() instanceof ASTTryStatement;
55 |  | }
56 |  |
57 | 117 | public SimpleNode getTypeNameNode() {
58 | 117 | if (jjtGetParent() instanceof ASTFormalParameter) {
59 | 20 | return findTypeNameNode(jjtGetParent());
60 | 97 | } else if (jjtGetParent().jjtGetParent() instanceof ASTLocalVariableDeclaration || jjtGetParent().jjtGetParent() instanceof ASTFieldDeclaration) {
61 | 97 | return findTypeNameNode(jjtGetParent().jjtGetParent());
62 |  | }
63 | 0 | throw new RuntimeException("Don't know how to get the type for anything other than ASTLocalVariableDeclaration/ASTFormalParameter/ASTFieldDeclaration");
64 |  | }
65 |  |
66 | 51 | public ASTType getTypeNode() {
67 | 51 | if (jjtGetParent() instanceof ASTFormalParameter) {
68 | 15 | return ((ASTFormalParameter) jjtGetParent()).getTypeNode();
69 | 36 | } else if (jjtGetParent().jjtGetParent() instanceof ASTLocalVariableDeclaration || jjtGetParent().jjtGetParent() instanceof ASTFieldDeclaration) {
70 | 36 | SimpleNode n = (SimpleNode) jjtGetParent().jjtGetParent();
71 | 36 | return (ASTType) n.getFirstChildOfType(ASTType.class);
72 |  | }
73 | 0 | throw new RuntimeException("Don't know how to get the type for anything other than ASTLocalVariableDeclaration/ASTFormalParameter/ASTFieldDeclaration");
74 |  | }
75 |  |
76 | 117 | private SimpleNode findTypeNameNode(Node node) {
77 | 117 | if (node.jjtGetChild(0) instanceof ASTAnnotation) {
78 | 0 | ASTType typeNode = (ASTType) node.jjtGetChild(1);
79 | 0 | return (SimpleNode) typeNode.jjtGetChild(0);
80 |  | }
81 | 117 | ASTType typeNode = (ASTType) node.jjtGetChild(0);
82 | 117 | return (SimpleNode) typeNode.jjtGetChild(0);
83 |  | }
84 |  |
85 |  | }