/** * @inheritDoc */ @Override public void meet(Compare theOp) throws Exception { mBuffer.append("("); theOp.getLeftArg().visit(this); mBuffer.append(" ").append(theOp.getOperator().getSymbol()).append(" "); theOp.getRightArg().visit(this); mBuffer.append(")"); }
private static Compare compare(ValueExpr theLeft, ValueExpr theRight, Compare.CompareOp theOp) { return new Compare(theLeft, theRight, theOp); } }
@Override public void meet(Compare compare) { super.meet(compare); if (compare.getOperator() == CompareOp.EQ) { ValueExpr leftArg = compare.getLeftArg(); ValueExpr rightArg = compare.getRightArg(); boolean leftIsVar = isVar(leftArg); boolean rightIsVar = isVar(rightArg); boolean leftIsResource = isResource(leftArg); boolean rightIsResource = isResource(rightArg); if (leftIsVar && rightIsResource || leftIsResource && rightIsVar || leftIsResource && rightIsResource) { SameTerm sameTerm = new SameTerm(leftArg, rightArg); compare.replaceWith(sameTerm); } } }
@Override public boolean equals(Object other) { if (other instanceof Compare && super.equals(other)) { Compare o = (Compare)other; return operator.equals(o.getOperator()); } return false; }
public Compare(ValueExpr leftArg, ValueExpr rightArg, CompareOp operator) { super(leftArg, rightArg); setOperator(operator); }
@Override public boolean equals(Object other) { if (other instanceof Compare && super.equals(other)) { Compare o = (Compare)other; return operator.equals(o.getOperator()); } return false; }
public Compare(ValueExpr leftArg, ValueExpr rightArg, CompareOp operator) { super(leftArg, rightArg); setOperator(operator); }
/** * @inheritDoc */ @Override public void meet(Compare theOp) throws Exception { mBuffer.append("("); theOp.getLeftArg().visit(this); mBuffer.append(" ").append(theOp.getOperator().getSymbol()).append(" "); theOp.getRightArg().visit(this); mBuffer.append(")"); }
@Override public void meet(Compare compare) { super.meet(compare); if (compare.getOperator() == CompareOp.EQ) { ValueExpr leftArg = compare.getLeftArg(); ValueExpr rightArg = compare.getRightArg(); boolean leftIsVar = isVar(leftArg); boolean rightIsVar = isVar(rightArg); boolean leftIsResource = isResource(leftArg); boolean rightIsResource = isResource(rightArg); if (leftIsVar && rightIsResource || leftIsResource && rightIsVar || leftIsResource && rightIsResource) { SameTerm sameTerm = new SameTerm(leftArg, rightArg); compare.replaceWith(sameTerm); } } }
private static Compare compare(ValueExpr theLeft, ValueExpr theRight, Compare.CompareOp theOp) { return new Compare(theLeft, theRight, theOp); } }
ExpressionOperation p = RelationalOperations.get(((Compare) expr).getOperator()); return termFactory.getFunction(p, term1, term2);
/** * @inheritDoc */ @Override public void meet(Compare theOp) throws Exception { mBuffer.append("("); theOp.getLeftArg().visit(this); mBuffer.append(" ").append(theOp.getOperator().getSymbol()).append(" "); theOp.getRightArg().visit(this); mBuffer.append(")"); }
private static Compare compare(ValueExpr theLeft, ValueExpr theRight, Compare.CompareOp theOp) { return new Compare(theLeft, theRight, theOp); } }
/** * @inheritDoc */ @Override public void meet(Compare theOp) throws Exception { mBuffer.append("("); theOp.getLeftArg().visit(this); mBuffer.append(" ").append(theOp.getOperator().getSymbol()).append(" "); theOp.getRightArg().visit(this); mBuffer.append(")"); }
public GroupBuilder<T, E> filter(String theVar, Compare.CompareOp theOp, Value theValue) { Compare aComp = new Compare(new Var(theVar), new ValueConstant(theValue), theOp); mGroup.addFilter(aComp); return this; }
/** * @inheritDoc */ @Override public void meet(Compare theOp) throws Exception { mBuffer.append("("); theOp.getLeftArg().visit(this); mBuffer.append(" ").append(theOp.getOperator().getSymbol()).append(" "); theOp.getRightArg().visit(this); mBuffer.append(")"); }
public GroupBuilder<T, E> filter(String theVar, Compare.CompareOp theOp, Value theValue) { Compare aComp = new Compare(new Var(theVar), new ValueConstant(theValue), theOp); mGroup.addFilter(aComp); return this; }
/** * @inheritDoc */ @Override public void meet(Compare theOp) throws Exception { mBuffer.append("("); theOp.getLeftArg().visit(this); mBuffer.append(" ").append(theOp.getOperator().getSymbol()).append(" "); theOp.getRightArg().visit(this); mBuffer.append(")"); }
@Override public Compare visit(ASTCompare node, Object data) throws VisitorException { ValueExpr leftArg = (ValueExpr)node.jjtGetChild(0).jjtAccept(this, null); ValueExpr rightArg = (ValueExpr)node.jjtGetChild(1).jjtAccept(this, null); return new Compare(leftArg, rightArg, node.getOperator()); }
public Value evaluate(Compare node, BindingSet bindings) throws ValueExprEvaluationException, QueryEvaluationException { Value leftVal = evaluate(node.getLeftArg(), bindings); Value rightVal = evaluate(node.getRightArg(), bindings); return BooleanLiteral.valueOf(QueryEvaluationUtil.compare(leftVal, rightVal, node.getOperator())); }