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