Example #1
0
 protected void finish(QuestionJSON result)
 {
     if (fieldGeneratorQuestion.have_value)
     {
         result.setQuestion(fieldGeneratorQuestion.value);
         fieldGeneratorQuestion.have_value = false;
     }
     else if ((!(result.hasQuestion())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"Question\" field was missing.");
     }
 }
Example #2
0
        private QuestionTopFive ConvertToQuestionTopFive(QuestionJSON input)
        {
            QuestionTopFive output;
            var             question     = input.Question;
            var             reverseLogic = input.ReverseLogic;

            QuestionTopFive.PersonalityTrait personalityTrait;

            switch (input.PersonalityTrait)
            {
            case "Extraversion":
                personalityTrait = QuestionTopFive.PersonalityTrait.Extraversion;
                break;

            case "Agreeableness":
                personalityTrait = QuestionTopFive.PersonalityTrait.Agreeableness;
                break;

            case "Conscientiousness":
                personalityTrait = QuestionTopFive.PersonalityTrait.Conscientiousness;
                break;

            case "Neuroticism":
                personalityTrait = QuestionTopFive.PersonalityTrait.Neuroticism;
                break;

            case "Openness":
                personalityTrait = QuestionTopFive.PersonalityTrait.Openness;
                break;

            default:
                personalityTrait = QuestionTopFive.PersonalityTrait.Extraversion;
                break;
            }

            if ((input.Answer1 == "") && (input.Answer2 == "") && (input.Answer3 == "") && (input.Answer4 == "") && (input.Answer5 == ""))
            {
                output = new QuestionTopFive(question, personalityTrait, reverseLogic);
            }
            else
            {
                output = new QuestionTopFive(question, personalityTrait, input.Answer1, input.Answer2, input.Answer3, input.Answer4, input.Answer5, reverseLogic);
            }

            return(output);
        }
Example #3
0
        protected override void finish()
        {
            QuestionJSON result = new QuestionJSON();

            Debug.Assert(result != null);
            finish(result);
            int extra_count = unknownFieldGenerator.field_names.Count;

            Debug.Assert(extra_count == unknownFieldGenerator.field_values.Count);
            for (int extra_num = 0; extra_num < extra_count; ++extra_num)
            {
                result.extraQuestionAppendPair(unknownFieldGenerator.field_names[extra_num], unknownFieldGenerator.field_values[extra_num]);
            }
            unknownFieldGenerator.field_names.Clear();
            unknownFieldGenerator.field_values.Clear();
            unknownFieldGenerator.index = new Dictionary <string, JSONValue>();
            handle_result(result);
        }
Example #4
0
 protected override void handle_result(QuestionJSON result)
 {
     top.value.Add(result);
 }
Example #5
0
        protected override void handle_result(QuestionJSON result)
        {
//@@@            Debug.Assert(!have_value);
            have_value = true;
            value      = result;
        }
Example #6
0
 protected abstract void handle_result(QuestionJSON new_result);