Skip to content

Commit

Permalink
Merge pull request AY2324S1-CS2103T-W10-1#177 from nabonitasen/branch…
Browse files Browse the repository at this point in the history
…-clear-details

Fix bug in Clear Command
  • Loading branch information
nabonitasen authored Nov 9, 2023
2 parents 84e98c5 + 60d72f1 commit d885b2a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class ClearCommand extends Command {
public CommandResult execute(Model model) {
requireNonNull(model);
model.setAddressBook(new AddressBook());
model.clearPersonDetails();
return new CommandResult(MESSAGE_SUCCESS);
}
}
5 changes: 5 additions & 0 deletions src/main/java/seedu/address/model/Model.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ public interface Model {
*/
void showPersonAtIndex(Index index);

/**
* CLears details of person displayed in detail view of UI.
*/
void clearPersonDetails();

/** Returns an unmodifiable view of the filtered person list */
ObservableList<Person> getFilteredPersonList();

Expand Down
5 changes: 5 additions & 0 deletions src/main/java/seedu/address/model/ModelManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ public void showPersonAtIndex(Index index) {
}
}

@Override
public void clearPersonDetails() {
currentPerson.set(Optional.empty());
}

@Override
public void deletePerson(Person target) {
addressBook.removePerson(target);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ public void showPersonAtIndex(Index index) {
throw new AssertionError("This method should not be called.");
}

@Override
public void clearPersonDetails() {
throw new AssertionError("This method should not be called.");
}

@Override
public ObservableList<Person> getFilteredPersonList() {
throw new AssertionError("This method should not be called.");
Expand Down

0 comments on commit d885b2a

Please sign in to comment.