1 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 21 public class AbstractOptimizationRule extends AbstractRule implements Rule { 22 23 public Object visit(ASTClassOrInterfaceDeclaration node, Object data) { 24 if (node.isInterface()) { 25 return data; 26 } 27 return super.visit(node, data); 28 } 29 30 protected boolean assigned(List usages) { 31 for (Iterator j = usages.iterator(); j.hasNext();) { 32 NameOccurrence occ = (NameOccurrence) j.next(); 33 if (occ.isOnLeftHandSide() || occ.isSelfAssignment()) { 34 return true; 35 } 36 continue; 37 } 38 return false; 39 } 40 41 } 42 | Popular Tags |