/** * Conditional factor. * * @param node of the SimpleNode of JJTree * @param condition the condition * @return the condition * @throws ParseException Exception thrown by parser when parsing an invalid query. */ private Condition conditionalFactor(final SimpleNode node, final Condition condition) throws ParseException { Condition c = condition; if (((SimpleNode) node.jjtGetChild(0)).id == JJTCONDITIONALPRIMARY) { c = conditionalPrimary((SimpleNode) node.jjtGetChild(0), c); if (node.getKind() == NOT) { c.not(); } } return c; }
/** * Conditional term. * * @param node of the SimpleNode of JJTree * @param condition the condition * @return the condition * @throws ParseException Exception thrown by parser when parsing an invalid query. */ private Condition conditionalTerm(final SimpleNode node, final Condition condition) throws ParseException { Condition c = condition; if (((SimpleNode) node.jjtGetChild(0)).id == JJTCONDITIONALFACTOR) { c = conditionalFactor((SimpleNode) node.jjtGetChild(0), c); } for (int i = 1; node.jjtGetNumChildren() > i; i++) { if (((SimpleNode) node.jjtGetChild(i)).id == JJTCONDITIONALFACTOR) { c = c.and(conditionalFactor((SimpleNode) node.jjtGetChild(i), c)); } } return c; }