* @since 4.2
*/
private static void collectElementsOfValidCriteria(Criteria criteria, Collection<ElementSymbol> elements) {
if(criteria instanceof CompoundCriteria) {
CompoundCriteria compCrit = (CompoundCriteria) criteria;
Iterator<Criteria> iter = compCrit.getCriteria().iterator();
boolean first = true;
Collection<ElementSymbol> savedElements = elements;
if(compCrit.getOperator() == CompoundCriteria.OR) {
elements = new HashSet<ElementSymbol>();
}
while(iter.hasNext()) {
if(compCrit.getOperator() == CompoundCriteria.AND || first) {
collectElementsOfValidCriteria(iter.next(), elements);
first = false;
} else {
HashSet<ElementSymbol> other = new HashSet<ElementSymbol>();
collectElementsOfValidCriteria(iter.next(), other);
elements.retainAll(other);
}
}
if (compCrit.getOperator() == CompoundCriteria.OR) {
savedElements.addAll(elements);
}
} else if(criteria instanceof CompareCriteria) {
CompareCriteria compCrit = (CompareCriteria)criteria;
if (compCrit.getOperator() == CompareCriteria.EQ){
ElementCollectorVisitor.getElements(compCrit, elements);
}
} else if(criteria instanceof MatchCriteria) {
MatchCriteria matchCriteria = (MatchCriteria)criteria;
if (!matchCriteria.isNegated()) {