package com.thaiopensource.xml.util;

public final class Name {
  final private String namespaceUri;
  final private String localName;
  final private int hc;
  
  public Name(String namespaceUri, String localName) {
    this.namespaceUri = namespaceUri;
    this.localName = localName;
    this.hc = namespaceUri.hashCode() ^ localName.hashCode();
  }

  public String getNamespaceUri() {
    return namespaceUri;
  }

  public String getLocalName() {
    return localName;
  }

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

  public int hashCode() {
    return hc;
  }
}


@@ -774,12 +774,302 @@
  hc;%0A  %7D
+%0A%0A  // We include this, but don't derive from Comparator%3CName%3E to avoid a dependency on Java 5.%0A  static public int compare(Name n1, Name n2) %7B%0A    int ret = n1.namespaceUri.compareTo(n2.namespaceUri);%0A    if (ret != 0)%0A      return ret;%0A    return n1.localName.compareTo(n2.localName);%0A  %7D
 %0A%7D%0A%0A

Add compare method from com.thaiopensource.relaxng.output.common.