/** * Dummy method for calculating a product * @param typeProduct The type of the product * @param node The node which represents the product to be calculated */ private void calculateUsingMultTable(Products typeProduct, BinaryOperation node) { MvExpressions left = expressions.get(node.getLeft()); MvExpressions right = expressions.get(node.getRight()); MvExpressions result = calculateUsingMultTable(typeProduct, left, right); expressions.put(node, result); }
@Override protected void visitBinaryOperation(BinaryOperation node) { node.getLeft().accept(expressionVisitor); if (replaceWith != null) { node.setLeft(replaceWith); replaceWith = null; } node.getRight().accept(expressionVisitor); if (replaceWith != null) { node.setRight(replaceWith); replaceWith = null; } }
@Override protected void visitBinaryOperation(BinaryOperation node) { resultValue = null; node.getLeft().accept(this); if (resultValue != null) { node.setLeft(resultValue); resultValue = null; } node.getRight().accept(this); if (resultValue != null) { node.setRight(resultValue); resultValue = null; } }
@Override protected void visitBinaryOperation(BinaryOperation node) { resultValue = null; node.getLeft().accept(this); if (resultValue != null) { node.setLeft(resultValue); resultValue = null; } node.getRight().accept(this); if (resultValue != null) { node.setRight(resultValue); resultValue = null; } }
/** * Visits a BinaryOperation instance * @param binaryOperation The BinaryOperation */ private void visitBinaryOperation(BinaryOperation binaryOperation) { binaryOperation.getLeft().accept(this); if (replace) { binaryOperation.setLeft(toReplace); replace = false; } binaryOperation.getRight().accept(this); if (replace) { binaryOperation.setRight(toReplace); replace = false; } }
public void handlebinary(BinaryOperation node) { if (opstor.add(node, currentAssignment)) { System.out.println("Collector: Node not in Set( " + node.toString() + " ) ---> Adding"); } else { System.out.println("Collector: Node already in Set( " + node.toString() + " ) "); } node.getLeft().accept(this); node.getRight().accept(this); }
/** * Handles a binary operation: Prints the operator between the left and the right operand (infix) * @param operation The binary operation * @param operator The operator to be used * @param withSpaces <value>true</value> if spaces should be printed next to operator, otherwise <value>false</value> */ private void handleInfix(BinaryOperation operation, String operator, boolean withSpaces) { addChild(operation, operation.getLeft()); if (withSpaces) { code.append(' '); code.append(operator); code.append(' '); } else { code.append(operator); } addChild(operation, operation.getRight()); }
/** * Creates a extended calculation from an binary operation * @param node The binary operation node * @param type The calculation type */ private void createExtCalculationFromBinaryOperation(BinaryOperation node, CalculationType type) { resultValue = null; node.getLeft().accept(this); ParallelObject left = resultValue; resultValue = null; node.getRight().accept(this); ParallelObject right = resultValue; resultValue = new ExtCalculation(type, left, right); }
public void handlebinary(BinaryOperation node) { Expression leftlocal; Expression rightlocal; node.getLeft().accept(this); leftlocal = resultExpr; node.getRight().accept(this); rightlocal = resultExpr; assert leftlocal != null && rightlocal != null; if (node.getLeft() instanceof MultivectorComponent && oneset.containsKey(((MultivectorComponent) node.getLeft()).toString())) { System.out.println("Assignment: "+ currAssignString+ " - Replaceable Left: " + ((MultivectorComponent) node.getLeft()).toString()+ "with: "+ oneset.get(((MultivectorComponent)node.getLeft()).toString())); leftlocal = new FloatConstant(oneset.get(((MultivectorComponent)node.getLeft()).toString())); System.out.println("Bhm"); replacements++; } if (node.getRight() instanceof MultivectorComponent && oneset.containsKey(((MultivectorComponent) node.getRight()).toString())) { System.out.println("Assignment: "+ currAssignString+ " - Replaceable Right: " + ((MultivectorComponent) node.getRight()).toString()+" with: "+ oneset.get(((MultivectorComponent)node.getRight()).toString())); rightlocal = new FloatConstant(oneset.get(((MultivectorComponent)node.getRight()).toString())); System.out.println("Bhm"); replacements++; } assert leftlocal != null && rightlocal != null; left=leftlocal; right=rightlocal; }