KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thaiopensource > relaxng > impl > NsNameExceptNameClass


1 package com.thaiopensource.relaxng.impl;
2
3 import com.thaiopensource.xml.util.Name;
4
5 class NsNameExceptNameClass implements NameClass {
6
7   private final NameClass nameClass;
8   private final String JavaDoc namespaceURI;
9
10   NsNameExceptNameClass(String JavaDoc namespaceURI, NameClass nameClass) {
11     this.namespaceURI = namespaceURI;
12     this.nameClass = nameClass;
13   }
14
15   public boolean contains(Name name) {
16     return (this.namespaceURI.equals(name.getNamespaceUri())
17         && !nameClass.contains(name));
18   }
19
20   public int containsSpecificity(Name name) {
21     return contains(name) ? SPECIFICITY_NS_NAME : SPECIFICITY_NONE;
22   }
23
24   public boolean equals(Object JavaDoc obj) {
25     if (obj == null || !(obj instanceof NsNameExceptNameClass))
26       return false;
27     NsNameExceptNameClass other = (NsNameExceptNameClass)obj;
28     return (namespaceURI.equals(other.namespaceURI)
29         && nameClass.equals(other.nameClass));
30   }
31
32   public int hashCode() {
33     return namespaceURI.hashCode() ^ nameClass.hashCode();
34   }
35
36   public void accept(NameClassVisitor visitor) {
37     visitor.visitNsNameExcept(namespaceURI, nameClass);
38   }
39
40   public boolean isOpen() {
41     return true;
42   }
43 }
44
45
Popular Tags