当前位置: 首页>>代码示例>>C#>>正文


C# Rete.loadRuleset方法代码示例

本文整理汇总了C#中Creshendo.Util.Rete.Rete.loadRuleset方法的典型用法代码示例。如果您正苦于以下问题:C# Rete.loadRuleset方法的具体用法?C# Rete.loadRuleset怎么用?C# Rete.loadRuleset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Creshendo.Util.Rete.Rete的用法示例。


在下文中一共展示了Rete.loadRuleset方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ObjectBindingTest1

        public void ObjectBindingTest1()
        {
            long ts = DateTime.Now.Ticks;
            int fired = 0;
            int activations = 0;
            using (TextWriter writer = Console.Out)
            {
                Rete engine = new Rete();
                engine.Watch = WatchType.WATCH_ALL;
                engine.addPrintWriter("Console", writer);
                engine.declareObject(typeof (Account), "Account");
                engine.loadRuleset(getRule1());
                engine.assertObject(GetAcct0(), "Account", false, false);
                activations = engine.CurrentFocus.ActivationCount;
                fired = engine.fire();
                engine.printWorkingMemory(true, false);

            double endTime = DateTime.Now.Ticks - ts;
            Console.WriteLine(String.Format("ObjectBindingTest1 completed in {0} seconds.", (endTime/10000000).ToString("0.000000")));
                writer.Flush();
                writer.Close();
                engine.close();
            }

            Assert.IsTrue(fired == 1);
            Assert.IsTrue(activations == 1);
            //AppDomain.Unload(AppDomain.CurrentDomain);
        }
开发者ID:,项目名称:,代码行数:28,代码来源:

示例2: BasicObjectBindingTest1

        public void BasicObjectBindingTest1()
        {
            long ts = DateTime.Now.Ticks;
            int fired = 0;
            int activations = 0;
            Basic basic = new Basic("one", 1);
            using (TextWriter writer = Console.Out)
            {
                Rete engine = new Rete();
                engine.Watch = WatchType.WATCH_ALL;
                engine.addPrintWriter("Console", writer);
                engine.declareObject(typeof (Basic), "Basic");
                engine.loadRuleset(getRule3());

                foreach (Defrule rule in  engine.CurrentFocus.AllRules)
                {
                    Console.WriteLine(rule.toPPString());
                }

                engine.assertObject(basic, "Basic", false, false);
                activations = engine.CurrentFocus.ActivationCount;
                fired = engine.fire();
                engine.printWorkingMemory(true, false);
            double endTime = DateTime.Now.Ticks - ts;
            Console.WriteLine(String.Format("BasicObjectBindingTest1 completed in {0} seconds.", (endTime/10000000).ToString("0.000000")));
                writer.Flush();
                writer.Close();
                engine.close();
            }

            Assert.IsTrue(fired == 1);
            Assert.IsTrue(activations == 1);
            //AppDomain.Unload(AppDomain.CurrentDomain);
        }
开发者ID:,项目名称:,代码行数:34,代码来源:

示例3: testLoadJoinSample13

 public void testLoadJoinSample13()
 {
     Rete engine = new Rete();
     engine.loadRuleset(getRoot("join_sample13.clp"));
     ICollection<object> rules = engine.CurrentFocus.AllRules;
     int count = rules.Count;
     IEnumerator itr = rules.GetEnumerator();
     while (itr.MoveNext())
     {
         Defrule r = (Defrule) itr.Current;
         Console.WriteLine(r.toPPString());
     }
     Assert.AreEqual(3, count);
     engine.close();
 }
开发者ID:,项目名称:,代码行数:15,代码来源:

示例4: manners64

 public static double manners64()
 {
     long ts = DateTime.Now.Ticks;
     long totTime = 0;
     using (TextWriter writer = System.Console.Out)
     {
         Rete engine = new Rete();
         //engine.CurrentFocus.Lazy = true;
         engine.addPrintWriter("Console", writer);
         engine.loadRuleset(getRoot("manners64guests.clp"));
         engine.printWorkingMemory(false, false);
         totTime = DateTime.Now.Ticks - ts;
         writer.Flush();
         writer.Close();
         engine.close();
     }
     return totTime;
 }
开发者ID:,项目名称:,代码行数:18,代码来源:

示例5: RunRules

        private void RunRules(string dir, string clpFile)
        {
            var outFile = Path.Combine(dir, String.Concat(Path.GetFileNameWithoutExtension(clpFile), ".out"));
            var refFile = Path.Combine(dir, String.Concat(Path.GetFileNameWithoutExtension(clpFile), ".ref"));

            using (TextWriter writer = new StreamWriter(outFile))
            {
                Rete engine = new Rete();
                engine.addPrintWriter("File", writer);
                engine.loadRuleset(clpFile);
                engine.printWorkingMemory(false, false);
                engine.close();
                writer.Flush();
                writer.Close();
            }

            var outTxt = File.ReadAllText(outFile);
            var refTxt = File.ReadAllText(refFile);
        }
开发者ID:,项目名称:,代码行数:19,代码来源:


注:本文中的Creshendo.Util.Rete.Rete.loadRuleset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。