1 19 20 package org.openide.src; 21 22 26 public class Import extends Object implements java.io.Serializable { 27 28 public static final boolean PACKAGE = true; 29 30 public static final boolean CLASS = false; 31 32 35 private boolean wholePackage; 36 37 38 private Identifier id; 39 40 static final long serialVersionUID =-4111760314345461897L; 41 42 46 public Import(Identifier id, boolean wholePackage) { 47 this.wholePackage = wholePackage; 48 this.id = id; 49 } 50 51 54 public boolean isPackage() { 55 return wholePackage; 56 } 57 58 61 public boolean isClass() { 62 return (!wholePackage); 63 } 64 65 68 public Identifier getIdentifier() { 69 return id; 70 } 71 72 75 public String toString() { 76 StringBuffer buf = new StringBuffer ("import "); buf.append(id.getFullName()); 78 if (wholePackage) 79 buf.append(".*"); return buf.toString(); 81 } 82 83 84 public int hashCode() { 85 return id.getFullName().hashCode(); 86 } 87 88 90 public boolean equals(Object o) { 91 if (o instanceof Import) { 92 Import imp = (Import) o; 93 return (wholePackage == imp.wholePackage) && (id.equals(imp.id)); 94 } 95 return false; 96 } 97 } 98 | Popular Tags |