KickJava   Java API By Example, From Geeks To Geeks.

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


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 org.w3c.css.sac.AttributeCondition;
21
22 /**
23  * This class provides an abstract implementation of the {@link
24  * org.w3c.css.sac.AttributeCondition} interface.
25  *
26  * @author <a HREF="mailto:stephane@hillion.org">Stephane Hillion</a>
27  * @version $Id: AbstractAttributeCondition.java,v 1.3 2004/08/18 07:12:50 vhardy Exp $
28  */

29 public abstract class AbstractAttributeCondition
30     implements AttributeCondition,
31            ExtendedCondition {
32
33     /**
34      * The attribute value.
35      */

36     protected String JavaDoc value;
37
38     /**
39      * Creates a new AbstractAttributeCondition object.
40      */

41     protected AbstractAttributeCondition(String JavaDoc value) {
42     this.value = value;
43     }
44
45     /**
46      * Indicates whether some other object is "equal to" this one.
47      * @param obj the reference object with which to compare.
48      */

49     public boolean equals(Object JavaDoc obj) {
50     if (obj == null || !(obj.getClass() != getClass())) {
51         return false;
52     }
53     AbstractAttributeCondition c = (AbstractAttributeCondition)obj;
54     return c.value.equals(value);
55     }
56
57     /**
58      * Returns the specificity of this condition.
59      */

60     public int getSpecificity() {
61     return 1 << 8;
62     }
63
64     /**
65      * <b>SAC</b>: Implements {@link
66      * org.w3c.css.sac.AttributeCondition#getValue()}.
67      */

68     public String JavaDoc getValue() {
69     return value;
70     }
71 }
72
Popular Tags