01: package org.kohsuke.rngom.nc;
02:
03: import javax.xml.namespace.QName;
04:
05: public final class NsNameClass extends NameClass {
06:
07: private final String namespaceUri;
08:
09: public NsNameClass(String namespaceUri) {
10: this .namespaceUri = namespaceUri;
11: }
12:
13: public boolean contains(QName name) {
14: return this .namespaceUri.equals(name.getNamespaceURI());
15: }
16:
17: public int containsSpecificity(QName 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 <V> V accept(NameClassVisitor<V> visitor) {
32: return visitor.visitNsName(namespaceUri);
33: }
34:
35: public boolean isOpen() {
36: return true;
37: }
38: }
|