forked from AY1920S1-CS2103-F09-1/main
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
1 parent
623b257
commit cfae989
Showing
14 changed files
with
318 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.