forked from nus-cs2103-AY1920S1/addressbook-level3
/
Model.java
287 lines (231 loc) · 9.6 KB
/
Model.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
package seedu.scheduler.model;
import java.io.IOException;
import java.nio.file.Path;
import java.text.ParseException;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.function.Predicate;
import javafx.collections.ObservableList;
import seedu.scheduler.commons.core.GuiSettings;
import seedu.scheduler.commons.exceptions.ScheduleException;
import seedu.scheduler.model.person.Interviewee;
import seedu.scheduler.model.person.Interviewer;
import seedu.scheduler.model.person.Name;
import seedu.scheduler.model.person.Slot;
import seedu.scheduler.model.person.exceptions.PersonNotFoundException;
import seedu.scheduler.ui.RefreshListener;
import seedu.scheduler.ui.TabListener;
/**
* The API of the Model component.
*/
public interface Model {
/** {@code Predicate} that always evaluate to true */
Predicate<Interviewee> PREDICATE_SHOW_ALL_INTERVIEWEES = unused -> true;
Predicate<Interviewer> PREDICATE_SHOW_ALL_INTERVIEWERS = unused -> true;
// ================================== App Status ======================================
/**
* Sets the status whether the schedule command has been executed by the user. See @code{isScheduled} for more
* details on when to set this status.
*/
void setScheduled(boolean scheduled);
/**
* Returns true if the scheduling command is executed by the user. Returns false if otherwise or the user import
* interviewer's availability again after the scheduling command is executed.
* @return
*/
boolean isScheduled();
// ================================== IntervieweeList and InterviewerList ======================================
List<Schedule> getEmptyScheduleList();
/**
* Replaces the list of IntervieweeList data with the data in {@code interviewees}
*/
void setIntervieweeList(List<Interviewee> interviewees);
/**
* Replaces the list of Interviewers data with the data in {@code interviewers}
*/
void setInterviewerList(List<Interviewer> interviewers);
/**
* Sets the user prefs' interviewee list file path.
*/
void setIntervieweeListFilePath(Path intervieweeListFilePath);
/**
* Sets the user pref's interviewer list file path.
*/
void setInterviewerListFilePath(Path interviewerListFilePath);
/**
* Returns the user pref's interviewee list file path.
*/
Path getIntervieweeListFilePath();
/**
* Returns the user pref's interviewer list file path.
*/
Path getInterviewerListFilePath();
/**
* Returns the modifiable internal list of {@code Interviewee}.
*/
ReadAndWriteList<Interviewee> getMutableIntervieweeList();
/**
* Returns the modifiable internal list of {@code Interviewer}.
*/
ReadAndWriteList<Interviewer> getMutableInterviewerList();
/**
* Returns an unmodifiable list view of {@code Interviewee} backed by the internal {@code IntervieweeList}.
*
* @see Model#updateFilteredIntervieweeList(Predicate)
*/
ObservableList<Interviewee> getFilteredIntervieweeList();
/**
* Returns an unmodifiable list view of {@code Interviewer} backed by the internal {@code InterviewerList}.
*
* @see Model#updateFilteredInterviewerList(Predicate)
*/
ObservableList<Interviewer> getFilteredInterviewerList();
/**
* Returns an unmodifiable list view of all {@code Interviewee}s backed by the internal {@code IntervieweeList}.
*/
ObservableList<Interviewee> getUnfilteredIntervieweeList();
/**
* Returns an unmodifiable list view of all {@code Interviewer}s backed by the internal {@code InterviewerList}.
*/
ObservableList<Interviewer> getUnfilteredInterviewerList();
/**
* Restricts the {@code ObservableList} of interviewee to display only what returns true on Predicate while
* leaving the original {@code IntervieweeList} unmodified.
*/
void updateFilteredIntervieweeList(Predicate<Interviewee> predicate);
/**
* Restricts the {@code ObservableList} of interviewer to display only what returns true on Predicate while
* leaving the original {@code InterviewerList} unmodified.
*/
void updateFilteredInterviewerList(Predicate<Interviewer> predicate);
/**
* Adds an interviewer to the model's {@code InterviewerList}. Must be unique.
*/
void addInterviewer(Interviewer interviewer);
/**
* Adds an interviewee to the model's {@code IntervieweeList}. Must be unique.
*/
void addInterviewee(Interviewee interviewee);
/**
* Returns true if an interviewee with the same identity exists in the interviewee list.
*/
boolean hasInterviewee(Interviewee interviewee);
/**
* Returns true if an interviewee with the same Name exists in the interviewee list.
*/
boolean hasInterviewee(Name name);
/**
* Returns true if an interviewer with the same identity exists in the interviewer list.
*/
boolean hasInterviewer(Interviewer interviewer);
/**
* Returns true if an interviewer with the same Name exists in the interviewer list.
*/
boolean hasInterviewer(Name name);
/**
* Returns an Interviewee given a name. The Interviewee must exist in the database, or an exception is thrown.
*/
Interviewee getInterviewee(String name) throws NoSuchElementException;
/**
* Returns an Interviewer given a name. The Interviewer must exist in the database, or an exception is thrown.
*/
Interviewer getInterviewer(String name) throws NoSuchElementException;
/**
* Deletes the interviewee from the {@code IntervieweeList}. An exception is thrown if {@code target} is not found.
*/
void deleteInterviewee(Interviewee target) throws PersonNotFoundException;
/**
* Deletes the interviewer from the {@code InterviewerList}. An exception is thrown if {@code target} is not found.
*/
void deleteInterviewer(Interviewer target) throws PersonNotFoundException;
/**
* Edits the interviewee with the {@code editedTarget}. An exception is thrown if {@code target} is not found.
*/
void setInterviewee(Interviewee target, Interviewee editedTarget) throws PersonNotFoundException;
/**
* Edits the interviewer with the {@code editedTarget}. An exception is thrown if {@code target} is not found.
*/
void setInterviewer(Interviewer target, Interviewer editedTarget) throws PersonNotFoundException;
// =========================================== Mass Email =================================================
/**
* Emails the given Interviewee.
* The Interviewee must exist in the database.
*/
void emailInterviewee(Interviewee interviewee) throws IOException;
// ================================== Refresh Listener ======================================
/**
* Add a refresh listener to listen to changes of Schedule data.
*/
void addRefreshListener(RefreshListener listener);
/**
* Add a tabListener to change tab when command is given.
*/
void addTabListener(TabListener tabListener);
// ================================== Tab Change ============================================
/**
* Call tabListener when User wants to display interviewee
*/
void intervieweeTabChange();
/**
* Call tabListener when User wants to display interviewer
*/
void interviewerTabChange();
/**
* Call tabListener when User wants to display schedules
*/
void scheduleTabChange();
// ============================================ Schedule ===================================================
/**
* Generates a list of empty schedules from the current list of interviewers.
* @throws ParseException
*/
void setEmptyScheduleList() throws ParseException;
/**
* Updates schedule list with just interviewers' data.
*/
void updateScheduleList();
/**
* Replaces schedule data with the data in {@code schedule}.
*/
void setSchedulesList(List<Schedule> schedulesList);
/**
* Returns the interview slot allocated to the interviewee with the {@code intervieweeName}.
* @return
*/
Slot getAllocatedSlot(String intervieweeName);
/** Returns a list of observable list of the schedules **/
List<ObservableList<ObservableList<String>>> getObservableLists();
/** Returns the schedulesList **/
List<Schedule> getSchedulesList();
/** Returns a list of lists of column titles, each list of column titles belong to a Schedule table*/
List<List<String>> getTitlesLists();
/**
* Resets the relevant data before running a schedule command.
* 1. Removes the allocated time slot of all interviewees
* 2. Removes the allocated time slots of all interviewers
* 3. Resets the schedule list such that it only reflects the interviewers' availability and the scheduled result
* is cleared.
*/
void resetScheduledResult();
/**
* Updates the schedules after schedule command is executed by placing the interviewees into their allocated slot.
**/
void updateSchedulesAfterScheduling() throws ScheduleException;
// ============================================ User Prefs ===================================================
/**
* Replaces user prefs data with the data in {@code userPrefs}.
*/
void setUserPrefs(ReadOnlyUserPrefs userPrefs);
/**
* Returns the user prefs.
*/
ReadOnlyUserPrefs getUserPrefs();
/**
* Returns the user prefs' GUI settings.
*/
GuiSettings getGuiSettings();
/**
* Sets the user prefs' GUI settings.
*/
void setGuiSettings(GuiSettings guiSettings);
}