View Javadoc

1   /**
2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3    */
4   package net.sourceforge.pmd.rules;
5   
6   import net.sourceforge.pmd.ast.SimpleNode;
7   
8   public class ImportWrapper {
9       private SimpleNode node;
10      private String name;
11      private String fullname;
12  
13      public ImportWrapper(String fullname, String name, SimpleNode node) {
14          this.fullname = fullname;
15          this.name = name;
16          this.node = node;
17      }
18  
19  
20      public boolean equals(Object other) {
21          ImportWrapper i = (ImportWrapper) other;
22          if(name == null && i.getName() == null){
23              return i.getFullName().equals(fullname);
24          }
25          return i.getName().equals(name);
26      }
27  
28      public int hashCode() {
29          if(name == null){
30              return fullname.hashCode();
31          }
32          return name.hashCode();
33      }
34  
35      public String getName() {
36          return name;
37      }
38  
39      public String getFullName() {
40          return fullname;
41      }
42  
43      public SimpleNode getNode() {
44          return node;
45      }
46  }
47