public void setDifficulty(TypeDifficultyKnownValues new_value)
    {
        TypeDifficulty new_full_value = new TypeDifficulty();

        Debug.Assert(new_value != TypeDifficultyKnownValues.Difficulty__none);
        new_full_value.in_known_list = true;
        new_full_value.list_value    = new_value;
        setDifficulty(new_full_value);
    }
    public string  getDifficultyAsString()
    {
        TypeDifficulty result = getDifficulty();

        if (result.in_known_list)
        {
            return(stringFromDifficulty(result.list_value));
        }
        else
        {
            return(result.string_value);
        }
    }
            protected override void handle_result(string result)
            {
                TypeDifficultyKnownValues known     = stringToDifficulty(result);
                TypeDifficulty            new_value = new TypeDifficulty();

                if (known == TypeDifficultyKnownValues.Difficulty__none)
                {
                    new_value.in_known_list = false;
                    new_value.string_value  = result;
                }
                else
                {
                    new_value.in_known_list = true;
                    new_value.list_value    = known;
                }
                handle_result(new_value);
            }
    public void setDifficulty(string chars)
    {
        TypeDifficultyKnownValues known     = stringToDifficulty(chars);
        TypeDifficulty            new_value = new TypeDifficulty();

        if (known == TypeDifficultyKnownValues.Difficulty__none)
        {
            new_value.in_known_list = false;
            new_value.string_value  = chars;
        }
        else
        {
            new_value.in_known_list = true;
            new_value.list_value    = known;
        }
        setDifficulty(new_value);
    }
    private void  fromJSONDifficulty(JSONValue json_value, bool ignore_extras)
    {
        Debug.Assert(json_value != null);
        JSONStringValue json_string = json_value.string_value();

        if (json_string == null)
        {
            throw new Exception("The value for field Difficulty of NumberGuessQuitGameInformationNuggetJSON is not a string.");
        }
        TypeDifficulty the_open_enum = new TypeDifficulty();

        switch (json_string.getData()[0])
        {
        case 'E':
            if ((String.Compare(json_string.getData(), 1, "asy", 0, 3, false) == 0) && (json_string.getData().Length == 4))
            {
                the_open_enum.in_known_list = true;
                the_open_enum.list_value    = TypeDifficultyKnownValues.Difficulty_Easy;
                goto open_enum_is_done;
            }
            break;

        case 'H':
            if ((String.Compare(json_string.getData(), 1, "ard", 0, 3, false) == 0) && (json_string.getData().Length == 4))
            {
                the_open_enum.in_known_list = true;
                the_open_enum.list_value    = TypeDifficultyKnownValues.Difficulty_Hard;
                goto open_enum_is_done;
            }
            break;

        default:
            break;
        }
        the_open_enum.in_known_list = false;
        the_open_enum.string_value  = json_string.getData();
        open_enum_is_done :;
        setDifficulty(the_open_enum);
    }
 protected override void handle_result(TypeDifficulty result)
 {
     top.value.Add(result);
 }
            protected override void handle_result(TypeDifficulty result)
            {
//@@@        Debug.Assert(!have_value);
                have_value = true;
                value      = result;
            }
 protected abstract void handle_result(TypeDifficulty result);
 public void setDifficulty(TypeDifficulty new_value)
 {
     flagHasDifficulty = true;
     storeDifficulty   = new_value;
 }