Skip to content

Commit

Permalink
Merge pull request #120 from EthanWong6362/master
Browse files Browse the repository at this point in the history
last minutes changes for demo
  • Loading branch information
EthanWong6362 authored Oct 28, 2021
2 parents 9e47469 + 25f625f commit 04469f6
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package seedu.modulink.logic.commands;

import static seedu.modulink.model.Model.PREDICATE_SHOW_ALL_PERSONS;

import java.util.function.Predicate;

import javafx.collections.ObservableList;
import seedu.modulink.commons.core.Messages;
import seedu.modulink.model.Model;
Expand Down Expand Up @@ -52,9 +48,7 @@ public CommandResult execute(Model model) {
}
}
// included this so the list will be properly updated
Predicate<Person> updatePredicate = unused -> false;
model.updateFilteredPersonList(updatePredicate);
model.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS);
model.refreshFilteredPersonList();

if (noPersonFound) {
return new CommandResult(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package seedu.modulink.logic.commands;

import static seedu.modulink.model.Model.PREDICATE_SHOW_ALL_PERSONS;

import java.util.function.Predicate;

import javafx.collections.ObservableList;
import seedu.modulink.commons.core.Messages;
import seedu.modulink.model.Model;
Expand Down Expand Up @@ -46,9 +42,8 @@ public CommandResult execute(Model model) {
}
}
// included this so the list will be properly updated
Predicate<Person> updatePredicate = unused -> false;
model.updateFilteredPersonList(updatePredicate);
model.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS);
model.refreshFilteredPersonList();

if (noPersonFound) {
return new CommandResult(Messages.MESSAGE_NO_SUCH_ID_FOUND);
} else {
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/seedu/modulink/model/Model.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ public interface Model {
/** Returns an unmodifiable view of the filtered person list */
ObservableList<Person> getFilteredPersonList();

/** Refreshes current filtered person list to show any changes */
void refreshFilteredPersonList();

/**
* Updates the filter of the filtered person list to filter by the given {@code predicate}.
* @throws NullPointerException if {@code predicate} is null.
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/seedu/modulink/model/ModelManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,15 @@ public void updateFilteredPersonList(Predicate<Person> predicate) {
filteredPersons.setPredicate(predicate);
}

@Override
public void refreshFilteredPersonList() {
@SuppressWarnings("unchecked")
Predicate<Person> predicate = (Predicate<Person>) filteredPersons.getPredicate();
Predicate<Person> updatePredicate = unused -> false;
updateFilteredPersonList(updatePredicate);
updateFilteredPersonList(predicate);
}

@Override
public boolean equals(Object obj) {
// short circuit if same object
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/modulink/model/tag/Status.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static Status parseStatusFromString(String s) {
s = s.trim();
if (s.equals("need group")) {
return Status.NEED_GROUP;
} else if (s.equals("need member")) {
} else if (s.equals("need member") || s.equals("need members")) {
return Status.NEED_MEMBER;
} else {
return Status.NONE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ public void updateFilteredPersonList(Predicate<Person> predicate) {
throw new AssertionError("This method should not be called.");
}

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

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

0 comments on commit 04469f6

Please sign in to comment.