src/main/java/seedu/address/logic/parser/AddressBookParser.java
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 SelectCommand.COMMAND_WORD:
            return new SelectCommandParser().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 HistoryCommand.COMMAND_WORD:
            return new HistoryCommand();

        case ExitCommand.COMMAND_WORD:
            return new ExitCommand();

        case HelpCommand.COMMAND_WORD:
            return new HelpCommand();

        case UndoCommand.COMMAND_WORD:
            return new UndoCommand();

        case RedoCommand.COMMAND_WORD:
            return new RedoCommand();

        case ImportCommand.COMMAND_WORD:
            return new ImportCommandParser().parse(arguments);

        case TabCommand.COMMAND_WORD:
            return new TabCommandParser().parse(arguments);

        default:
            throw new ParseException(MESSAGE_UNKNOWN_COMMAND);
        }
    }
/**
     * 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 SelectCommand.COMMAND_WORD:
            return new SelectCommandParser().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 HistoryCommand.COMMAND_WORD:
            return new HistoryCommand();
        case ExitCommand.COMMAND_WORD:
            return new ExitCommand();
        case HelpCommand.COMMAND_WORD:
            return new HelpCommand();
        case UndoCommand.COMMAND_WORD:
            return new UndoCommand();
        case RedoCommand.COMMAND_WORD:
            return new RedoCommand();
        case ImportCommand.COMMAND_WORD:
            return new ImportCommandParser().parse(arguments);
        case TabCommand.COMMAND_WORD:
            return new TabCommandParser().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 SelectCommand . COMMAND_WORD : return new SelectCommandParser ( ) . 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 HistoryCommand . COMMAND_WORD : return new HistoryCommand ( ) ; case ExitCommand . COMMAND_WORD : return new ExitCommand ( ) ; case HelpCommand . COMMAND_WORD : return new HelpCommand ( ) ; case UndoCommand . COMMAND_WORD : return new UndoCommand ( ) ; case RedoCommand . COMMAND_WORD : return new RedoCommand ( ) ; case ImportCommand . COMMAND_WORD : return new ImportCommandParser ( ) . parse ( arguments ) ; case TabCommand . COMMAND_WORD : return new TabCommandParser ( ) . parse ( arguments ) ; default : throw new ParseException ( MESSAGE_UNKNOWN_COMMAND ) ; } }
Parses user input into command for execution.
Parses user input into command for execution .