Clover coverage report - PMD - 3.7 Coverage timestamp: Wed May 31 2006 09:25:59 EDT 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 | 1288 | public ASTVariableDeclaratorId(JavaParser p, int id) {
16 | 1288 | super(p, id);
17 |  | }
18 |  |
19 |  | /**
20 |  | * Accept the visitor. *
21 |  | */
22 | 3120 | public Object jjtAccept(JavaParserVisitor visitor, Object data) {
23 | 3120 | return visitor.visit(this, data);
24 |  | }
25 |  |
26 |  | private int arrayDepth;
27 |  | private VariableNameDeclaration nameDeclaration;
28 |  |
29 | 138 | public VariableNameDeclaration getNameDeclaration() {
30 | 138 | return nameDeclaration;
31 |  | }
32 |  |
33 | 1236 | public void setNameDeclaration(VariableNameDeclaration decl) {
34 | 1236 | nameDeclaration = decl;
35 |  | }
36 |  |
37 | 89 | public List getUsages() {
38 | 89 | return (List) getScope().getVariableDeclarations().get(nameDeclaration);
39 |  | }
40 |  |
41 | 18 | public void bumpArrayDepth() {
42 | 18 | arrayDepth++;
43 |  | }
44 |  |
45 | 55 | public int getArrayDepth() {
46 | 55 | 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 | 93 | public SimpleNode getTypeNameNode() {
58 | 93 | if (jjtGetParent() instanceof ASTFormalParameter) {
59 | 6 | return findTypeNameNode(jjtGetParent());
60 | 87 | } else if (jjtGetParent().jjtGetParent() instanceof ASTLocalVariableDeclaration || jjtGetParent().jjtGetParent() instanceof ASTFieldDeclaration) {
61 | 87 | 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 | 45 | public ASTType getTypeNode() {
67 | 45 | if (jjtGetParent() instanceof ASTFormalParameter) {
68 | 10 | return (ASTType) jjtGetParent().jjtGetChild(0);
69 | 35 | } else if (jjtGetParent().jjtGetParent() instanceof ASTLocalVariableDeclaration || jjtGetParent().jjtGetParent() instanceof ASTFieldDeclaration) {
70 | 35 | SimpleNode n = (SimpleNode) jjtGetParent().jjtGetParent();
71 | 35 | 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 | 93 | private SimpleNode findTypeNameNode(Node node) {
77 | 93 | if (node.jjtGetChild(0) instanceof ASTAnnotation) {
78 | 0 | ASTType typeNode = (ASTType) node.jjtGetChild(1);
79 | 0 | return (SimpleNode) typeNode.jjtGetChild(0);
80 |  | }
81 | 93 | ASTType typeNode = (ASTType) node.jjtGetChild(0);
82 | 93 | return (SimpleNode) typeNode.jjtGetChild(0);
83 |  | }
84 |  |
85 |  | }