use of org.z3950.zing.cql.CQLProxNode in project okapi by folio-org.
the class CQLUtil method reduceBoolean.
private static CQLNode reduceBoolean(CQLBooleanNode n1, CQLTermNode tn, Comparator<CQLTermNode> cmp) {
CQLNode n2 = null;
CQLNode left = reducer(n1.getLeftOperand(), tn, cmp);
CQLNode right = reducer(n1.getRightOperand(), tn, cmp);
ModifierSet mSet = new ModifierSet(n1.getOperator().toString().toLowerCase());
List<Modifier> mods = n1.getModifiers();
for (Modifier m : mods) {
mSet.addModifier(m.getType(), m.getComparison(), m.getValue());
}
if (left == null) {
n2 = right;
} else if (right == null) {
n2 = left;
}
switch(n1.getOperator()) {
case AND:
if (left != null && right != null) {
n2 = new CQLAndNode(left, right, mSet);
}
break;
case OR:
if (left != null && right != null) {
n2 = new CQLOrNode(left, right, mSet);
}
break;
case NOT:
if (left != null && right != null) {
n2 = new CQLNotNode(left, right, mSet);
}
break;
case PROX:
if (left != null && right != null) {
n2 = new CQLProxNode(left, right, mSet);
}
break;
}
return n2;
}
Aggregations