@Override public void visit(LogicalOr node) { traverseBinary(node); MvExpressions l = expressions.get(node.getLeft()); MvExpressions r = expressions.get(node.getRight()); MvExpressions result = createNewMvExpressions(); result.bladeExpressions[0] = new LogicalOr(l.bladeExpressions[0], r.bladeExpressions[0]); expressions.put(node, result); System.err.println("Warning: LogicalOr is only implemented for scalars!"); }
@Override public void visit(LogicalOr node) { result = null; node.getLeft().accept(this); Expression leftResult = result; node.getRight().accept(this); Expression rightResult = result; if (leftResult != null || rightResult != null) result = new LogicalOr(leftResult, rightResult); }
@Override public Expression copy() { return new LogicalOr(getLeft().copy(), getRight().copy()); }
@Override public void visit(LogicalOr node) { node.getLeft().accept(this); Expression left = resultExpr; node.getRight().accept(this); Expression right = resultExpr; resultExpr = new LogicalOr(left, right); if (isConstant(left)) { FloatConstant leftc = (FloatConstant) left; if (doubleEquals(leftc.getValue(), 0.0f)) { resultExpr = right; setGraphModified(); } if (doubleEquals(leftc.getValue(), 1.0f)) { resultExpr = left; setGraphModified(); } } else if (isConstant(right)) { FloatConstant rightc = (FloatConstant) right; if (doubleEquals(rightc.getValue(), 0.0f)) { resultExpr = left; setGraphModified(); } if (doubleEquals(rightc.getValue(), 1.0f)) { resultExpr = right; setGraphModified(); } } }
result = new LogicalOr(l, r);