001 package com.thaiopensource.xml.util;
002
003 public final class Name {
004 final private String namespaceUri;
005 final private String localName;
006 final private int hc;
007
008 public Name(String namespaceUri, String localName) {
009 this.namespaceUri = namespaceUri;
010 this.localName = localName;
011 this.hc = namespaceUri.hashCode() ^ localName.hashCode();
012 }
013
014 public String getNamespaceUri() {
015 return namespaceUri;
016 }
017
018 public String getLocalName() {
019 return localName;
020 }
021
022 public boolean equals(Object obj) {
023 if (!(obj instanceof Name))
024 return false;
025 Name other = (Name)obj;
026 return (this.hc == other.hc
027 && this.namespaceUri.equals(other.namespaceUri)
028 && this.localName.equals(other.localName));
029 }
030
031 public int hashCode() {
032 return hc;
033 }
034 }
035