Пример #1
0
        public static List <List <SimpleTree> > AllFlatteredRules(GatheredBases bases, Rule ruleForCheck)
        {
            List <List <SimpleTree> > allFlatteredRules = new List <List <SimpleTree> >();
            List <Rule> ruleList = ConclusionClass.FindRulesWithParticularConclusion
                                       (ruleForCheck.Conclusion, bases.RuleBase.RulesList);

            foreach (var r in ruleList)
            {
                List <List <Rule> > differencesList;
                var tree = TreeOperations.ReturnComplexTreeAndDifferences(
                    bases, r, out differencesList);
                List <List <SimpleTree> > possibleTrees = TreeOperations.ReturnPossibleTrees(tree,
                                                                                             differencesList);
                allFlatteredRules.AddRange(possibleTrees);
            }
            return(allFlatteredRules);
        }
Пример #2
0
        public static void ExpandBrunchOrMakeAskable
            (GatheredBases bases, SimpleTree parentWithoutChild, List <List <Rule> > divideList)
        {
            foreach (string condition in parentWithoutChild.rule.Conditions)
            {
                List <Rule> returnedRules = ConclusionClass.FindRulesWithParticularConclusion(condition,
                                                                                              bases.RuleBase.RulesList);

                if (returnedRules.Count == 0)
                {
                    bool isModel = CheckIfModel(condition, bases);
                    var  endRule = new Rule
                    {
                        Conclusion = condition,

                        NumberOfRule = bases.RuleBase.RulesList.Count + 1000
                    };
                    parentWithoutChild.Children.Add(new SimpleTree
                    {
                        Model   = isModel,
                        Askable = true,
                        rule    = endRule,
                        Parent  = parentWithoutChild //todo:nie wiem czy nie lepiej bêdzie jak dopyt i model bêd¹ w endRule
                    });
                }
                else
                {
                    List <SimpleTree> alternativeBranches = ReturnAlternativeBranches(returnedRules, parentWithoutChild);
                    //
                    parentWithoutChild.Children.AddRange(alternativeBranches);

                    if (returnedRules.Count > 1)
                    {
                        divideList.Add(returnedRules);
                    }
                }
            }
        }