01: package org.objectweb.celtix.helpers;
02:
03: public final class NSDecl {
04: private final String prefix;
05: private final String uri;
06: private final int hashCode;
07:
08: public NSDecl(String pfx, String ur) {
09: if (pfx == null) {
10: this .prefix = "".intern();
11: } else {
12: this .prefix = pfx.intern();
13: }
14: this .uri = ur.intern();
15: this .hashCode = (toString()).hashCode();
16: }
17:
18: public String getPrefix() {
19: return prefix;
20: }
21:
22: public String getUri() {
23: return uri;
24: }
25:
26: public String toString() {
27: return prefix + ":" + uri;
28: }
29:
30: public int hashCode() {
31: return hashCode;
32: }
33:
34: public boolean equals(Object obj) {
35: return obj != null && uri == ((NSDecl) obj).uri
36: && prefix == ((NSDecl) obj).prefix;
37: }
38:
39: }
|