KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thaiopensource > xml > util > Name


1 package com.thaiopensource.xml.util;
2
3 public final class Name {
4   final private String JavaDoc namespaceUri;
5   final private String JavaDoc localName;
6   final private int hc;
7   
8   public Name(String JavaDoc namespaceUri, String JavaDoc localName) {
9     this.namespaceUri = namespaceUri;
10     this.localName = localName;
11     this.hc = namespaceUri.hashCode() ^ localName.hashCode();
12   }
13
14   public String JavaDoc getNamespaceUri() {
15     return namespaceUri;
16   }
17
18   public String JavaDoc getLocalName() {
19     return localName;
20   }
21
22   public boolean equals(Object JavaDoc obj) {
23     if (!(obj instanceof Name))
24       return false;
25     Name other = (Name)obj;
26     return (this.hc == other.hc
27         && this.namespaceUri.equals(other.namespaceUri)
28         && this.localName.equals(other.localName));
29   }
30
31   public int hashCode() {
32     return hc;
33   }
34 }
35
36
Popular Tags