/** * Returns the list of different variables resulting in a true state for this * expression. * * @param context The context to match in. * @return True if the document is accepted. * @throws RuntimeException if the evaluation enters an illegal state */ public ResultList getMatchingResultList(Context context) { return ResultList.toResultList(expression.evaluate(context)); }
@Override public Object evaluate(Context context) { Stack<ValueItem> buf = new Stack<>(); for (NodeItem item : items) { if ( ! buf.isEmpty()) { while (buf.peek().operator > item.operator) { combineValues(buf); } } buf.push(new ValueItem(item.operator, ResultList.toResultList(item.node.evaluate(context)))); } while (buf.size() > 1) { combineValues(buf); } return buf.pop().value; }