01: package org.kohsuke.rngom.nc;
02:
03: import javax.xml.namespace.QName;
04:
05: public class NsNameExceptNameClass extends NameClass {
06:
07: private final NameClass nameClass;
08: private final String namespaceURI;
09:
10: public NsNameExceptNameClass(String namespaceURI,
11: NameClass nameClass) {
12: this .namespaceURI = namespaceURI;
13: this .nameClass = nameClass;
14: }
15:
16: public boolean contains(QName name) {
17: return (this .namespaceURI.equals(name.getNamespaceURI()) && !nameClass
18: .contains(name));
19: }
20:
21: public int containsSpecificity(QName name) {
22: return contains(name) ? SPECIFICITY_NS_NAME : SPECIFICITY_NONE;
23: }
24:
25: public boolean equals(Object obj) {
26: if (obj == null || !(obj instanceof NsNameExceptNameClass))
27: return false;
28: NsNameExceptNameClass other = (NsNameExceptNameClass) obj;
29: return (namespaceURI.equals(other.namespaceURI) && nameClass
30: .equals(other.nameClass));
31: }
32:
33: public int hashCode() {
34: return namespaceURI.hashCode() ^ nameClass.hashCode();
35: }
36:
37: public <V> V accept(NameClassVisitor<V> visitor) {
38: return visitor.visitNsNameExcept(namespaceURI, nameClass);
39: }
40:
41: public boolean isOpen() {
42: return true;
43: }
44: }
|