/** * Transpose a given comparison expression into the expression * where the variable corresponding to the target is placed * on the left-hand side. * * @param evalNode * @param target * @return Transposed expression */ public static EvalNode transpose(EvalNode evalNode, Column target) { BinaryEval commutated; if (evalNode instanceof BinaryEval) { // if it is binary BinaryEval binaryEval = (BinaryEval) evalNode; // If the variable is in the right term, inverse the expr. if (!EvalTreeUtil.containColumnRef(binaryEval.getLeftExpr(), target)) { // the commutate method works with a copy of the expr commutated = commutate(binaryEval); } else { try { commutated = (BinaryEval) evalNode.clone(); } catch (CloneNotSupportedException e) { throw new AlgebraicException(e); } } return _transpose(commutated, target); } else { return evalNode; } }
/** * Transpose a given comparison expression into the expression * where the variable corresponding to the target is placed * on the left-hand side. * * @param evalNode * @param target * @return Transposed expression */ public static EvalNode transpose(EvalNode evalNode, Column target) { BinaryEval commutated; if (evalNode instanceof BinaryEval) { // if it is binary BinaryEval binaryEval = (BinaryEval) evalNode; // If the variable is in the right term, inverse the expr. if (!EvalTreeUtil.containColumnRef(binaryEval.getLeftExpr(), target)) { // the commutate method works with a copy of the expr commutated = commutate(binaryEval); } else { try { commutated = (BinaryEval) evalNode.clone(); } catch (CloneNotSupportedException e) { throw new AlgebraicException(e); } } return _transpose(commutated, target); } else { return evalNode; } }