01: package org.acm.seguin.pmd.symboltable;
02:
03: import org.acm.seguin.pmd.util.UnaryFunction;
04:
05: import java.util.HashSet;
06: import java.util.List;
07: import java.util.Set;
08:
09: public class ImageFinderFunction implements UnaryFunction {
10:
11: private Set images = new HashSet();
12: private NameDeclaration decl;
13:
14: public ImageFinderFunction(String img) {
15: images.add(img);
16: }
17:
18: public ImageFinderFunction(List imageList) {
19: images.addAll(imageList);
20: }
21:
22: public void applyTo(Object o) {
23: NameDeclaration nameDeclaration = (NameDeclaration) o;
24: if (images.contains(nameDeclaration.getImage())) {
25: decl = nameDeclaration;
26: }
27: }
28:
29: public NameDeclaration getDecl() {
30: return this.decl;
31: }
32: }
|