View Javadoc
1   /**
2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3    */
4   package net.sourceforge.pmd.lang.plsql.symboltable;
5   
6   import java.util.HashSet;
7   import java.util.List;
8   import java.util.Set;
9   
10  import net.sourceforge.pmd.lang.symboltable.NameDeclaration;
11  import net.sourceforge.pmd.util.UnaryFunction;
12  
13  public class ImageFinderFunction implements UnaryFunction<NameDeclaration> {
14  
15      private Set<String> images = new HashSet<>();
16      private NameDeclaration decl;
17  
18      public ImageFinderFunction(String img) {
19          images.add(img);
20      }
21  
22      public ImageFinderFunction(List<String> imageList) {
23          images.addAll(imageList);
24      }
25  
26      public void applyTo(NameDeclaration nameDeclaration) {
27          if (images.contains(nameDeclaration.getImage())) {
28              decl = nameDeclaration;
29          }
30      }
31  
32      public NameDeclaration getDecl() {
33          return this.decl;
34      }
35  }