1 18 package org.apache.batik.css.engine.sac; 19 20 import org.w3c.css.sac.CombinatorCondition; 21 import org.w3c.css.sac.Condition; 22 23 30 public abstract class AbstractCombinatorCondition 31 implements CombinatorCondition, 32 ExtendedCondition { 33 34 37 protected Condition firstCondition; 38 39 42 protected Condition secondCondition; 43 44 47 protected AbstractCombinatorCondition(Condition c1, Condition c2) { 48 firstCondition = c1; 49 secondCondition = c2; 50 } 51 52 56 public boolean equals(Object obj) { 57 if (obj == null || !(obj.getClass() != getClass())) { 58 return false; 59 } 60 AbstractCombinatorCondition c = (AbstractCombinatorCondition)obj; 61 return c.firstCondition.equals(firstCondition) && 62 c.secondCondition.equals(secondCondition); 63 } 64 65 68 public int getSpecificity() { 69 return ((ExtendedCondition)getFirstCondition()).getSpecificity() + 70 ((ExtendedCondition)getSecondCondition()).getSpecificity(); 71 } 72 73 77 public Condition getFirstCondition() { 78 return firstCondition; 79 } 80 81 85 public Condition getSecondCondition() { 86 return secondCondition; 87 } 88 } 89 | Popular Tags |