1 56 57 package org.jdom; 58 59 import java.util.*; 60 61 68 final class NamespaceKey { 69 70 private static final String CVS_ID = 71 "@(#) $RCSfile: NamespaceKey.java,v $ $Revision: 1.1 $ $Date: 2004/12/11 00:46:02 $ $Name: $"; 72 73 private String prefix; 74 private String uri; 75 private int hash; 76 77 public NamespaceKey(String prefix, String uri) { 78 this.prefix = prefix; 79 this.uri = uri; 80 this.hash = prefix.hashCode(); 81 } 82 83 public NamespaceKey(Namespace namespace) { 84 this(namespace.getPrefix(), namespace.getURI()); 85 } 86 87 public boolean equals(Object ob) { 88 if (this == ob) { 89 return true; 90 } 91 else if (ob instanceof NamespaceKey) { 92 NamespaceKey other = (NamespaceKey) ob; 93 return prefix.equals(other.prefix) && uri.equals(other.uri); 94 } 95 else { 96 return false; 97 } 98 } 99 100 public int hashCode() { 101 return hash; 102 } 103 104 public String toString() { 105 return "[NamespaceKey: prefix \"" + prefix + 106 "\" is mapped to URI \"" + uri + "\"]"; 107 } 108 } 109 | Popular Tags |