AttributeCondition attr = (AttributeCondition) cond; CombinatorCondition comb = (CombinatorCondition) cond; LangCondition lang = (LangCondition) cond; PositionalCondition pos = (PositionalCondition) cond;
    private void addConditions(net.homelinux.tobe.css.Selector s, Condition cond) {                AttributeCondition attr = (AttributeCondition) cond;                CombinatorCondition comb = (CombinatorCondition) cond;                LangCondition lang = (LangCondition) cond;                PositionalCondition pos = (PositionalCondition) cond;        switch(cond.getConditionType()) {            case Condition.SAC_AND_CONDITION:                addConditions(s, comb.getFirstCondition());                addConditions(s, comb.getSecondCondition());            break;            case Condition.SAC_ATTRIBUTE_CONDITION:                if(attr.getSpecified()) {                    s.addAttributeEqualsCondition(attr.getLocalName(), attr.getValue());                } else {                    s.addAttributeExistsCondition(attr.getLocalName());                }            break;            case Condition.SAC_BEGIN_HYPHEN_ATTRIBUTE_CONDITION:                s.addAttributeMatchesFirstPartCondition(attr.getLocalName(), attr.getValue());            break;            case Condition.SAC_CLASS_CONDITION:                s.addClassCondition(attr.getValue());            break;            case Condition.SAC_ID_CONDITION:                s.addIDCondition(attr.getValue());            break;            case Condition.SAC_LANG_CONDITION:                s.addLangCondition(lang.getLang());            break;            case Condition.SAC_ONE_OF_ATTRIBUTE_CONDITION:                s.addAttributeMatchesListCondition(attr.getLocalName(), attr.getValue());            break;            case Condition.SAC_POSITIONAL_CONDITION:                s.addFirstChildCondition();            break;            case Condition.SAC_PSEUDO_CLASS_CONDITION:                if(attr.getValue().equals("link")) s.setPseudoClass(AttributeResolver.LINK_PSEUDOCLASS);                if(attr.getValue().equals("visited")) s.setPseudoClass(AttributeResolver.VISITED_PSEUDOCLASS);                if(attr.getValue().equals("hover")) s.setPseudoClass(AttributeResolver.HOVER_PSEUDOCLASS);                if(attr.getValue().equals("active")) s.setPseudoClass(AttributeResolver.ACTIVE_PSEUDOCLASS);                if(attr.getValue().equals("focus")) s.setPseudoClass(AttributeResolver.FOCUS_PSEUDOCLASS);            break;            default:                System.err.println("Bad condition");        }    }