Skip to content

Commit 56bb0d1

Browse files
authored
Merge pull request nus-cs2103-AY2223S1#80 from CFSY/select-command
Select command
2 parents 515dfa2 + 8a99dfa commit 56bb0d1

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

src/main/java/seedu/waddle/logic/commands/PlanCommand.java renamed to src/main/java/seedu/waddle/logic/commands/SelectCommand.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@
1313
/**
1414
* Changes the remark of an existing person in the address book.
1515
*/
16-
public class PlanCommand extends Command {
17-
public static final String COMMAND_WORD = "plan";
16+
public class SelectCommand extends Command {
17+
public static final String COMMAND_WORD = "select";
1818
public static final String MESSAGE_USAGE = COMMAND_WORD
1919
+ ": selects an itinerary for planning "
2020
+ "by the index number used in the last itineraries listing.\n"
2121
+ "Parameters: INDEX (must be a positive integer) "
2222
+ "Example: " + COMMAND_WORD + " 1 ";
2323
public static final String MESSAGE_ARGUMENTS = "Index: %1$d";
24-
public static final String MESSAGE_PLAN_ITINERARY_SUCCESS = "Planning Itinerary: %1$s";
24+
public static final String MESSAGE_SELECT_ITINERARY_SUCCESS = "Selected Itinerary: %1$s";
2525
private final Index index;
2626

2727
/**
28-
* @param index of the itinerary to plan
28+
* @param index of the itinerary to select
2929
*/
30-
public PlanCommand(Index index) {
30+
public SelectCommand(Index index) {
3131
requireAllNonNull(index);
3232

3333
this.index = index;
@@ -55,7 +55,7 @@ public CommandResult execute(Model model) throws CommandException {
5555
// instead of going to wish stage by default
5656

5757
// return command result with stage change to wish by default for now (refer above)
58-
return new CommandResult(String.format(MESSAGE_PLAN_ITINERARY_SUCCESS, selectedItinerary.getName()),
58+
return new CommandResult(String.format(MESSAGE_SELECT_ITINERARY_SUCCESS, selectedItinerary.getName()),
5959
Stages.WISH);
6060
}
6161

@@ -67,12 +67,12 @@ public boolean equals(Object other) {
6767
}
6868

6969
// instanceof handles nulls
70-
if (!(other instanceof PlanCommand)) {
70+
if (!(other instanceof SelectCommand)) {
7171
return false;
7272
}
7373

7474
// state check
75-
PlanCommand e = (PlanCommand) other;
75+
SelectCommand e = (SelectCommand) other;
7676
return index.equals(e.index);
7777
}
7878
}

src/main/java/seedu/waddle/logic/parser/PlanCommandParser.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import seedu.waddle.commons.core.index.Index;
77
import seedu.waddle.commons.exceptions.IllegalValueException;
8-
import seedu.waddle.logic.commands.PlanCommand;
8+
import seedu.waddle.logic.commands.SelectCommand;
99
import seedu.waddle.logic.parser.exceptions.ParseException;
1010

1111
/**
@@ -20,7 +20,7 @@ public class PlanCommandParser {
2020
* @return PlanCommand.
2121
* @throws ParseException If the user input does not conform the expected format.
2222
*/
23-
public PlanCommand parse(String args) throws ParseException {
23+
public SelectCommand parse(String args) throws ParseException {
2424
requireNonNull(args);
2525
ArgumentMultimap argMultimap = ArgumentTokenizer.tokenize(args);
2626

@@ -29,10 +29,10 @@ public PlanCommand parse(String args) throws ParseException {
2929
index = ParserUtil.parseIndex(argMultimap.getPreamble());
3030
} catch (IllegalValueException ive) {
3131
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT,
32-
PlanCommand.MESSAGE_USAGE), ive);
32+
SelectCommand.MESSAGE_USAGE), ive);
3333
}
3434

35-
return new PlanCommand(index);
35+
return new SelectCommand(index);
3636
}
3737
}
3838

src/main/java/seedu/waddle/logic/parser/WaddleParser.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import seedu.waddle.logic.commands.HelpCommand;
2323
import seedu.waddle.logic.commands.HomeCommand;
2424
import seedu.waddle.logic.commands.ListCommand;
25-
import seedu.waddle.logic.commands.PlanCommand;
25+
import seedu.waddle.logic.commands.SelectCommand;
2626
import seedu.waddle.logic.commands.StageCommand;
2727
import seedu.waddle.logic.parser.exceptions.ParseException;
2828

@@ -95,7 +95,7 @@ public Command parseHomeCommand(String commandWord, String arguments) throws Par
9595
case ListCommand.COMMAND_WORD:
9696
return new ListCommand();
9797

98-
case PlanCommand.COMMAND_WORD:
98+
case SelectCommand.COMMAND_WORD:
9999
return new PlanCommandParser().parse(arguments);
100100

101101
case HomeCommand.COMMAND_WORD:

src/main/resources/view/ItineraryListCard.fxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
</HBox>
3030
<Label fx:id="country" styleClass="cell_small_label" text="\$country" />
3131
<Label fx:id="startDate" styleClass="cell_small_label" text="\$startDate" />
32-
<Label fx:id="endDate" styleClass="cell_small_label" text="\$endDate" />
32+
<Label fx:id="duration" styleClass="cell_small_label" text="\$duration" />
3333
<Label fx:id="people" styleClass="cell_small_label" text="\$people" />
3434
</VBox>
3535
</GridPane>

0 commit comments

Comments
 (0)