public static void GeneralCheckRedundancyMethod(GatheredBases bases, RedundancyMethod typeOfRedundancy) { var alreadyChecked = new List <string>(); bool withRules = false; bool withConstrains = false; bool typeRules = false; // program checks all rule with same conclusion. That table exist to avoid double checking foreach (Rule ruleForCheck in bases.RuleBase.RulesList) { if (alreadyChecked.Contains(ruleForCheck.Conclusion) == false) { var allFlatteredRules = AllFlatteredRules(bases, ruleForCheck); var i = typeOfRedundancy(allFlatteredRules, bases); // delegate CheckRedundancyWithRules or another method alreadyChecked.Add(ruleForCheck.Conclusion); if (1 == i || 2 == i) { typeRules = true; } if (i == 2) { withRules = true; } if (i == 32) { withConstrains = true; } } } if (typeRules) { if (withRules == false) { MessageBox.Show("Nie wykryto nadmiarowości w bazie reguł"); } } if (typeRules == false) { if (withConstrains == false) { MessageBox.Show("Nie wykryto nadmiarowości lącznych w bazie reguł i ograniczeń"); } } }
public void CheckRedundancyInRules() { RedundancyMethod delegateMethod = new RedundancyMethod(Redundancy.CheckRedundancyWithRules); Redundancy.GeneralCheckRedundancyMethod(_bases, delegateMethod); }
public void CheckConstrainsRedundancy() { var delegateMethod = new RedundancyMethod(Redundancy.CheckRedundancyWithConstrain); Redundancy.GeneralCheckRedundancyMethod(_bases, delegateMethod); }