Skip to content

Commit

Permalink
Merge pull request nus-cs2103-AY2021S1#91 from gloon99/branch-Add-Mee…
Browse files Browse the repository at this point in the history
…ting

Create Meeting class
  • Loading branch information
nopenotj authored Oct 8, 2020
2 parents 678c0fd + 3534682 commit fe937b0
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/main/java/seedu/address/logic/Logic.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.logic.parser.exceptions.ParseException;
import seedu.address.model.ReadOnlyAddressBook;
import seedu.address.model.ReadOnlyMeetingBook;
import seedu.address.model.meeting.Meeting;
import seedu.address.model.person.Person;

/**
Expand All @@ -33,6 +35,21 @@ public interface Logic {
/** Returns an unmodifiable view of the filtered list of persons */
ObservableList<Person> getFilteredPersonList();

/**
* Returns the user prefs' meeting book file path.
*/
Path getMeetingBookFilePath();

/**
* Returns the MeetingBook.
*
* @see seedu.address.model.Model#getMeetingBook()
*/
ReadOnlyMeetingBook getMeetingBook();

/** Returns an unmodifiable view of the filtered list of meetings */
ObservableList<Meeting> getFilteredMeetingList();

/**
* Returns the user prefs' address book file path.
*/
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/seedu/address/logic/LogicManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import seedu.address.logic.parser.exceptions.ParseException;
import seedu.address.model.Model;
import seedu.address.model.ReadOnlyAddressBook;
import seedu.address.model.ReadOnlyMeetingBook;
import seedu.address.model.meeting.Meeting;
import seedu.address.model.person.Person;
import seedu.address.storage.Storage;

Expand Down Expand Up @@ -75,6 +77,21 @@ public ObservableList<Person> getFilteredPersonList() {
return model.getFilteredPersonList();
}

@Override
public Path getMeetingBookFilePath() {
return model.getMeetingBookFilePath();
}

@Override
public ReadOnlyMeetingBook getMeetingBook() {
return model.getMeetingBook();
}

@Override
public ObservableList<Meeting> getFilteredMeetingList() {
return model.getFilteredMeetingList();
}

@Override
public Path getAddressBookFilePath() {
return model.getAddressBookFilePath();
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/seedu/address/model/Model.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,13 @@ public interface Model {
boolean hasMeeting(Meeting meeting);

void addMeeting(Meeting meeting);

/** Returns an unmodifiable view of the filtered meeting list */
ObservableList<Meeting> getFilteredMeetingList();

/**
* Updates the filter of the filtered meeting list to filter by the given {@code predicate}.
* @throws NullPointerException if {@code predicate} is null.
*/
void updateFilteredMeetingList(Predicate<Meeting> predicate);
}
19 changes: 19 additions & 0 deletions src/main/java/seedu/address/model/ModelManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class ModelManager implements Model {
private final MeetingBook meetingBook;
private final UserPrefs userPrefs;
private final FilteredList<Person> filteredPersons;
private final FilteredList<Meeting> filteredMeetings;

/**
* Initializes a ModelManager with the given addressBook and userPrefs.
Expand All @@ -41,6 +42,7 @@ public ModelManager(ReadOnlyAddressBook addressBook, ReadOnlyMeetingBook meeting
this.meetingBook = new MeetingBook(meetingBook);
this.userPrefs = new UserPrefs(userPrefs);
filteredPersons = new FilteredList<>(this.addressBook.getPersonList());
filteredMeetings = new FilteredList<>(this.meetingBook.getMeetingList());
}

public ModelManager() {
Expand Down Expand Up @@ -175,6 +177,23 @@ public void updateFilteredPersonList(Predicate<Person> predicate) {
filteredPersons.setPredicate(predicate);
}

//=========== Filtered Person List Accessors =============================================================

/**
* Returns an unmodifiable view of the list of {@code Person} backed by the internal list of
* {@code versionedAddressBook}
*/
@Override
public ObservableList<Meeting> getFilteredMeetingList() {
return filteredMeetings;
}

@Override
public void updateFilteredMeetingList(Predicate<Meeting> predicate) {
requireNonNull(predicate);
filteredMeetings.setPredicate(predicate);
}

@Override
public boolean equals(Object obj) {
// short circuit if same object
Expand Down
10 changes: 10 additions & 0 deletions src/test/java/seedu/address/logic/commands/AddCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,16 @@ public Path getMeetingBookFilePath() {
public void setMeetingBookFilePath(Path meetingBookFilePath) {
throw new AssertionError("This method should not be called.");
}

@Override
public ObservableList<Meeting> getFilteredMeetingList() {
throw new AssertionError("This method should not be called.");
}

@Override
public void updateFilteredMeetingList(Predicate<Meeting> predicate) {
throw new AssertionError("This method should not be called.");
}
}

/**
Expand Down

0 comments on commit fe937b0

Please sign in to comment.