Exemplo n.º 1
0
        protected override void finish()
        {
            if (!(keyGenerator.have_value))
            {
                throw new Exception("The `RobotIntentKind' field is missing.");
            }
            if (!(getCommandIntentJSONKey().Equals("Robot")))
            {
                throw new Exception("The key field has a value other than `Robot'.");
            }
            RobotCommandIntentJSON result = createForKey(keyGenerator.value, unknownFieldGenerator.index);

            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.extraRobotCommandIntentAppendPair(unknownFieldGenerator.field_names[extra_num], unknownFieldGenerator.field_values[extra_num]);
            }
            unknownFieldGenerator.field_names.Clear();
            unknownFieldGenerator.field_values.Clear();
            unknownFieldGenerator.index = new Dictionary <string, JSONValue>();
            if (!allow_incomplete)
            {
                string missing_field_error = result.missing_field_error(allow_unpolished);
                if (missing_field_error != null)
                {
                    error(missing_field_error);
                }
            }
            handle_result(result);
        }
    public static CommandIntentJSON createForKey(string key, Dictionary <string, JSONValue> other_field_index)
    {
        switch (key[0])
        {
        case 'I':
            if ((String.Compare(key, 1, "nformation", 0, 10, false) == 0) && (key.Length == 11))
            {
                return(new InformationIntentJSON());
            }
            break;

        case 'R':
            switch (key[1])
            {
            case 'a':
                if ((String.Compare(key, 2, "dio", 0, 3, false) == 0) && (key.Length == 5))
                {
                    JSONValue key_value = ((other_field_index == null) ? null : (other_field_index.ContainsKey("RadioIntentKind") ? other_field_index["RadioIntentKind"] : null));
                    if (key_value == null)
                    {
                        throw new Exception("The `RadioIntentKind' field is missing.");
                    }
                    JSONStringValue key_string_value = key_value.string_value();
                    if (key_string_value == null)
                    {
                        throw new Exception("The `RadioIntentKind' field has a non-string value.");
                    }
                    return(RadioCommandIntentJSON.createForKey(key_string_value.getData(), other_field_index));
                }
                break;

            case 'o':
                if ((String.Compare(key, 2, "bot", 0, 3, false) == 0) && (key.Length == 5))
                {
                    JSONValue key_value = ((other_field_index == null) ? null : (other_field_index.ContainsKey("RobotIntentKind") ? other_field_index["RobotIntentKind"] : null));
                    if (key_value == null)
                    {
                        throw new Exception("The `RobotIntentKind' field is missing.");
                    }
                    JSONStringValue key_string_value = key_value.string_value();
                    if (key_string_value == null)
                    {
                        throw new Exception("The `RobotIntentKind' field has a non-string value.");
                    }
                    return(RobotCommandIntentJSON.createForKey(key_string_value.getData(), other_field_index));
                }
                break;

            default:
                break;
            }
            break;

        default:
            break;
        }

        return(new GenericCommandIntentJSON(key));
    }
Exemplo n.º 3
0
 protected override void handle_result(RobotCommandIntentJSON new_result)
 {
     handle_result((RobotSetKnownRoomsCommandIntentJSON )new_result);
 }
Exemplo n.º 4
0
 protected override void handle_result(RobotCommandIntentJSON new_result)
 {
     handle_result((RobotStopCommandIntentJSON )new_result);
 }
Exemplo n.º 5
0
 protected override void handle_result(RobotCommandIntentJSON new_result)
 {
     handle_result((RobotListCapabilitiesCommandIntentJSON )new_result);
 }
Exemplo n.º 6
0
 protected override void handle_result(RobotCommandIntentJSON new_result)
 {
     handle_result((RobotTakePictureCommandIntentJSON )new_result);
 }
Exemplo n.º 7
0
 protected override void handle_result(RobotCommandIntentJSON result)
 {
     top.value.Add(result);
 }
Exemplo n.º 8
0
        protected override void handle_result(RobotCommandIntentJSON result)
        {
//@@@            Debug.Assert(!have_value);
            have_value = true;
            value      = result;
        }
Exemplo n.º 9
0
 protected abstract void handle_result(RobotCommandIntentJSON new_result);
Exemplo n.º 10
0
 protected void finish(RobotCommandIntentJSON result)
 {
     base.finish(result);
 }