コード例 #1
0
ファイル: as2jHeader.cs プロジェクト: nasa03/Jasonity
        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);
        }
コード例 #2
0
 public void AddFunction(string function, int arity, string literal)
 {
     try
     {
         string error = FunctionRegister.CheckFunctionName(function);
         if (error != null)
         {
             //logger.warning(error);
         }
         else
         {
             functions.Add(function, new RuleToFunction(literal, arity));
         }
     }
     catch (Exception e)
     {
         //logger.log(Level.SEVERE, "Error registering function " + literal, e);
     }
 }
コード例 #3
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);
            }
        }
コード例 #4
0
 //Class<? extends ArithFunction> c ?? wtf is this
 private void AddFunction(Type c, bool user)
 {
     try
     {
         ArithFunction af    = (ArithFunction)Activator.CreateInstance(typeof(ArithFunction));
         string        error = null;
         if (user)
         {
             error = FunctionRegister.CheckFunctionName(af.GetName());
         }
         if (error != null)
         {
             //logger.warning(error);
         }
         else
         {
             functions.Add(af.GetName(), af);
         }
     }
     catch (Exception e)
     {
         //logger.log(Level.SEVERE, "Error registering function " + c.getName(), e);
     }
 }