Exemplo n.º 1
0
        private ArithFunction GetArithFunction(Literal l)
        {
            ArithFunction af = null;

            if (curAg != null)
            {
                // try to find the function in agent register
                af = curAg.GetFunction(l.GetFunctor(), l.GetArity());
            }
            if (af == null)
            {
                // try global function
                af = FunctionRegister.GetFunction(l.GetFunctor(), l.GetArity());
            }
            return(af);
        }
Exemplo n.º 2
0
        public ArithFunction GetFunction(string function, int arity)
        {
            if (functions == null)
            {
                return(null);
            }
            ArithFunction af;

            functions.TryGetValue(function, out af);
            if (af == null || !af.CheckArity(arity))
            {
                af = FunctionRegister.GetFunction(function, arity);
            }
            if (af != null && af.CheckArity(arity))
            {
                return(af);
            }
            else
            {
                return(null);
            }
        }