Exemplo n.º 1
0
        public static string[] GetDependencies(IExpression init)
        {
            HashSet <string> deps = new HashSet <string>();

            foreach (IExpression expr in init.GetArgs())
            {
                if (expr is ExprRegFunc)
                {
                    ExprRegFunc func = expr as ExprRegFunc;
                    if (!IsDefaultFunction(func))
                    {
                        deps.Add(MathAliases.ConvertName(func.Name));
                    }
                }
                if (expr.GetArgsCount() > 0)
                {
                    string[] internalDeps = GetDependencies(expr);
                    foreach (string dep in internalDeps)
                    {
                        deps.Add(dep);
                    }
                }
            }

            return(deps.ToArray());
        }
Exemplo n.º 2
0
        private static bool IsDefaultFunction(ExprRegFunc func)
        {
            string name = func.Name;

            if (name == "ln" || name == "exp" || name == "abs" ||
                name == "sin" || name == "cos" || name == "tg" || name == "tan" || name == "ctg" || name == "cot" ||
                name == "arcsin" || name == "arccos" || name == "arctg" || name == "arctan" || name == "arcctg" || name == "arccot")
            {
                return(true);
            }
            return(false);
        }