KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > pmd > symboltable > ImageFinderFunction


1 /**
2  * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3  */

4 package net.sourceforge.pmd.symboltable;
5
6 import net.sourceforge.pmd.util.UnaryFunction;
7
8 import java.util.HashSet JavaDoc;
9 import java.util.List JavaDoc;
10 import java.util.Set JavaDoc;
11
12 public class ImageFinderFunction implements UnaryFunction {
13
14     private Set JavaDoc images = new HashSet JavaDoc();
15     private NameDeclaration decl;
16
17     public ImageFinderFunction(String JavaDoc img) {
18         images.add(img);
19     }
20
21     public ImageFinderFunction(List JavaDoc imageList) {
22         images.addAll(imageList);
23     }
24
25     public void applyTo(Object JavaDoc o) {
26         NameDeclaration nameDeclaration = (NameDeclaration) o;
27         if (images.contains(nameDeclaration.getImage())) {
28             decl = nameDeclaration;
29         }
30     }
31
32     public NameDeclaration getDecl() {
33         return this.decl;
34     }
35 }
36
Popular Tags