本文整理汇总了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);
}
示例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);
}
示例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();
}
示例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;
}
示例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);
}