本文整理汇总了C#中Rule.ToNormalForm方法的典型用法代码示例。如果您正苦于以下问题:C# Rule.ToNormalForm方法的具体用法?C# Rule.ToNormalForm怎么用?C# Rule.ToNormalForm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rule
的用法示例。
在下文中一共展示了Rule.ToNormalForm方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EvaluateRule
public bool EvaluateRule(Rule rule)
{
if(rule != null) {
Debug.Log (string.Format("Target Rule: {0}", puzzle.rule));
Debug.Log (string.Format("Test Rule: {0}", rule));
Debug.Log (string.Format("Target Normal Form {0}", puzzle.rule.ToNormalForm()));
Debug.Log (string.Format("Test Normal Form {0}", rule.ToNormalForm()));
return puzzle.rule.ToNormalForm().Equals(rule.ToNormalForm());
} else {
return false;
}
}
示例2: NotAndTest
public void NotAndTest()
{
Atom A = new AllHave(new PropertyCheckers.PropertyHasValue("Face", "One"));
Atom B = new ExistsOneHas(new PropertyCheckers.PropertyHasValue("Colour", "Black"));
Rule rule1 = new Rule(new Not(new And(A, B)));
Rule rule2 = new Rule(new Or(A.Negate(), B.Negate()));
Assert.AreEqual("NOT ((AllHave [Face == One]) AND (ExistsOneHas [Colour == Black]))", rule1.ToString());
Assert.AreEqual("(ExistsOneHas [NOT (Face == One)]) OR (AllHave [NOT (Colour == Black)])", rule2.ToString());
Assert.AreEqual("(ExistsOneHas [NOT (Face == One)]) OR (AllHave [NOT (Colour == Black)])", rule1.ToNormalForm().ToString());
Assert.AreEqual(true, rule1.ToNormalForm().Equals(rule2.ToNormalForm()));
}
示例3: Start
// Use this for initialization
void Start ()
{
Atom A = new AllHave(new PropertyCheckers.PropertyHasValue("Face","One"));
Atom B = new ExistsOneHas(new PropertyCheckers.PropertyHasValue("Colour", "Black"));
Rule rule1 = new Rule(new Not(new And(A,B)));
Rule rule2 = new Rule(new Or(A.Negate(), B.Negate()));
Debug.Log (rule1.ToString());
Debug.Log (rule2.ToString());
Debug.Log (rule1.ToNormalForm().ToString());
Debug.Log (rule2.ToNormalForm().ToString());
Debug.Log ("Unormalised - " + rule1.Equals(rule2));
Debug.Log ("Normalised - " + rule1.ToNormalForm().Equals(rule2.ToNormalForm()));
}
示例4: DoubleNegationTest
public void DoubleNegationTest()
{
Atom A = new AllHave(new PropertyCheckers.PropertyHasValue("Face", "One"));
Rule rule1 = new Rule(new Not(new Not(A)));
Assert.AreEqual("NOT (NOT (AllHave [Face == One]))", rule1.ToString());
Assert.AreEqual("AllHave [Face == One]", rule1.ToNormalForm().ToString());
}