Skip to content

Commit

Permalink
Pull request (#7)
Browse files Browse the repository at this point in the history
* Add help and edit features into User Guide (AY1920S1-CS2103-F09-1#44)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (AY1920S1-CS2103-F09-1#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add TableView.fxml to create a table (AY1920S1-CS2103-F09-1#54)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (AY1920S1-CS2103-F09-1#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add help and edit features into User Guide (AY1920S1-CS2103-F09-1#44) (#5)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (AY1920S1-CS2103-F09-1#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add TableView.fxml skeleton

* Edit TableView.fxml

* Add textfield and user input field into TableView.fxml

* Add skeleton classes for generate interview timetable feature (AY1920S1-CS2103-F09-1#50)

* Add skeleton classes for generate interview timetable feature

* Fix errors with continous integration

* Add Unit Tests for Row, Column, and Schedule class

* Fix checkstyle issue

* Add skeleton Email feature (AY1920S1-CS2103-F09-1#51)

* Add new unimplemented email command

* Fix line endings

* Edit UserGuide.adoc to change UI display feature (AY1920S1-CS2103-F09-1#55)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (AY1920S1-CS2103-F09-1#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add help and edit features into User Guide (AY1920S1-CS2103-F09-1#44) (#5)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (AY1920S1-CS2103-F09-1#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add TableView.fxml skeleton

* Edit TableView.fxml

* Add textfield and user input field into TableView.fxml

* Edit UserGuide to change the display feature

* Add skeleton Interviewee and Interviewer class (AY1920S1-CS2103-F09-1#46)

* Add skeleton Interviewee and Interviewer class

* Fix travis CI issues

* [Partial] Implement import interviewer's availability from excel sheet feature (AY1920S1-CS2103-F09-1#57)

* Import from excel function

* Adds implementation for ExcelReader

* debug importExcel classes

* Check style for Import branch

* Add minimal functionality for Interviewee and Interviewer class (AY1920S1-CS2103-F09-1#60)

* Add skeleton Interviewee and Interviewer class

* Fix travis CI issues

* Add minimal fields and logic for Interviewee and Interviewer

* Fix travis CI issues

* Update Interviewee, add Emails, Rework Faculty

* [Partial] Generate interview schedule timetable from interviewers' availability (AY1920S1-CS2103-F09-1#61)

* [Partial] Implement Schedule Class

* Modify Model Manager to adapt to list of schedules

* Fix travis build issue

* Fix checkstyle issue
  • Loading branch information
mrchensheng21 committed Oct 14, 2019
1 parent 623b257 commit cfae989
Show file tree
Hide file tree
Showing 14 changed files with 318 additions and 99 deletions.
3 changes: 2 additions & 1 deletion src/main/java/seedu/address/MainApp.java
Expand Up @@ -2,6 +2,7 @@

import java.io.IOException;
import java.nio.file.Path;
import java.util.LinkedList;
import java.util.Optional;
import java.util.logging.Logger;

Expand Down Expand Up @@ -90,7 +91,7 @@ private Model initModelManager(Storage storage, ReadOnlyUserPrefs userPrefs) {
initialData = new AddressBook();
}

return new ModelManager(initialData, userPrefs);
return new ModelManager(initialData, userPrefs, new LinkedList<>());
}

private void initLogging(Config config) {
Expand Down
28 changes: 28 additions & 0 deletions src/main/java/seedu/address/model/Model.java
@@ -1,11 +1,15 @@
package seedu.address.model;

import java.nio.file.Path;
import java.util.LinkedList;
import java.util.List;
import java.util.function.Predicate;

import javafx.collections.ObservableList;
import seedu.address.commons.core.GuiSettings;
import seedu.address.model.person.Interviewer;
import seedu.address.model.person.Person;
import seedu.address.model.person.Slot;

/**
* The API of the Model component.
Expand Down Expand Up @@ -34,6 +38,30 @@ public interface Model {
*/
void setGuiSettings(GuiSettings guiSettings);

/**
* Replaces schedule data with the data in {@code schedule}.
*/
void setScheduleList(LinkedList<Schedule> schedulesList);

/** Returns the schedulesList **/
List<Schedule> getSchedulesList();

/**
* Returns a list of observable list of the schedules.
*/
List<ObservableList<ObservableList<String>>> getObservableLists();

/**
* Returns the interview slot assigned to the interviewee with the {@code intervieweeName}.
*/
Slot getInterviewSlot(String intervieweeName);

/**
* Adds an interviewer to one of the schedules if the interviewer's availability fall within those schedules
* and returns true. Otherwise, the method will not add the interviewer and return false.
*/
boolean addInterviewer(Interviewer interviewer);

/**
* Returns the user prefs' address book file path.
*/
Expand Down
57 changes: 53 additions & 4 deletions src/main/java/seedu/address/model/ModelManager.java
Expand Up @@ -4,19 +4,24 @@
import static seedu.address.commons.util.CollectionUtil.requireAllNonNull;

import java.nio.file.Path;
import java.util.LinkedList;
import java.util.List;
import java.util.function.Predicate;
import java.util.logging.Logger;

import javafx.collections.ObservableList;
import javafx.collections.transformation.FilteredList;
import seedu.address.commons.core.GuiSettings;
import seedu.address.commons.core.LogsCenter;
import seedu.address.model.person.Interviewer;
import seedu.address.model.person.Person;
import seedu.address.model.person.Slot;

/**
* Represents the in-memory model of the address book data.
*/
public class ModelManager implements Model {
public static final Schedule EMPTY_SCHEDULE = new Schedule("", new LinkedList<>());
private static final Logger logger = LogsCenter.getLogger(ModelManager.class);

private final AddressBook addressBook;
Expand All @@ -26,7 +31,8 @@ public class ModelManager implements Model {
/**
* Initializes a ModelManager with the given addressBook and userPrefs.
*/
public ModelManager(ReadOnlyAddressBook addressBook, ReadOnlyUserPrefs userPrefs) {
public ModelManager(ReadOnlyAddressBook addressBook, ReadOnlyUserPrefs userPrefs,
LinkedList<Schedule> schedulesList) {
super();
requireAllNonNull(addressBook, userPrefs);

Expand All @@ -38,7 +44,7 @@ public ModelManager(ReadOnlyAddressBook addressBook, ReadOnlyUserPrefs userPrefs
}

public ModelManager() {
this(new AddressBook(), new UserPrefs());
this(new AddressBook(), new UserPrefs(), new LinkedList<>());
}

//=========== UserPrefs ==================================================================================
Expand Down Expand Up @@ -76,6 +82,49 @@ public void setAddressBookFilePath(Path addressBookFilePath) {
userPrefs.setAddressBookFilePath(addressBookFilePath);
}

//=========== Schedule ================================================================================
/**
* Replaces schedule data with the data in {@code schedule}.
*/
@Override
public void setScheduleList(LinkedList<Schedule> schedulesList) {

}

/** Returns the schedulesList **/
@Override
public LinkedList<Schedule> getSchedulesList() {
// TODO: Implementation
return null;
}

/**
* Returns a list of observable list of the schedules.
*/
@Override
public List<ObservableList<ObservableList<String>>> getObservableLists() {
// TODO: Implementation
return null;
}

/**
* Returns the interview slot assigned to the interviewee with the {@code intervieweeName}.
*/
@Override
public Slot getInterviewSlot(String intervieweeName) {
// TODO: Implementation
return null;
}

/**
* Adds an interviewer to one of the schedules if the interviewer's availability fall within those schedules,
* else the method will not add the interviewer.
*/
@Override
public boolean addInterviewer(Interviewer interviewer) {
return true;
}

//=========== AddressBook ================================================================================

@Override
Expand Down Expand Up @@ -144,8 +193,8 @@ public boolean equals(Object obj) {
// state check
ModelManager other = (ModelManager) obj;
return addressBook.equals(other.addressBook)
&& userPrefs.equals(other.userPrefs)
&& filteredPersons.equals(other.filteredPersons);
&& userPrefs.equals(other.userPrefs)
&& filteredPersons.equals(other.filteredPersons);
}

}
122 changes: 74 additions & 48 deletions src/main/java/seedu/address/model/Schedule.java
@@ -1,70 +1,96 @@
package seedu.address.model;

import java.util.LinkedList;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;

import seedu.address.model.person.Interviewer;
import seedu.address.model.person.Slot;

/**
* Encapsulates the schedule timetable in memory.
* Represents the interview schedule.
* The first row of the Schedule is the column titles, with the first cell as the date of the interview schedule.
* Subsequent rows are time slots, with the first cell of each row as the timing of all the time slots in the row.
*/
public class Schedule {
private String date;
private ObservableList<ObservableList<String>> table; // Include the first row which is the column titles

/**
* Returns the first row of table.
* @return the first row of table.
*/
public Row getFirstRow() {
return new Row();
public Schedule(String date, LinkedList<LinkedList<String>> list) {
this.date = date;
this.table = toTwoDimensionalObservableList(list);
}

/**
* Returns a row in the table.
* @param index the index of the row in the table.
* @return a row in the table.
*/
public Row getRow(int index) {
return new Row();
public String getDate() {
return date;
}

/**
* Returns a row in the table with the timing given
* @param timing timing of the row.
* @return a row in the table with the timing given
*/
public Row getRow(String timing) {
return new Row();
public ObservableList<ObservableList<String>> getTable() {
return table;
}

/**
* Returns a column in the table.
* @param index index of the column in the table.
* @return a column in the table.
*/
public Column getColumn(int index) {
return new Column();
public Slot getInterviewSlot(String intervieweeName) {
String timeSlot = null;
int tableSize = table.size();

// Exclude search in the first row as the first row is column titles
for (int i = 1; i < tableSize; i++) {
ObservableList<String> row = table.get(i);
int rowSize = row.size();

// Exclude search in the first cell as the first cell is the time slot
for (int j = 1; j < rowSize; j++) {
String value = row.get(j);
if ("NA".equals(value)) {
continue;
} else if (intervieweeName.equals(value)) {
timeSlot = row.get(0);
}
}
}

if (timeSlot == null) {
return null;
} else {
String[] times = timeSlot.split("-");
String start = times[0].trim();
String end = times[1].trim();

return new Slot(start, end);
}
}

/**
* Returns a column in the table with the interviewer's description given.
* @param interviewerDesc the title of the column, which is the interviewer's description.
* @return a column in the table with the interviewer's description given.
*/
public Column getColumn(String interviewerDesc) {
return new Column();
public boolean addInterviewer(Interviewer interviewer) {
return true;
}

/**
* Deletes a column in the table with the index given.
* @param index the index of the column in the table.
* @return the deleted column in the table with the index given.
*/
public Column deleteColumn(int index) {
return new Column();
@Override
public boolean equals(Object s) {
if (!(s instanceof Schedule)) {
return false;
}
Schedule sCasted = (Schedule) s;
return date.equals(sCasted.date)
&& table.equals(sCasted.table);
}

/**
* Deletes a column in the table with the interviewer's description given.
* @param interviewerDesc the title of the column, which is the interviewer's description.
* @return the deleted column in the table with the interviewer's description given.
* Convert a two-dimensional LinkedList into a two-dimensional Observable list.
*
* @param list a two-dimensional LinkedList
* @return the corresponding two-dimensional Observable list
*/
public Column deleteColumn(String interviewerDesc) {
return new Column();
public static ObservableList<ObservableList<String>> toTwoDimensionalObservableList(
LinkedList<LinkedList<String>> list) {
LinkedList<ObservableList<String>> clone = new LinkedList<>();

// Shallow copy can be used here as String is immutable.
list.forEach(row -> {
LinkedList<String> rowCopy = (LinkedList<String>) row.clone();
clone.add(FXCollections.observableList(rowCopy));
});

return FXCollections.observableList(clone);
}
}
}
3 changes: 2 additions & 1 deletion src/test/java/seedu/address/logic/LogicManagerTest.java
Expand Up @@ -12,6 +12,7 @@

import java.io.IOException;
import java.nio.file.Path;
import java.util.LinkedList;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -129,7 +130,7 @@ private void assertCommandException(String inputCommand, String expectedMessage)
*/
private void assertCommandFailure(String inputCommand, Class<? extends Throwable> expectedException,
String expectedMessage) {
Model expectedModel = new ModelManager(model.getAddressBook(), new UserPrefs());
Model expectedModel = new ModelManager(model.getAddressBook(), new UserPrefs(), new LinkedList<>());
assertCommandFailure(inputCommand, expectedException, expectedMessage, expectedModel);
}

Expand Down
Expand Up @@ -4,6 +4,8 @@
import static seedu.address.logic.commands.CommandTestUtil.assertCommandSuccess;
import static seedu.address.testutil.TypicalPersons.getTypicalAddressBook;

import java.util.LinkedList;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

Expand All @@ -22,14 +24,14 @@ public class AddCommandIntegrationTest {

@BeforeEach
public void setUp() {
model = new ModelManager(getTypicalAddressBook(), new UserPrefs());
model = new ModelManager(getTypicalAddressBook(), new UserPrefs(), new LinkedList<>());
}

@Test
public void execute_newPerson_success() {
Person validPerson = new PersonBuilder().build();

Model expectedModel = new ModelManager(model.getAddressBook(), new UserPrefs());
Model expectedModel = new ModelManager(model.getAddressBook(), new UserPrefs(), new LinkedList<>());
expectedModel.addPerson(validPerson);

assertCommandSuccess(new AddCommand(validPerson), model,
Expand Down

0 comments on commit cfae989

Please sign in to comment.