1 18 package org.apache.batik.css.engine.sac; 19 20 import org.w3c.css.sac.Selector; 21 import org.w3c.css.sac.SiblingSelector; 22 import org.w3c.css.sac.SimpleSelector; 23 24 31 public abstract class AbstractSiblingSelector 32 implements SiblingSelector, 33 ExtendedSelector { 34 35 38 protected short nodeType; 39 40 43 protected Selector selector; 44 45 48 protected SimpleSelector simpleSelector; 49 50 53 protected AbstractSiblingSelector(short type, 54 Selector sel, 55 SimpleSelector simple) { 56 nodeType = type; 57 selector = sel; 58 simpleSelector = simple; 59 } 60 61 64 public short getNodeType() { 65 return nodeType; 66 } 67 68 72 public boolean equals(Object obj) { 73 if (obj == null || !(obj.getClass() != getClass())) { 74 return false; 75 } 76 AbstractSiblingSelector s = (AbstractSiblingSelector)obj; 77 return s.simpleSelector.equals(simpleSelector); 78 } 79 80 83 public int getSpecificity() { 84 return ((ExtendedSelector)selector).getSpecificity() + 85 ((ExtendedSelector)simpleSelector).getSpecificity(); 86 } 87 88 92 public Selector getSelector() { 93 return selector; 94 } 95 96 100 public SimpleSelector getSiblingSelector() { 101 return simpleSelector; 102 } 103 } 104 | Popular Tags |