@Override public boolean equals(Object other) { if (other instanceof CompareAll && super.equals(other)) { CompareAll o = (CompareAll)other; return operator.equals(o.getOperator()); } return false; }
/** * @inheritDoc */ @Override public void meet(CompareAll theOp) throws Exception { mBuffer.append("("); theOp.getArg().visit(this); mBuffer.append(" ").append(theOp.getOperator().getSymbol()).append(" all "); mBuffer.append("("); mBuffer.append(renderTupleExpr(theOp.getSubQuery())); mBuffer.append(")"); mBuffer.append(")"); }
/** * @inheritDoc */ @Override public void meet(CompareAll theOp) throws Exception { mBuffer.append("("); theOp.getArg().visit(this); mBuffer.append(" ").append(theOp.getOperator().getSymbol()).append(" all "); mBuffer.append("("); // TODO: query render this theOp.getSubQuery().visit(this); mBuffer.append(")"); mBuffer.append(")"); }
@Override public void meet(CompareAll node) { handleType(SeRQO.COMPAREALL); handleLiteral(SeRQO.OPERATOR, node.getOperator().name()); super.meet(node); }
public Value evaluate(CompareAll node, BindingSet bindings) throws ValueExprEvaluationException, QueryEvaluationException { Value leftValue = evaluate(node.getArg(), bindings); // Result is true until a mismatch has been found boolean result = true; // Use first binding name from tuple expr to compare values String bindingName = node.getSubQuery().getBindingNames().iterator().next(); CloseableIteration<BindingSet, QueryEvaluationException> iter = evaluate(node.getSubQuery(), bindings); try { while (result == true && iter.hasNext()) { BindingSet bindingSet = iter.next(); Value rightValue = bindingSet.getValue(bindingName); try { result = QueryEvaluationUtil.compare(leftValue, rightValue, node.getOperator()); } catch (ValueExprEvaluationException e) { // Exception thrown by ValueCompare.isTrue(...) result = false; } } } finally { iter.close(); } return BooleanLiteral.valueOf(result); }