1 package com.thaiopensource.xml.util; 2 3 public final class Name { 4 final private String namespaceUri; 5 final private String localName; 6 final private int hc; 7 8 public Name(String namespaceUri, String localName) { 9 this.namespaceUri = namespaceUri; 10 this.localName = localName; 11 this.hc = namespaceUri.hashCode() ^ localName.hashCode(); 12 } 13 14 public String getNamespaceUri() { 15 return namespaceUri; 16 } 17 18 public String getLocalName() { 19 return localName; 20 } 21 22 public boolean equals(Object 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 |