private void answersAnalysis(FactManager factManager) { List <string> tags = new List <string>(); for (LinkedListNode <Question> question = questionDatabase.getQuestions().First; question != null; question = question.Next) { Question node = question.Value; if (node.getAnswer()) { tags.Add(node.getTag()); } } Dictionary <Fact, double> compareTags = factManager.getFactDatabase().Compare(tags); double max = 0.0; Fact maxFact = new Fact(); foreach (var entry in compareTags) { if (entry.Value > max) { max = entry.Value; maxFact = entry.Key; } } maxFact.show(max); }
private bool updateQuestionList(string signal, string tag, FactManager factManager) { if (signal == "y") { //выборка списка тегов из базы знаний List <string> resultTags = new List <string>(); Dictionary <List <string>, Fact> facts = factManager.getFactDatabase().getFacts(); int count = 0; bool continueSignal = true; foreach (KeyValuePair <List <string>, Fact> entry in facts) { if (entry.Key.Contains(tag)) { foreach (var element in entry.Key) { resultTags.Add(element); } count++; } } if (count == 1) { continueSignal = false; } LinkedListNode <Question> firstNode = questionDatabase.getQuestions().First; for (LinkedListNode <Question> question = firstNode; question != null; question = question.Next) { string currentQuestionTag = question.Value.getTag(); //question.Value.getId() != id && if (!resultTags.Contains(currentQuestionTag)) { //удаление узла question question.Value.setStatus(false); /*question.Previous.Next = question.Next; * question.Next.Previous = question.Previous; * question.Previous = null; * question.Next = null;*/ } } return(continueSignal); } else { return(true); } }