Clover coverage report - PMD - 3.9 Coverage timestamp: Tue Dec 19 2006 09:38:44 EST FRAMES NO FRAMES |
file stats: | LOC: | 72 |  | Methods: | 14
| NCLOC: | 53 |  | Classes: | 1
Source file | Conditionals | Statements | Methods | TOTAL
SourceFileScope.java | - | 56.2% | 50% | 53.3% |

1 |  | package net.sourceforge.pmd.symboltable;
2 |  |
3 |  | import net.sourceforge.pmd.util.Applier;
4 |  |
5 |  | import java.util.ArrayList;
6 |  | import java.util.HashMap;
7 |  | import java.util.Map;
8 |  |
9 |  | public class SourceFileScope extends AbstractScope implements Scope {
10 |  |
11 |  | protected Map classNames = new HashMap();
12 |  | private String packageImage;
13 |  |
14 | 1338 | public SourceFileScope() {
15 | 1338 | this("");
16 |  | }
17 |  |
18 | 25063 | public SourceFileScope(String image) {
19 | 25063 | this.packageImage = image;
20 |  | }
21 |  |
22 | 0 | public ClassScope getEnclosingClassScope() {
23 | 0 | throw new RuntimeException("getEnclosingClassScope() called on SourceFileScope");
24 |  | }
25 |  |
26 | 0 | public MethodScope getEnclosingMethodScope() {
27 | 0 | throw new RuntimeException("getEnclosingMethodScope() called on SourceFileScope");
28 |  | }
29 |  |
30 | 5805 | public String getPackageName() {
31 | 5805 | return packageImage;
32 |  | }
33 |  |
34 | 5769 | public SourceFileScope getEnclosingSourceFileScope() {
35 | 5769 | return this;
36 |  | }
37 |  |
38 | 1312 | public void addDeclaration(ClassNameDeclaration classDecl) {
39 | 1312 | classNames.put(classDecl, new ArrayList());
40 |  | }
41 |  |
42 | 0 | public void addDeclaration(MethodNameDeclaration decl) {
43 | 0 | throw new RuntimeException("SourceFileScope.addDeclaration(MethodNameDeclaration decl) called");
44 |  | }
45 |  |
46 | 0 | public void addDeclaration(VariableNameDeclaration decl) {
47 | 0 | throw new RuntimeException("SourceFileScope.addDeclaration(VariableNameDeclaration decl) called");
48 |  | }
49 |  |
50 | 3 | public Map getClassDeclarations() {
51 | 3 | return classNames;
52 |  | }
53 |  |
54 | 0 | public Map getVariableDeclarations() {
55 | 0 | throw new RuntimeException("PackageScope.getVariableDeclarations() called");
56 |  | }
57 |  |
58 | 0 | public NameDeclaration addVariableNameOccurrence(NameOccurrence occ) {
59 | 0 | return null;
60 |  | }
61 |  |
62 | 0 | public String toString() {
63 | 0 | return "SourceFileScope: " + glomNames(classNames.keySet().iterator());
64 |  | }
65 |  |
66 | 2024 | protected NameDeclaration findVariableHere(NameOccurrence occ) {
67 | 2024 | ImageFinderFunction finder = new ImageFinderFunction(occ.getImage());
68 | 2024 | Applier.apply(finder, classNames.keySet().iterator());
69 | 2024 | return finder.getDecl();
70 |  | }
71 |  |
72 |  | }