use of org.freud.analysed.css.rule.selector.CssSelector in project freud by LMAX-Exchange.
the class CssRuleJdom method parseSelectors.
@SuppressWarnings("unchecked")
private void parseSelectors() {
cssSelectorList = new ArrayList<CssSelector>();
final List<Element> children = ruleElement.getChildren();
int index = 0;
CssSelector.Combinator combinator = null;
for (Element child : children) {
if (CssTokenType.COMMA.name().equals(child.getName())) {
index++;
} else if (getCommaSeparatedSelectorListIndex() == index) {
if (CssSelector.Type.isType(child.getName())) {
final String selectorString = child.getAttributeValue(JdomTreeAdaptor.ID_ATTR);
CssSelector.Type selectorType = CssSelector.Type.valueOf(child.getName());
if (selectorString != null) {
Iterable<String> selectors = breakIdentToSelectors(selectorString);
for (String selector : selectors) {
cssSelectorList.add(new CssSelectorJdom(this, selector, selectorType, combinator));
combinator = CssSelector.Combinator.DESCENDANT;
selectorType = CssSelector.Type.CLASS;
}
} else {
cssSelectorList.add(new CssSelectorJdom(this, null, selectorType, combinator));
combinator = CssSelector.Combinator.DESCENDANT;
}
} else if (CssSelector.Combinator.isCombinator(child.getName())) {
combinator = CssSelector.Combinator.valueOf(child.getName());
}
}
}
}
Aggregations