diff --git a/src/main/java/seedu/duke/Duke.java b/src/main/java/seedu/duke/Duke.java index c0c881397b..7ed8c50418 100644 --- a/src/main/java/seedu/duke/Duke.java +++ b/src/main/java/seedu/duke/Duke.java @@ -3,10 +3,13 @@ import seedu.duke.commands.Command; import seedu.duke.commands.CommandResult; import seedu.duke.commands.ExitCommand; +import seedu.duke.commands.meal.MealCommand; import seedu.duke.data.GoalList; +import seedu.duke.data.meal.Meal; import seedu.duke.parser.Parser; import seedu.duke.exerciselog.Log; import seedu.duke.ui.TextUi; +import java.util.ArrayList; /** * Entry point of the Address Book application. @@ -21,6 +24,7 @@ public class Duke { public static GoalList goals = new GoalList(); public static Log exerciseLog = new Log(); private TextUi ui; + static ArrayList meals = new ArrayList(); // private StorageFile storage; public static void main(String... launchArgs) { @@ -48,7 +52,7 @@ private void start(String[] launchArgs) { this.ui = new TextUi(); // this.storage = initializeStorage(launchArgs); ui.showWelcomeMessage(VERSION, "storage.getPath()"); - + MealCommand.setMeals(meals); } catch (Exception e) { // TODO: change to specific storage exceptions later ui.showInitFailedMessage(); throw new RuntimeException(e); diff --git a/src/main/java/seedu/duke/data/meal/Meal.java b/src/main/java/seedu/duke/data/meal/Meal.java index ea23907734..af42df0513 100644 --- a/src/main/java/seedu/duke/data/meal/Meal.java +++ b/src/main/java/seedu/duke/data/meal/Meal.java @@ -7,11 +7,11 @@ public class Meal { public String name; public int calories; - public DateTime time; + // public DateTime time; public Meal(String name, int calories) throws Exception { this.name = name; this.calories = calories; - this.time = new DateTime(LocalDateTime.now().toString()); + // this.time = new DateTime(LocalDateTime.now().toString()); } } diff --git a/src/main/java/seedu/duke/parser/Parser.java b/src/main/java/seedu/duke/parser/Parser.java index 7799975d34..04e1d05ead 100644 --- a/src/main/java/seedu/duke/parser/Parser.java +++ b/src/main/java/seedu/duke/parser/Parser.java @@ -18,6 +18,7 @@ import seedu.duke.commands.logcommands.LogCommand; import seedu.duke.commands.logcommands.DeleteLogCommand; import seedu.duke.commands.logcommands.ViewLogCommand; +import seedu.duke.commands.meal.MealCommand; import seedu.duke.data.exception.IllegalValueException; /** @@ -52,47 +53,50 @@ public Command parseCommand(String userInput) { 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 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 MealCommand.COMMAND_WORD: + return new MealCommand(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(); } }