Skip to content

Commit

Permalink
Merge pull request #110 from pjanthony2001/109-bug-fix-undo-redo
Browse files Browse the repository at this point in the history
Fix Bugs
  • Loading branch information
Rishit02 authored Apr 4, 2024
2 parents af3ed99 + 58763b3 commit 1418265
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
20 changes: 10 additions & 10 deletions src/main/java/seedu/address/logic/commands/FindCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,15 @@ public FindCommand(NameContainsKeywordsPredicate namePredicate, PhoneContainsKey
AddressContainsKeywordsPredicate addressPredicate, EmailContainsKeywordsPredicate emailPredicate,
TagContainsKeywordsPredicate tagPredicate, KinContainsKeywordsPredicate kinPredicate,
DescriptionContainsKeywordsPredicate descriptionPredicate) {
assert namePredicate != null;
assert phonePredicate != null;
assert addressPredicate != null;
assert emailPredicate != null;
assert tagPredicate != null;
assert kinPredicate != null;
assert descriptionPredicate != null;
super.setReversible(true);
requireNonNull(namePredicate);
requireNonNull(namePredicate);
requireNonNull(phonePredicate);
requireNonNull(addressPredicate);
requireNonNull(emailPredicate);
requireNonNull(tagPredicate);
requireNonNull(kinPredicate);
requireNonNull(descriptionPredicate);
predicates = Arrays.asList(namePredicate, phonePredicate, addressPredicate,
emailPredicate, tagPredicate, kinPredicate, descriptionPredicate);
}
Expand All @@ -70,9 +72,7 @@ public CommandResult execute(Model model) {
requireNonNull(model);

Optional<Predicate<Person>> combinedPredicate = predicates.stream().reduce(Predicate::or);
if (combinedPredicate.isPresent()) {
model.updateFilteredPersonList(combinedPredicate.get());
}
combinedPredicate.ifPresent(model::updateFilteredPersonList);
return new CommandResult(
String.format(Messages.MESSAGE_PERSONS_LISTED_OVERVIEW, model.getFilteredPersonList().size()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ public String toString() {
*/
@Override
public String getCommandString() {
return COMMAND_WORD;
return "schedule " + COMMAND_WORD;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class ScheduleDeleteCommand extends ScheduleCommand {
public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": Deletes the event identified by its heading from the schedule.\n"
+ "Parameters: h/HEADING\n"
+ "Example: schedule " + COMMAND_WORD + " " + PREFIX_HEADING + " Meeting with Client";
+ "Example: schedule " + COMMAND_WORD + " " + PREFIX_HEADING + "Meeting with Client";
public static final String MESSAGE_DELETE_EVENT_SUCCESS = "Deleted Event: %1$s";

private final Heading heading;
Expand Down Expand Up @@ -98,6 +98,6 @@ public String toString() {
*/
@Override
public String getCommandString() {
return COMMAND_WORD;
return "schedule " + COMMAND_WORD;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void toStringMethod() {
@Test
public void getCommandStringTest() {
ScheduleAddCommand scheduleAddCommand = new ScheduleAddCommand(MEETING_WITH_ALICE);
String expected = ScheduleAddCommand.COMMAND_WORD;
String expected = "schedule " + ScheduleAddCommand.COMMAND_WORD;
assertEquals(expected, scheduleAddCommand.getCommandString());
}
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void equals() {
@Test
public void getCommandStringTest() {
ScheduleDeleteCommand deleteCommand = new ScheduleDeleteCommand(new Heading(VALID_HEADING_MEETING_WITH_ALICE));
String expected = ScheduleDeleteCommand.COMMAND_WORD;
String expected = "schedule " + ScheduleDeleteCommand.COMMAND_WORD;
assertEquals(expected, deleteCommand.getCommandString());
}

Expand Down

0 comments on commit 1418265

Please sign in to comment.