package com.thaiopensource.relaxng.output.common;

final public class Name {
  private final String namespaceUri;
  private final String localName;

  public Name(String namespaceUri, String localName) {
    this.namespaceUri = namespaceUri;
    this.localName = localName;
  }

  public String getNamespaceUri() {
    return namespaceUri;
  }

  public String getLocalName() {
    return localName;
  }

  public int hashCode() {
    return namespaceUri.hashCode() ^ localName.hashCode();
  }

  public boolean equals(Object obj) {
    if (!(obj instanceof Name))
      return false;
    Name other = (Name)obj;
    return this.namespaceUri.equals(other.namespaceUri) && this.localName.equals(other.localName);
  }

  // We include this, but don't derive from Comparator<Name> to avoid a dependency on Java 5.
  static public int compare(Name n1, Name n2) {
    int ret = n1.namespaceUri.compareTo(n2.namespaceUri);
    if (ret != 0)
      return ret;
    return n1.localName.compareTo(n2.localName);
  }
}

@@ -72,24 +72,30 @@
 ame %7B%0A  
+final 
 private 
 final St
@@ -82,30 +82,24 @@
 nal private 
-final 
 String names
@@ -109,24 +109,30 @@
 eUri;%0A  
+final 
 private 
 final St
@@ -123,22 +123,16 @@
 private 
-final 
 String l
@@ -140,16 +140,40 @@
 calName;
+%0A  final private int hc;
 %0A%0A  publ
@@ -283,32 +283,94 @@
 me = localName;%0A
+    this.hc = namespaceUri.hashCode() %5E localName.hashCode();%0A
   %7D%0A%0A  public St
@@ -488,98 +488,8 @@
  %7D%0A%0A
-  public int hashCode() %7B%0A    return namespaceUri.hashCode() %5E localName.hashCode();%0A  %7D%0A%0A
   pu
@@ -612,16 +612,45 @@
   return
+ (this.hc == other.hc%0A%09    &&
  this.na
@@ -686,16 +686,21 @@
 paceUri)
+%0A%09   
  && this
@@ -733,23 +733,71 @@
 calName)
+)
 ;%0A  %7D%0A%0A
+  public int hashCode() %7B%0A    return hc;%0A  %7D %0A%0A
   // We 

Cache the hash code as with com.thaiopensource.xml.util.Name.