From 1a6b31290991ee23d5f7564a2959606487737707 Mon Sep 17 00:00:00 2001 From: Clement Foo Date: Sun, 23 Oct 2022 00:27:36 +0800 Subject: [PATCH] Change PlanCommand to SelectCommand --- .../{PlanCommand.java => SelectCommand.java} | 16 ++++++++-------- .../waddle/logic/parser/PlanCommandParser.java | 8 ++++---- .../seedu/waddle/logic/parser/WaddleParser.java | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) rename src/main/java/seedu/waddle/logic/commands/{PlanCommand.java => SelectCommand.java} (82%) diff --git a/src/main/java/seedu/waddle/logic/commands/PlanCommand.java b/src/main/java/seedu/waddle/logic/commands/SelectCommand.java similarity index 82% rename from src/main/java/seedu/waddle/logic/commands/PlanCommand.java rename to src/main/java/seedu/waddle/logic/commands/SelectCommand.java index 844f3800347..df07acb0f19 100644 --- a/src/main/java/seedu/waddle/logic/commands/PlanCommand.java +++ b/src/main/java/seedu/waddle/logic/commands/SelectCommand.java @@ -13,21 +13,21 @@ /** * Changes the remark of an existing person in the address book. */ -public class PlanCommand extends Command { - public static final String COMMAND_WORD = "plan"; +public class SelectCommand extends Command { + public static final String COMMAND_WORD = "select"; public static final String MESSAGE_USAGE = COMMAND_WORD + ": selects an itinerary for planning " + "by the index number used in the last itineraries listing.\n" + "Parameters: INDEX (must be a positive integer) " + "Example: " + COMMAND_WORD + " 1 "; public static final String MESSAGE_ARGUMENTS = "Index: %1$d"; - public static final String MESSAGE_PLAN_ITINERARY_SUCCESS = "Planning Itinerary: %1$s"; + public static final String MESSAGE_SELECT_ITINERARY_SUCCESS = "Selected Itinerary: %1$s"; private final Index index; /** - * @param index of the itinerary to plan + * @param index of the itinerary to select */ - public PlanCommand(Index index) { + public SelectCommand(Index index) { requireAllNonNull(index); this.index = index; @@ -55,7 +55,7 @@ public CommandResult execute(Model model) throws CommandException { // instead of going to wish stage by default // return command result with stage change to wish by default for now (refer above) - return new CommandResult(String.format(MESSAGE_PLAN_ITINERARY_SUCCESS, selectedItinerary.getName()), + return new CommandResult(String.format(MESSAGE_SELECT_ITINERARY_SUCCESS, selectedItinerary.getName()), Stages.WISH); } @@ -67,12 +67,12 @@ public boolean equals(Object other) { } // instanceof handles nulls - if (!(other instanceof PlanCommand)) { + if (!(other instanceof SelectCommand)) { return false; } // state check - PlanCommand e = (PlanCommand) other; + SelectCommand e = (SelectCommand) other; return index.equals(e.index); } } diff --git a/src/main/java/seedu/waddle/logic/parser/PlanCommandParser.java b/src/main/java/seedu/waddle/logic/parser/PlanCommandParser.java index 545038f7f51..38a0b6bb55d 100644 --- a/src/main/java/seedu/waddle/logic/parser/PlanCommandParser.java +++ b/src/main/java/seedu/waddle/logic/parser/PlanCommandParser.java @@ -5,7 +5,7 @@ import seedu.waddle.commons.core.index.Index; import seedu.waddle.commons.exceptions.IllegalValueException; -import seedu.waddle.logic.commands.PlanCommand; +import seedu.waddle.logic.commands.SelectCommand; import seedu.waddle.logic.parser.exceptions.ParseException; /** @@ -20,7 +20,7 @@ public class PlanCommandParser { * @return PlanCommand. * @throws ParseException If the user input does not conform the expected format. */ - public PlanCommand parse(String args) throws ParseException { + public SelectCommand parse(String args) throws ParseException { requireNonNull(args); ArgumentMultimap argMultimap = ArgumentTokenizer.tokenize(args); @@ -29,10 +29,10 @@ public PlanCommand parse(String args) throws ParseException { index = ParserUtil.parseIndex(argMultimap.getPreamble()); } catch (IllegalValueException ive) { throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, - PlanCommand.MESSAGE_USAGE), ive); + SelectCommand.MESSAGE_USAGE), ive); } - return new PlanCommand(index); + return new SelectCommand(index); } } diff --git a/src/main/java/seedu/waddle/logic/parser/WaddleParser.java b/src/main/java/seedu/waddle/logic/parser/WaddleParser.java index 7208e33434d..ba53530339e 100644 --- a/src/main/java/seedu/waddle/logic/parser/WaddleParser.java +++ b/src/main/java/seedu/waddle/logic/parser/WaddleParser.java @@ -22,7 +22,7 @@ import seedu.waddle.logic.commands.HelpCommand; import seedu.waddle.logic.commands.HomeCommand; import seedu.waddle.logic.commands.ListCommand; -import seedu.waddle.logic.commands.PlanCommand; +import seedu.waddle.logic.commands.SelectCommand; import seedu.waddle.logic.commands.StageCommand; import seedu.waddle.logic.parser.exceptions.ParseException; @@ -95,7 +95,7 @@ public Command parseHomeCommand(String commandWord, String arguments) throws Par case ListCommand.COMMAND_WORD: return new ListCommand(); - case PlanCommand.COMMAND_WORD: + case SelectCommand.COMMAND_WORD: return new PlanCommandParser().parse(arguments); case HomeCommand.COMMAND_WORD: