public ValueExpr getArg() { return super.getLeftArg(); }
@Override public boolean equals(Object other) { if (other instanceof BinaryValueOperator) { BinaryValueOperator o = (BinaryValueOperator)other; return leftArg.equals(o.getLeftArg()) && rightArg.equals(o.getRightArg()); } return false; }
private void binaryMeet(String theOpStr, BinaryValueOperator theOp) throws Exception { mBuffer.append(" ("); theOp.getLeftArg().visit(this); mBuffer.append(" ").append(theOpStr).append(" "); theOp.getRightArg().visit(this); mBuffer.append(")"); }
private void binaryMeet(String theOpStr, BinaryValueOperator theOp) throws Exception { mBuffer.append(" ("); theOp.getLeftArg().visit(this); mBuffer.append(" ").append(theOpStr).append(" "); theOp.getRightArg().visit(this); mBuffer.append(")"); }
@Override protected void meetBinaryValueOperator(BinaryValueOperator node) { handleChild(SeRQO.LEFTARG, node.getLeftArg()); handleChild(SeRQO.RIGHTARG, node.getRightArg()); super.meetBinaryValueOperator(node); }
@Override protected void meetBinaryValueOperator(BinaryValueOperator node) { if (former == node.getLeftArg()) { if (replacement == null) { replaceNode(node, node.getRightArg()); } else { node.setLeftArg((ValueExpr)replacement); } } else { assert former == node.getRightArg(); if (replacement == null) { replaceNode(node, node.getLeftArg()); } else { node.setRightArg((ValueExpr)replacement); } } }
@Override protected void meetBinaryValueOperator(BinaryValueOperator binaryValueOp) { super.meetBinaryValueOperator(binaryValueOp); if (isConstant(binaryValueOp.getLeftArg()) && isConstant(binaryValueOp.getRightArg())) { try { Value value = strategy.evaluate(binaryValueOp, EmptyBindingSet.getInstance()); binaryValueOp.replaceWith(new ValueConstant(value)); } catch (ValueExprEvaluationException e) { // TODO: incompatible values types(?), remove the affected part // of the query tree logger.debug("Failed to evaluate BinaryValueOperator with two constant arguments", e); } catch (QueryEvaluationException e) { logger.error("Query evaluation exception caught", e); } } }
@Override public BinaryValueOperator clone() { BinaryValueOperator clone = (BinaryValueOperator)super.clone(); clone.setLeftArg(getLeftArg().clone()); clone.setRightArg(getRightArg().clone()); return clone; } }