@Override public void visit(MathFunctionCall node) { result = null; node.getOperand().accept(this); if (result != null) result = new MathFunctionCall(result, node.getFunction()); }
@Override public Expression copy() { return new MathFunctionCall(getOperand().copy(), function); }
@Override //dfg public void visit(MathFunctionCall 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.getOperand().accept(this); }
@Override public void visit(MathFunctionCall mathFunctionCall) { code.append(mathFunctionCall.getFunction().toString()); code.append('('); mathFunctionCall.getOperand().accept(this); code.append(')'); }
@Override public void visit(MathFunctionCall node) { //TODO Schluckt nachkommende werte if (opstor.OperationShouldBeReplaced(node)) { nx = new Variable(opstor.getReplacementID(node)); System.out.println("Replacer: Node in Set: ( " + node.toString() + " ) ---> Replacing with " + opstor.getReplacementID(node)); } else { node.getOperand().accept(this); nx = new MathFunctionCall(nx, node.getFunction()); } //nx = node; }
@Override public void visit(MathFunctionCall node) { System.out.println("MyMathFuncVisit"); mathfunctionHack = true; node.getOperand().accept(this); mathfunctionHack = false; UnaryOperation newOp; switch (node.getFunction()) { case SQRT: newOp = new SquareRoot(); break; case ABS: newOp = new Absolut(); break; case ACOS: newOp = new ArcCos(); break; case COS: newOp = new Cos(); break; case SIN: newOp = new Sin(); break; default: throw new UnsupportedOperationException("Math function " + node.toString() + " not supported."); } newOp.setData(toappend); toappend = newOp; addToGraph(toappend); }
@Override public void visit(MathFunctionCall node) { // just do nothing, because only MulitvectorComponent is important node.getOperand().accept(this); }
@Override public void visit(MathFunctionCall node) { node.accept(this); double operandValue = resultValue; switch (node.getFunction()) { case ABS: resultValue = Math.abs(operandValue);
@Override public void visit(MathFunctionCall node) { resultValue = null; node.getOperand().accept(this); if (resultValue != null) { node.setOperand(resultValue); resultValue = null; } else { Variable var = getNewTemporaryVariable(); toInsert.put(var, node.getOperand()); toInsertVars.add(var); node.setOperand(var); } Variable var2 = getNewTemporaryVariable(); toInsert.put(var2, node); toInsertVars.add(var2); resultValue = var2; } };
@Override public void visit(MathFunctionCall node) { createExtCalculationFromUnaryOperation(node, transformFunction(node.getFunction())); }
boolean isSqrt = rightc.getValue() - (double) new Double(rightc.getValue()).intValue() == 0.5; if(isSqrt && rightc.getValue() != 0.5) { MathFunctionCall newsqrt = new MathFunctionCall(new Exponentiation( left, new FloatConstant(rightc.getValue() - 0.5f)), MathFunction.SQRT); resultExpr = newsqrt; MathFunctionCall newsqrt = new MathFunctionCall(left, MathFunction.SQRT); newsqrt.accept(this); } else if (rightc.getValue() == 2.0) { resultExpr = new Multiplication(left, left);
private Expression processFunction(String name, Expression arg) { for (MathFunction mathFunction : MathFunction.values()) if (mathFunction.toString().toLowerCase().equals(name)) return new MathFunctionCall(arg, mathFunction); throw new IllegalArgumentException("Function " + name + " is not supported by maxima parser"); }
@Override public void visit(MathFunctionCall mathFunctionCall) { code.append(mathFunctionCall.getFunction().toString()); code.append('('); mathFunctionCall.getOperand().accept(this); code.append(')'); }
/** * Converts this node to a human readable string representation. * * @return The string "<code>function(operand)</code>" where function and operand are both converted to strings using their * toString methods. */ public String toString() { return function.toString().toLowerCase() + "(" + getOperand() + ")"; }
boolean isSqrt = doubleEquals(rightc.getValue() - (double) new Double(rightc.getValue()).intValue(), 0.5f); if (isSqrt && !doubleEquals(rightc.getValue(), 0.5f)) { MathFunctionCall newsqrt = new MathFunctionCall(new Exponentiation( left, new FloatConstant(rightc.getValue() - 0.5f)), MathFunction.SQRT); resultExpr = newsqrt; setGraphModified(); } else if (doubleEquals(rightc.getValue(), 0.5f)) { MathFunctionCall newsqrt = new MathFunctionCall(left, MathFunction.SQRT); newsqrt.accept(this); setGraphModified(); } else if (doubleEquals(rightc.getValue(), 2.0f)) {
@Override public void visit(Division node) { resultValue = new Multiplication(node.getLeft(), new MathFunctionCall(node.getRight(), MathFunction.INVERT)); } };
@Override public void visit(MathFunctionCall node) { node.getOperand().accept(this); resultExpr = new MathFunctionCall(resultExpr, node.getFunction()); }
@Override public void visit(MathFunctionCall mathFunctionCall) { code.append(mathFunctionCall.getFunction().toString()); code.append('('); mathFunctionCall.getOperand().accept(this); code.append(')'); }
@Override public void visit(MathFunctionCall mathFunctionCall) { mathFunctionCall.getOperand().accept(this); }
@Override public Expression visitConstant(MaximaParser.ConstantContext ctx) { String text = ctx.getText(); if ("%pi".equals(text)) return new FloatConstant(Math.PI); if ("%i".equals(text)) return new MathFunctionCall(new FloatConstant(-1), MathFunction.SQRT); return new FloatConstant(Double.parseDouble(text)); }