01: /* *****************************************************************************
02: * Rule.java
03: * ****************************************************************************/
04:
05: /* J_LZ_COPYRIGHT_BEGIN *******************************************************
06: * Copyright 2001-2006 Laszlo Systems, Inc. All Rights Reserved. *
07: * Use is subject to license terms. *
08: * J_LZ_COPYRIGHT_END *********************************************************/
09:
10: package org.openlaszlo.css;
11:
12: import java.util.*;
13: import org.w3c.css.sac.*;
14:
15: public class Rule {
16: public Rule(Selector selector, Map styleMap) {
17: this .mSelector = selector;
18: this .mStyleMap = styleMap;
19: // specificity for rule is set when match() is called.
20: this .mSpecificity = new Specificity();
21: }
22:
23: Selector mSelector;
24: Map mStyleMap;
25: Specificity mSpecificity;
26:
27: public Selector getSelector() {
28: return mSelector;
29: }
30:
31: public Map getStyleMap() {
32: return mStyleMap;
33: }
34:
35: public Specificity getSpecificity() {
36: return mSpecificity;
37: }
38:
39: /**
40: * @return 0 if this is equal, -1 if this is less, +1 if this is
41: * greater.
42: */
43: int compare(Rule rule) {
44: return this.mSpecificity.compare(rule.mSpecificity);
45: }
46: }
|