com.thaiopensource.relaxng.pattern.NsNameClass Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of wicketstuff-jing Show documentation
Show all versions of wicketstuff-jing Show documentation
Jing is a validator for RELAX NG and other schema languages. This
project was taken from http://code.google.com/p/jing-trang and
mavenized for inclusion in the Wicket Stuff HTML Validator.
The code was taken from the 20091111 release.
package com.thaiopensource.relaxng.pattern;
import com.thaiopensource.xml.util.Name;
class NsNameClass implements NameClass {
private final String namespaceUri;
NsNameClass(String namespaceUri) {
this.namespaceUri = namespaceUri;
}
public boolean contains(Name name) {
return this.namespaceUri.equals(name.getNamespaceUri());
}
public int containsSpecificity(Name name) {
return contains(name) ? SPECIFICITY_NS_NAME : SPECIFICITY_NONE;
}
public int hashCode() {
return namespaceUri.hashCode();
}
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof NsNameClass))
return false;
return namespaceUri.equals(((NsNameClass)obj).namespaceUri);
}
public void accept(NameClassVisitor visitor) {
visitor.visitNsName(namespaceUri);
}
public boolean isOpen() {
return true;
}
public String getNamespaceUri() {
return namespaceUri;
}
}