/** * Applies differentiation to a function. Used the rules specified by objects of type {@link * DiffRulesI}. * * @param node The node of the function. * @param data The variable to differentiate wrt. */ public Object visit(ASTFunNode node, Object data) throws ParseException { String name = node.getName(); // System.out.println("FUN: "+ node + " nchild "+nchild); Node children[] = TreeUtils.getChildrenAsArray(node); Node dchildren[] = acceptChildrenAsArray(node, data); if (node.getPFMC() instanceof DiffRulesI) { return ((DiffRulesI) node.getPFMC()) .differentiate(node, (String) data, children, dchildren, localDJep); } DiffRulesI rules = (DiffRulesI) diffRules.get(name); if (rules != null) return rules.differentiate(node, (String) data, children, dchildren, localDJep); throw new ParseException("Sorry I don't know how to differentiate " + node + "\n"); }