/** * 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() + ")"; }
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 int hashCode() { int result = super.hashCode(); result = 31 * result + (function != null ? function.hashCode() : 0); return result; } }
@Override public void visit(MathFunctionCall node) { String opName = node.getFunction().name().toLowerCase(); switch (node.getFunction()) { case CEIL: opName = "ceiling"; break; case FACT: opName = ""; result.append("("); node.getOperand().accept(this); result.append("!)"); return; } handleUnary(node, opName); }
@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) { code.append(mathFunctionCall.getFunction().toString()); code.append('('); mathFunctionCall.getOperand().accept(this); code.append(')'); }
@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) { code.append(mathFunctionCall.getFunction().toString()); code.append('('); mathFunctionCall.getOperand().accept(this); code.append(')'); }
@Override public void visit(MathFunctionCall mathFunctionCall) { String funcName; switch (mathFunctionCall.getFunction()) { case ABS: funcName = "fabs"; break; case SQRT: funcName = "sqrtf"; break; default: funcName = mathFunctionCall.getFunction().toString().toLowerCase(); } code.append(funcName); code.append('('); mathFunctionCall.getOperand().accept(this); code.append(')'); }
@Override public void visit(MathFunctionCall mathFunctionCall) { String funcName = "(double) Math." + mathFunctionCall.getFunction().toString().toLowerCase(); if (mathFunctionCall.getFunction() == MathFunction.FACT) { funcName = "fact"; implementFactorial = true; } append(funcName); append('('); mathFunctionCall.getOperand().accept(this); append(')'); }
@Override public void visit(MathFunctionCall mathFunctionCall) { addNode(mathFunctionCall, mathFunctionCall.getFunction().toString()); mathFunctionCall.getOperand().accept(this); addEdge(mathFunctionCall.getOperand(), mathFunctionCall); }
default: result.bladeExpressions[0] = new MathFunctionCall(expressions.get(node.getOperand()).bladeExpressions[0], node.getFunction()); System.err.println("Warning: " + node.getFunction().toString() + " is only implemented for scalar inputs!"); break;