01: /**
02: * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
03: */package net.sourceforge.pmd.symboltable;
04:
05: import net.sourceforge.pmd.util.UnaryFunction;
06:
07: import java.util.HashSet;
08: import java.util.List;
09: import java.util.Set;
10:
11: public class ImageFinderFunction implements
12: UnaryFunction<NameDeclaration> {
13:
14: private Set<String> images = new HashSet<String>();
15: private NameDeclaration decl;
16:
17: public ImageFinderFunction(String img) {
18: images.add(img);
19: }
20:
21: public ImageFinderFunction(List<String> imageList) {
22: images.addAll(imageList);
23: }
24:
25: public void applyTo(NameDeclaration nameDeclaration) {
26: if (images.contains(nameDeclaration.getImage())) {
27: decl = nameDeclaration;
28: }
29: }
30:
31: public NameDeclaration getDecl() {
32: return this.decl;
33: }
34: }
|