21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 * or visit www.oracle.com if you need additional information or have any |
22 * or visit www.oracle.com if you need additional information or have any |
23 * questions. |
23 * questions. |
24 */ |
24 */ |
25 /* |
25 /* |
26 * Copyright (C) 2004-2011 |
26 * Copyright (C) 2004-2012 |
27 * |
27 * |
28 * Permission is hereby granted, free of charge, to any person obtaining a copy |
28 * Permission is hereby granted, free of charge, to any person obtaining a copy |
29 * of this software and associated documentation files (the "Software"), to deal |
29 * of this software and associated documentation files (the "Software"), to deal |
30 * in the Software without restriction, including without limitation the rights |
30 * in the Software without restriction, including without limitation the rights |
31 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
31 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
53 |
53 |
54 public SimpleNameClass(QName name) { |
54 public SimpleNameClass(QName name) { |
55 this.name = name; |
55 this.name = name; |
56 } |
56 } |
57 |
57 |
58 public SimpleNameClass( String nsUri, String localPart ) { |
58 public SimpleNameClass(String nsUri, String localPart) { |
59 this( new QName(nsUri,localPart) ); |
59 this(new QName(nsUri, localPart)); |
60 } |
60 } |
61 |
61 |
|
62 public SimpleNameClass(String nsUri, String localPart, String prefix) { |
|
63 this(new QName(nsUri, localPart, prefix)); |
|
64 } |
|
65 |
|
66 @Override |
62 public boolean contains(QName name) { |
67 public boolean contains(QName name) { |
63 return this.name.equals(name); |
68 return this.name.equals(name); |
64 } |
69 } |
65 |
70 |
|
71 @Override |
66 public int containsSpecificity(QName name) { |
72 public int containsSpecificity(QName name) { |
67 return contains(name) ? SPECIFICITY_NAME : SPECIFICITY_NONE; |
73 return contains(name) ? SPECIFICITY_NAME : SPECIFICITY_NONE; |
68 } |
74 } |
69 |
75 |
70 @Override |
76 @Override |
72 return name.hashCode(); |
78 return name.hashCode(); |
73 } |
79 } |
74 |
80 |
75 @Override |
81 @Override |
76 public boolean equals(Object obj) { |
82 public boolean equals(Object obj) { |
77 if (obj == null || !(obj instanceof SimpleNameClass)) |
83 if (obj == null || !(obj instanceof SimpleNameClass)) { |
78 return false; |
84 return false; |
|
85 } |
79 SimpleNameClass other = (SimpleNameClass) obj; |
86 SimpleNameClass other = (SimpleNameClass) obj; |
80 return name.equals(other.name); |
87 return name.equals(other.name); |
81 } |
88 } |
82 |
89 |
|
90 @Override |
83 public <V> V accept(NameClassVisitor<V> visitor) { |
91 public <V> V accept(NameClassVisitor<V> visitor) { |
84 return visitor.visitName(name); |
92 return visitor.visitName(name); |
85 } |
93 } |
86 |
94 |
|
95 @Override |
87 public boolean isOpen() { |
96 public boolean isOpen() { |
88 return false; |
97 return false; |
89 } |
98 } |
90 } |
99 } |