From b0df2782d8d2ff8a0b9190485ecf92555a672d07 Mon Sep 17 00:00:00 2001 From: Remy9926 <95456114+Remy9926@users.noreply.github.com> Date: Fri, 3 Nov 2023 19:52:23 +0800 Subject: [PATCH] Fix checkstyle errors (#32) --- src/main/java/seedu/duke/parser/Parser.java | 102 ++++++++++---------- 1 file changed, 49 insertions(+), 53 deletions(-) diff --git a/src/main/java/seedu/duke/parser/Parser.java b/src/main/java/seedu/duke/parser/Parser.java index c30caec5d5..2d02fbfafe 100644 --- a/src/main/java/seedu/duke/parser/Parser.java +++ b/src/main/java/seedu/duke/parser/Parser.java @@ -19,13 +19,10 @@ import seedu.duke.commands.logcommands.DeleteLogCommand; import seedu.duke.commands.logcommands.ViewLogCommand; import seedu.duke.commands.logcommands.UpdateLogCommand; -import seedu.duke.commands.meal.MealCommand; import seedu.duke.data.exception.IllegalValueException; -import seedu.duke.commands.meal.*; +import seedu.duke.commands.meal.AddCommand; + -/** - * Parses user input. - */ public class Parser { public static final Pattern PERSON_INDEX_ARGS_FORMAT = Pattern.compile("(?.+)"); @@ -56,56 +53,55 @@ public Command parseCommand(String userInput) throws Exception { switch (commandWord) { - // case AddCommand.COMMAND_WORD: - // return prepareAdd(arguments); - // - // case DeleteCommand.COMMAND_WORD: - // return prepareDelete(arguments); - // - // case ClearCommand.COMMAND_WORD: - // return new ClearCommand(); - // - // case FindCommand.COMMAND_WORD: - // return prepareFind(arguments); - // - // case ListCommand.COMMAND_WORD: - // return new ListCommand(); - // - // case ViewCommand.COMMAND_WORD: - // return prepareView(arguments); - // - // case ViewAllCommand.COMMAND_WORD: - // return prepareViewAll(arguments); - // - - case LogCommand.COMMAND_WORD: - return new LogCommand(Arrays.asList(arguments.trim().split(" "))); - - case DeleteLogCommand.COMMAND_WORD: - return new DeleteLogCommand(Arrays.asList(arguments.trim().split(" "))); - - case ViewLogCommand.COMMAND_WORD: - return new ViewLogCommand(Arrays.asList(arguments.trim().split(" "))); - - case UpdateLogCommand.COMMAND_WORD: - return new UpdateLogCommand(Arrays.asList(arguments.trim().split(" "))); - - case seedu.duke.commands.meal.AddCommand.COMMAND_WORD: - return new AddCommand(Arrays.asList(arguments.trim().split(" "))); - - case GoalCommand.COMMAND_WORD: - return new GoalCommand(userInput); - - case ExitCommand.COMMAND_WORD: - return new ExitCommand(); - - case HelpCommand.COMMAND_WORD: // Fallthrough - - default: - return new HelpCommand(); + // case AddCommand.COMMAND_WORD: + // return prepareAdd(arguments); + // + // case DeleteCommand.COMMAND_WORD: + // return prepareDelete(arguments); + // + // case ClearCommand.COMMAND_WORD: + // return new ClearCommand(); + // + // case FindCommand.COMMAND_WORD: + // return prepareFind(arguments); + // + // case ListCommand.COMMAND_WORD: + // return new ListCommand(); + // + // case ViewCommand.COMMAND_WORD: + // return prepareView(arguments); + // + // case ViewAllCommand.COMMAND_WORD: + // return prepareViewAll(arguments); + // + + case LogCommand.COMMAND_WORD: + return new LogCommand(Arrays.asList(arguments.trim().split(" "))); + + case DeleteLogCommand.COMMAND_WORD: + return new DeleteLogCommand(Arrays.asList(arguments.trim().split(" "))); + + case ViewLogCommand.COMMAND_WORD: + return new ViewLogCommand(Arrays.asList(arguments.trim().split(" "))); + + case UpdateLogCommand.COMMAND_WORD: + return new UpdateLogCommand(Arrays.asList(arguments.trim().split(" "))); + + case seedu.duke.commands.meal.AddCommand.COMMAND_WORD: + return new AddCommand(Arrays.asList(arguments.trim().split(" "))); + + case GoalCommand.COMMAND_WORD: + return new GoalCommand(userInput); + + case ExitCommand.COMMAND_WORD: + return new ExitCommand(); + + case HelpCommand.COMMAND_WORD: // Fallthrough + + default: + return new HelpCommand(); } } - // /** // * Parses arguments in the context of the add person command. // *