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())); }
// 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())); }
// 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())); }