private BDDNode AppyToAll(List <GeneLink> froms, int i, bool value, string func) { BDDNode app = null; foreach (var f in froms) { var formatParameter = Formater.FormatParameter(f.From, i); var param = _nodeStore[formatParameter]; var node1 = BDDSharpSolver.CreateNodeBasedOnAutomata( formatParameter, true, _manager, param.Index); if (func == OR) { if (app == null) { app = node1; } else { app = _manager.Or(app, node1); } } else if (func == AND) { if (app == null) { app = node1; } else { app = _manager.And(app, node1); } } } if (!value) { app = _manager.Not(app); } return(app); }
public void CreateFunctionsKeysTestSimpleCase() { //Act var res = BDDSharpSolver.CreateFunctionsKeys(new Dictionary <string, List <int> >() { { "a", new List <int>() { 1, 2, 3 } } }); // Assert Assert.AreEqual(res.Count, 1); Assert.AreEqual(res["a"].Count, 3); Assert.IsTrue(res["a"][0] == "#F1_a"); Assert.IsTrue(res["a"][1] == "#F2_a"); Assert.IsTrue(res["a"][2] == "#F3_a"); }
public void CreateFunctionsKeysTestSecondCase() { var res = BDDSharpSolver.CreateFunctionsKeys(new Dictionary <string, List <int> >() { { "a", new List <int>() { 1, 2, 3 } }, { "b", new List <int>() { 1, 2, 3 } } }); Assert.AreEqual(res.Count, 2); Assert.IsTrue(res["a"].Any(a => a == "#F1_a")); Assert.IsTrue(res["a"].Any(a => a == "#F2_a")); Assert.IsTrue(res["a"].Any(a => a == "#F3_a")); Assert.IsTrue(res["b"].Any(a => a == "#F1_b")); Assert.IsTrue(res["b"].Any(a => a == "#F2_b")); Assert.IsTrue(res["b"].Any(a => a == "#F3_b")); }