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