KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > css > engine > sac > AbstractElementSelector


1 /*
2
3    Copyright 2002 The Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16
17  */

18 package org.apache.batik.css.engine.sac;
19
20 import java.util.Set JavaDoc;
21
22 import org.w3c.css.sac.ElementSelector;
23
24 /**
25  * This class provides an abstract implementation of the ElementSelector
26  * interface.
27  *
28  * @author <a HREF="mailto:stephane@hillion.org">Stephane Hillion</a>
29  * @version $Id: AbstractElementSelector.java,v 1.4 2004/08/18 07:12:50 vhardy Exp $
30  */

31 public abstract class AbstractElementSelector
32     implements ElementSelector,
33            ExtendedSelector {
34
35     /**
36      * The namespace URI.
37      */

38     protected String JavaDoc namespaceURI;
39
40     /**
41      * The local name.
42      */

43     protected String JavaDoc localName;
44
45     /**
46      * Creates a new ElementSelector object.
47      */

48     protected AbstractElementSelector(String JavaDoc uri, String JavaDoc name) {
49     namespaceURI = uri;
50     localName = name;
51     }
52
53     /**
54      * Indicates whether some other object is "equal to" this one.
55      * @param obj the reference object with which to compare.
56      */

57     public boolean equals(Object JavaDoc obj) {
58     if (obj == null || !(obj.getClass() != getClass())) {
59         return false;
60     }
61     AbstractElementSelector s = (AbstractElementSelector)obj;
62     return s.namespaceURI.equals(namespaceURI) &&
63            s.localName.equals(localName);
64     }
65
66     /**
67      * <b>SAC</b>: Implements {@link
68      * org.w3c.css.sac.ElementSelector#getNamespaceURI()}.
69      */

70     public String JavaDoc getNamespaceURI() {
71     return namespaceURI;
72     }
73
74     /**
75      * <b>SAC</b>: Implements {@link
76      * org.w3c.css.sac.ElementSelector#getLocalName()}.
77      */

78     public String JavaDoc getLocalName() {
79     return localName;
80     }
81
82     /**
83      * Fills the given set with the attribute names found in this selector.
84      */

85     public void fillAttributeSet(Set JavaDoc attrSet) {
86     }
87 }
88
Popular Tags