01: /**
02: * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
03: */package net.sourceforge.pmd.symboltable;
04:
05: import java.util.HashMap;
06: import java.util.List;
07: import java.util.Map;
08:
09: import net.sourceforge.pmd.util.UnaryFunction;
10:
11: public class VariableUsageFinderFunction implements
12: UnaryFunction<VariableNameDeclaration> {
13:
14: private Map<VariableNameDeclaration, List<NameOccurrence>> results = new HashMap<VariableNameDeclaration, List<NameOccurrence>>();
15:
16: private Map<VariableNameDeclaration, List<NameOccurrence>> decls;
17:
18: public VariableUsageFinderFunction(
19: Map<VariableNameDeclaration, List<NameOccurrence>> decls) {
20: this .decls = decls;
21: }
22:
23: public void applyTo(VariableNameDeclaration o) {
24: results.put(o, decls.get(o));
25: }
26:
27: public Map<VariableNameDeclaration, List<NameOccurrence>> getUsed() {
28: return results;
29: }
30: }
|