예제 #1
0
 private static void AddJasonFunction(Type c)
 {
     try
     {
         ArithFunction af = (ArithFunction)Activator.CreateInstance(typeof(ArithFunction));
         functions.Add(af.GetName(), af);
     }
     catch (Exception e)
     {
     }
 }
예제 #2
0
 /** add new global function (shared among all agents in the JVM) */
 public static void AddFunction(Type c)
 {
     try
     {
         ArithFunction af    = (ArithFunction)Activator.CreateInstance(typeof(ArithFunction));
         string        error = CheckFunctionName(af.GetName());
         if (error == null)
         {
             functions.Add(af.GetName(), af);
         }
     }
     catch (Exception)
     {
     }
 }
예제 #3
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);
        }
예제 #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);
     }
 }
예제 #5
0
 public ArithFunctionTerm(ArithFunctionTerm af) : base(af)
 {
     function = af.function;
     agent    = af.agent;
 }
예제 #6
0
 public ArithFunctionTerm(ArithFunction function) : base(function.GetName(), 2)
 {
     this.function = function;
 }