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

file stats: | LOC: | 58 |  | Methods: | 8
| NCLOC: | 40 |  | Classes: | 1

Source file | Conditionals | Statements | Methods | TOTAL

VariableAccess.java

87.5%

82.4%

75%

81.8%

1 |  | /*
2 |  | * Created on 14.07.2004
3 |  | */
4 |  | package net.sourceforge.pmd.dfa.variableaccess;
5 |  |
6 |  | /**
7 |  | * @author raik
8 |  | */
9 |  | public class VariableAccess {
10 |  |
11 |  | public static final int DEFINITION = 0;
12 |  | public static final int REFERENCING = 1;
13 |  | public static final int UNDEFINITION = 2;
14 |  |
15 |  | private int accessType;
16 |  | private String variableName;
17 |  |
18 | 194 | public VariableAccess(int accessType, String varName) {
19 | 194 | this.accessType = accessType;
20 | 194 | if (varName.indexOf(".") == -1) {
21 | 191 | this.variableName = varName;
22 |  | } else {
23 | 3 | this.variableName = varName.substring(0, varName.indexOf("."));
24 |  | }
25 |  | }
26 |  |
27 |  | // TODO completely encapsulate this somehow?
28 | 0 | public int getAccessType() {
29 | 0 | return accessType;
30 |  | }
31 |  |
32 | 0 | public boolean accessTypeMatches(int otherType) {
33 | 0 | return accessType == otherType;
34 |  | }
35 |  |
36 | 5 | public boolean isDefinition() {
37 | 5 | return this.accessType == DEFINITION;
38 |  | }
39 |  |
40 | 3 | public boolean isReference() {
41 | 3 | return this.accessType == REFERENCING;
42 |  | }
43 |  |
44 | 2 | public boolean isUndefinition() {
45 | 2 | return this.accessType == UNDEFINITION;
46 |  | }
47 |  |
48 | 4 | public String getVariableName() {
49 | 4 | return variableName;
50 |  | }
51 |  |
52 | 5 | public String toString() {
53 | 2 | if (isDefinition()) return "Definition(" + variableName + ")";
54 | 1 | if (isReference()) return "Reference(" + variableName + ")";
55 | 2 | if (isUndefinition()) return "Undefinition(" + variableName + ")";
56 | 0 | throw new RuntimeException("Access type was never set");
57 |  | }
58 |  | }