Clover coverage report - PMD - 3.3
Coverage timestamp: Thu Sep 15 2005 17:59:57 EDT
file stats: LOC: 42   Methods: 5
NCLOC: 32   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
Search.java 64.3% 73.7% 100% 73.7%
coverage coverage
 1    /**
 2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
 3    */
 4    package net.sourceforge.pmd.symboltable;
 5   
 6    public class Search {
 7    private static final boolean TRACE = false;
 8   
 9    private NameOccurrence occ;
 10    private NameDeclaration decl;
 11   
 12  998 public Search(NameOccurrence occ) {
 13  0 if (TRACE) System.out.println("new search for " + occ);
 14  998 this.occ = occ;
 15    }
 16   
 17  874 public void execute() {
 18  874 decl = searchUpward(occ, occ.getLocation().getScope());
 19  0 if (TRACE) System.out.println("found " + decl);
 20    }
 21   
 22  124 public void execute(Scope startingScope) {
 23  124 decl = searchUpward(occ, startingScope);
 24  0 if (TRACE) System.out.println("found " + decl);
 25    }
 26   
 27  998 public NameDeclaration getResult() {
 28  998 return decl;
 29    }
 30   
 31  2900 private NameDeclaration searchUpward(NameOccurrence nameOccurrence, Scope scope) {
 32  2900 if (!scope.contains(nameOccurrence) && scope.getParent() != null) {
 33  0 if (TRACE) System.out.println("moving up fm " + scope + " to " + scope.getParent());
 34  1902 return searchUpward(nameOccurrence, scope.getParent());
 35    }
 36  998 if (scope.contains(nameOccurrence)) {
 37  0 if (TRACE) System.out.println("found it!");
 38  621 return scope.addVariableNameOccurrence(nameOccurrence);
 39    }
 40  377 return null;
 41    }
 42    }