Clover coverage report - PMD - 3.9 Coverage timestamp: Tue Dec 19 2006 09:38:44 EST FRAMES NO FRAMES |
file stats: | LOC: | 41 |  | Methods: | 2
| NCLOC: | 25 |  | Classes: | 1
Source file | Conditionals | Statements | Methods | TOTAL
AbstractOptimizationRule.java | 83.3% | 88.9% | 100% | 88.2% |

1 |  | /*
2 |  | * Created on Jan 11, 2005
3 |  | *
4 |  | * $Id: AbstractOptimizationRule.java,v 1.14 2006/11/30 02:29:13 xlv Exp $
5 |  | */
6 |  | package net.sourceforge.pmd.rules.optimization;
7 |  |
8 |  | import java.util.Iterator;
9 |  | import java.util.List;
10 |  |
11 |  | import net.sourceforge.pmd.AbstractRule;
12 |  | import net.sourceforge.pmd.Rule;
13 |  | import net.sourceforge.pmd.ast.ASTClassOrInterfaceDeclaration;
14 |  | import net.sourceforge.pmd.symboltable.NameOccurrence;
15 |  |
16 |  | /**
17 |  | * Base class with utility methods for optimization rules
18 |  | *
19 |  | * @author mgriffa
20 |  | */
21 |  | public class AbstractOptimizationRule extends AbstractRule implements Rule {
22 |  |
23 | 27 | public Object visit(ASTClassOrInterfaceDeclaration node, Object data) {
24 | 27 | if (node.isInterface()) {
25 | 0 | return data;
26 |  | }
27 | 27 | return super.visit(node, data);
28 |  | }
29 |  |
30 | 21 | protected boolean assigned(List usages) {
31 | 21 | for (Iterator j = usages.iterator(); j.hasNext();) {
32 | 17 | NameOccurrence occ = (NameOccurrence) j.next();
33 | 17 | if (occ.isOnLeftHandSide() || occ.isSelfAssignment()) {
34 | 10 | return true;
35 |  | }
36 | 7 | continue;
37 |  | }
38 | 11 | return false;
39 |  | }
40 |  |
41 |  | }