forked from nus-cs2103-AY1920S1/addressbook-level3
/
Model.java
246 lines (201 loc) · 7.48 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
package seedu.address.model;
import static seedu.address.model.entity.body.BodyStatus.CONTACT_POLICE;
import java.nio.file.Path;
import java.util.Optional;
import java.util.function.Predicate;
import javafx.beans.property.ReadOnlyProperty;
import javafx.collections.ObservableList;
import seedu.address.commons.core.GuiSettings;
import seedu.address.logic.commands.UndoableCommand;
import seedu.address.logic.history.CommandHistory;
import seedu.address.model.entity.Entity;
import seedu.address.model.entity.body.Body;
import seedu.address.model.entity.fridge.Fridge;
import seedu.address.model.entity.worker.Worker;
import seedu.address.model.notif.Notif;
import seedu.address.model.person.Person;
/**
* The API of the Model component.
*/
public interface Model {
/** {@code Predicate} that always evaluate to true */
Predicate<Person> PREDICATE_SHOW_ALL_PERSONS = unused -> true;
Predicate<Body> PREDICATE_SHOW_ALL_BODIES = unused -> true;
Predicate<Worker> PREDICATE_SHOW_ALL_WORKERS = unused -> true;
Predicate<Notif> PREDICATE_SHOW_ALL_NOTIFS = unused -> true;
Predicate<Notif> PREDICATE_SHOW_ACTIVE_NOTIFS =
unused -> unused.getBody().getBodyStatus().equals(Optional.of(CONTACT_POLICE));
Predicate<Fridge> PREDICATE_SHOW_ALL_FRIDGES = unused -> true;
/**
* Adds an executed command to the model's command history.
* @param command a command that was executed.
*/
void addExecutedCommand(UndoableCommand command);
/**
* Gets the last executed UndoableCommand.
* @return the last executed command.
*/
UndoableCommand getExecutedCommand();
/**
* Adds an undone UndoableCommand.
* @param command an UndoableCommand that was undone.
*/
void addUndoneCommand(UndoableCommand command);
/**
* Gets the last undone UndoableCommand.
* @returnthe last undone command.
*/
UndoableCommand getUndoneCommand();
/**
* Returns the current UndoHistory in the Model.
* @return CommandHistory
*/
CommandHistory getUndoHistory();
/**
* Clears the current UndoHistory in the Model.
*/
void clearUndoHistory();
/**
* * 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);
/**
* Returns the user prefs' address book file path.
*/
Path getAddressBookFilePath();
/**
* Sets the user prefs' address book file path.
*/
void setAddressBookFilePath(Path addressBookFilePath);
/**
* Replaces address book data with the data in {@code addressBook}.
*/
void setAddressBook(ReadOnlyAddressBook addressBook);
/** Returns the AddressBook */
ReadOnlyAddressBook getAddressBook();
//@@author shaoyi1997
/**
* Returns true if an entity with the same identity as {@code entity} exists in Mortago.
*/
boolean hasEntity(Entity entity);
/**
* Deletes the given entity.
* The entity must exist in Mortago.
*/
void deleteEntity(Entity target);
/**
* Adds the given entity.
* {@code entity} must not already exist in Mortago.
*/
void addEntity(Entity entity);
/**
* Replaces the given entity {@code target} with {@code editedEntity}.
* {@code target} must exist in Mortago.
* The entity identity of {@code editedEntity} must not be the same as another existing entity in Mortago.
*/
void setEntity(Entity target, Entity editedEntity);
/**
* Returns true if a notif with the same identity as {@code notif} exists in Mortago.
*/
boolean hasNotif(Notif notif);
/**
* Deletes the given notif.
* The notif must exist in Mortago.
*/
void deleteNotif(Notif target);
/**
* Adds the given notif.
* {@code notif} must not already exist in Mortago.
*/
void addNotif(Notif notif);
/**
* Replaces the given notif {@code target} with {@code editedNotif}.
* {@code target} must exist in Mortago.
* The notif identity of {@code editedNotif} must not be the same as another existing notif in Mortago.
*/
void setNotif(Notif target, Notif editedNotif);
/**
* Returns the total number of notifications in the system.
*/
int getNumberOfNotifs();
//@@author
/**
* Returns the total number of active notifications in the system.
*/
int getNumberOfActiveNotifs();
/** Returns an unmodifiable view of the filtered person list */
ObservableList<Person> getFilteredPersonList();
//@@author shaoyi1997
/** Returns an unmodifiable view of the filtered list of workers*/
ObservableList<Worker> getFilteredWorkerList();
/** Returns an unmodifiable view of the filtered list of bodies */
ObservableList<Body> getFilteredBodyList();
/** Returns an unmodifiable view of the filtered list of fridges */
ObservableList<Fridge> getFilteredFridgeList();
//@@author
/** Returns an unmodifiable view of the filtered list of entities */
ObservableList<? extends Entity> getFilteredEntityList(String entityType);
/** Returns an unmodifiable view of the filtered list of notifs */
ObservableList<Notif> getFilteredNotifList();
/** Returns an unmodifiable view of the filtered list of active notifs */
ObservableList<Notif> getFilteredActiveNotifList();
/**
* Updates the filter of the filtered person list to filter by the given {@code predicate}.
* @throws NullPointerException if {@code predicate} is null.
*/
void updateFilteredPersonList(Predicate<Person> predicate);
/**
* Updates the filter of the filtered worker list to filter by the given {@code predicate}.
* @throws NullPointerException if {@code predicate} is null.
*/
void updateFilteredWorkerList(Predicate<Worker> predicate);
/**
* Updates the filter of the filtered body list to filter by the given {@code predicate}.
* @throws NullPointerException if {@code predicate} is null.
*/
void updateFilteredBodyList(Predicate<Body> predicate);
/**
* Updates the filter of the filtered notif list to filter by the given {@code predicate}.
* @throws NullPointerException if {@code predicate} is null.
*/
void updateFilteredNotifList(Predicate<Notif> predicate);
/**
* Updates the filter of the filtered active notif list to filter by the given {@code predicate}.
* @throws NullPointerException if {@code predicate} is null.
*/
void updateFilteredActiveNotifList(Predicate<Notif> predicate);
/**
* Updates the filter of the filtered fridge list to filter by the given {@code predicate}.
* @throws NullPointerException if {@code predicate} is null.
*/
void updateFilteredFridgeList(Predicate<Fridge> predicate);
//@@author shaoyi1997-reused
//Reused from SE-EDU Address Book Level 4
/**
* Selected person in the filtered body list.
* null if no body is selected.
*/
ReadOnlyProperty<Body> selectedBodyProperty();
/**
* Returns the selected body in the filtered body list.
* null if no body is selected.
*/
Body getSelectedBody();
/**
* Sets the selected body in the filtered body list.
*/
void setSelectedBody(Body body);
//@@author
}