1 package com.thaiopensource.relaxng.impl; 2 3 import com.thaiopensource.xml.util.Name; 4 5 class NsNameClass implements NameClass { 6 7 private final String namespaceUri; 8 9 NsNameClass(String namespaceUri) { 10 this.namespaceUri = namespaceUri; 11 } 12 13 public boolean contains(Name name) { 14 return this.namespaceUri.equals(name.getNamespaceUri()); 15 } 16 17 public int containsSpecificity(Name name) { 18 return contains(name) ? SPECIFICITY_NS_NAME : SPECIFICITY_NONE; 19 } 20 21 public int hashCode() { 22 return namespaceUri.hashCode(); 23 } 24 25 public boolean equals(Object obj) { 26 if (obj == null || !(obj instanceof NsNameClass)) 27 return false; 28 return namespaceUri.equals(((NsNameClass)obj).namespaceUri); 29 } 30 31 public void accept(NameClassVisitor visitor) { 32 visitor.visitNsName(namespaceUri); 33 } 34 35 public boolean isOpen() { 36 return true; 37 } 38 } 39 | Popular Tags |