src/main/java/seedu/address/logic/parser/MyFitnessBuddyParser.java
/**
     * Parses user input into command for execution.
     *
     * @param userInput full user input string
     * @return the command based on the user input
     * @throws ParseException if the user input does not conform the expected format
     */
Parses user input into command for execution.
@param userInput full user input string
@return the command based on the user input
@throws ParseException if the user input does not conform the expected format
Parses user input into command for execution . @param userInput full user input string @return the command based on the user input @throws ParseException if the user input does not conform the expected format
public Command parseCommand(String userInput) throws ParseException {
        final Matcher matcher = BASIC_COMMAND_FORMAT.matcher(userInput.trim());
        if (!matcher.matches()) {
            throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, HelpCommand.MESSAGE_USAGE));
        }
        final String commandWord = matcher.group("commandWord");
        final String arguments = matcher.group("arguments");
        switch (commandWord) {
        case AddCommand.COMMAND_WORD:
            return new AddCommandParser().parse(arguments);
        case EditCommand.COMMAND_WORD:
            return new EditCommandParser().parse(arguments);
        case DeleteCommand.COMMAND_WORD:
            return new DeleteCommandParser().parse(arguments);
        case ClearCommand.COMMAND_WORD:
            return new ClearCommand();
        case FindCommand.COMMAND_WORD:
            return new FindCommandParser().parse(arguments);
        case ListCommand.COMMAND_WORD:
            return new ListCommand();
        case ExitCommand.COMMAND_WORD:
            return new ExitCommand();
        case HelpCommand.COMMAND_WORD:
            return new HelpCommand();
        case CreateCommand.COMMAND_WORD:
            return new CreateCommandParser().parse(arguments);
        case CalorieCommand.COMMAND_WORD:
            return new CalorieCommandParser().parse(arguments);
        case StatsCommand.COMMAND_WORD:
            return new StatsCommandParser().parse(arguments);
        case RemoveCommand.COMMAND_WORD:
            return new RemoveCommandParser().parse(arguments);
        case ChangeCommand.COMMAND_WORD:
            return new ChangeCommandParser().parse(arguments);
        case UpdateCommand.COMMAND_WORD:
            return new UpdateCommandParser().parse(arguments);
        case LoginCommand.COMMAND_WORD:
            return new LoginCommandParser().parse(arguments);
        case ViewCommand.COMMAND_WORD:
            return new ViewCommandParser().parse(arguments);
        default:
            throw new ParseException(MESSAGE_UNKNOWN_COMMAND);
        }
    }
public Command parseCommand ( String userInput ) throws ParseException { final Matcher matcher = BASIC_COMMAND_FORMAT . matcher ( userInput . trim ( ) ) ; if ( ! matcher . matches ( ) ) { throw new ParseException ( String . format ( MESSAGE_INVALID_COMMAND_FORMAT , HelpCommand . MESSAGE_USAGE ) ) ; } final String commandWord = matcher . group ( "commandWord" ) ; final String arguments = matcher . group ( "arguments" ) ; switch ( commandWord ) { case AddCommand . COMMAND_WORD : return new AddCommandParser ( ) . parse ( arguments ) ; case EditCommand . COMMAND_WORD : return new EditCommandParser ( ) . parse ( arguments ) ; case DeleteCommand . COMMAND_WORD : return new DeleteCommandParser ( ) . parse ( arguments ) ; case ClearCommand . COMMAND_WORD : return new ClearCommand ( ) ; case FindCommand . COMMAND_WORD : return new FindCommandParser ( ) . parse ( arguments ) ; case ListCommand . COMMAND_WORD : return new ListCommand ( ) ; case ExitCommand . COMMAND_WORD : return new ExitCommand ( ) ; case HelpCommand . COMMAND_WORD : return new HelpCommand ( ) ; case CreateCommand . COMMAND_WORD : return new CreateCommandParser ( ) . parse ( arguments ) ; case CalorieCommand . COMMAND_WORD : return new CalorieCommandParser ( ) . parse ( arguments ) ; case StatsCommand . COMMAND_WORD : return new StatsCommandParser ( ) . parse ( arguments ) ; case RemoveCommand . COMMAND_WORD : return new RemoveCommandParser ( ) . parse ( arguments ) ; case ChangeCommand . COMMAND_WORD : return new ChangeCommandParser ( ) . parse ( arguments ) ; case UpdateCommand . COMMAND_WORD : return new UpdateCommandParser ( ) . parse ( arguments ) ; case LoginCommand . COMMAND_WORD : return new LoginCommandParser ( ) . parse ( arguments ) ; case ViewCommand . COMMAND_WORD : return new ViewCommandParser ( ) . parse ( arguments ) ; default : throw new ParseException ( MESSAGE_UNKNOWN_COMMAND ) ; } }
Parses user input into command for execution.
Parses user input into command for execution .