/** * Parse the given <code>expression String</code> and store the resulting * ASTNode in this DoubleEvaluator. * * @param expression the expression * @return the AST node * @throws SyntaxError the syntax error */ public ASTNode parse( String expression ) { Parser p = new Parser(); fNode = p.parse( expression ); if ( fNode instanceof FunctionNode ) { fNode = optimizeFunction( (FunctionNode) fNode ); } return fNode; }
/** * Parse the given <code>expression String</code> and store the resulting * ASTNode in this DoubleEvaluator * * @param expression * @return * @throws SyntaxError */ public ASTNode parse(String expression) { Parser p = new Parser(); fNode = p.parse(expression); if (fNode instanceof FunctionNode) { fNode = optimizeFunction((FunctionNode) fNode); } return fNode; }
/** * Parse the given <code>expression String</code> and evaluate it to a * double value. * * @param expression the expression * @return the double * @throws SyntaxError the syntax error */ public double evaluate( String expression ) { Parser p = new Parser(); fNode = p.parse( expression ); if ( fNode instanceof FunctionNode ) { fNode = optimizeFunction( (FunctionNode) fNode ); } return evaluateNode( fNode ); }
/** * Parse the given <code>expression String</code> and evaluate it to a double * value * * @param expression * @return * @throws SyntaxError */ public double evaluate(String expression) { Parser p = new Parser(); fNode = p.parse(expression); if (fNode instanceof FunctionNode) { fNode = optimizeFunction((FunctionNode) fNode); } return evaluateNode(fNode); }
/** * Parse the given <code>expression String</code> and store the resulting ASTNode in this DoubleEvaluator * * @param expression * @return * @throws SyntaxError */ public ASTNode parse(String expression) { Parser p; if (fRelaxedSyntax) { p = new Parser(ASTNodeFactory.RELAXED_STYLE_FACTORY, true); } else { p = new Parser(ASTNodeFactory.MMA_STYLE_FACTORY, false); } fNode = p.parse(expression); if (fNode instanceof FunctionNode) { fNode = optimizeFunction((FunctionNode) fNode); } return fNode; }
/** * Parse the given <code>expression String</code> and evaluate it to a double value * * @param expression * @return * @throws SyntaxError */ public double evaluate(String expression) { Parser p; if (fRelaxedSyntax) { p = new Parser(ASTNodeFactory.RELAXED_STYLE_FACTORY, true); } else { p = new Parser(ASTNodeFactory.MMA_STYLE_FACTORY, false); } fNode = p.parse(expression); if (fNode instanceof FunctionNode) { fNode = optimizeFunction((FunctionNode) fNode); } return evaluateNode(fNode); }
functionNode.set(i, new DoubleNode(((NumberNode) functionNode.getNode(i)).doubleValue())); } else if (functionNode.getNode(i) instanceof FunctionNode) { ASTNode optNode = optimizeFunction((FunctionNode) functionNode.getNode(i)); if (!(optNode instanceof DoubleNode)) { doubleOnly = false;
.getNode(i)).doubleValue())); } else if (functionNode.getNode(i) instanceof FunctionNode) { ASTNode optNode = optimizeFunction((FunctionNode) functionNode .getNode(i)); if (!(optNode instanceof DoubleNode)) {
ASTNode optNode = optimizeFunction( (FunctionNode) functionNode.getNode( i ) ); if ( !(optNode instanceof DoubleNode) ) { doubleOnly = false;