public void ProcessAnswer(Answer answer) { QuizzerStrategyContext strategyContext = new QuizzerStrategyContext(); strategyContext.SetContext(answer.GetAnswerType()); string correspondingSymptom = answer.GetCorrespondingSympton(); IList <QuSignature> removedSignatures = new List <QuSignature>(); foreach (var signature in symptomToSignatures[correspondingSymptom]) { if (!strategyContext.GetStrategy().ApplyAnswerToSignature(signature, correspondingSymptom, answer)) { double percentage = (double)signature.currentScore / (double)signature.initialScore; if (percentage < minValidPercentage) { removedSignatures.Add(signature); } } } foreach (QuSignature signature in removedSignatures) { foreach (var symptom in signature.symptoms) { symptomToSignatures[symptom.Key].Remove(signature); } signatures.Remove(signature); } }
public Question(string symptomName, string questionText, Answer.QUESTION_TYPE questionType) { QuizzerStrategyContext quizzerStrategyContext = new QuizzerStrategyContext(); quizzerStrategyContext.SetContext(questionType); this.questionText = questionText; this.questionType = questionType; this.correspondingSymptom = symptomName; }