예제 #1
0
        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);
            }
        }
예제 #2
0
        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;
        }