Skip to content

Commit d952305

Browse files
Merge pull request #346 from UncleGrandpa925/fix-bugs-v1.4
Rename variables in TrackIter & Clean up ModelManager
2 parents e1349dd + 137ddcc commit d952305

File tree

3 files changed

+61
-81
lines changed

3 files changed

+61
-81
lines changed

src/main/java/trackitnus/model/ModelManager.java

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ public void setTrackIter(ReadOnlyTrackIter trackIt) {
114114
trackIter.resetData(trackIt);
115115
}
116116

117-
//=========== Contact ================================================================================
118117
@Override
119118
public boolean hasContact(Contact contact) {
120119
requireNonNull(contact);
@@ -138,18 +137,12 @@ public void setContact(Contact target, Contact editedContact) {
138137
trackIter.setContact(target, editedContact);
139138
}
140139

141-
//=========== Filtered Contact List Accessors =============================================================
142-
143140
@Override
144141
public ObservableList<Contact> getAllContacts() {
145142
updateFilteredContactList(PREDICATE_SHOW_ALL_CONTACTS);
146143
return getFilteredContactList();
147144
}
148145

149-
/**
150-
* Returns an unmodifiable view of the list of {@code Contact} backed by the internal list of
151-
* {@code versionedTrackIter}
152-
*/
153146
@Override
154147
public ObservableList<Contact> getFilteredContactList() {
155148
return filteredContacts;
@@ -161,8 +154,6 @@ public void updateFilteredContactList(Predicate<Contact> predicate) {
161154
filteredContacts.setPredicate(predicate);
162155
}
163156

164-
//=========== Module ================================================================================
165-
166157
@Override
167158
public boolean hasModule(Module module) {
168159
requireNonNull(module);
@@ -197,21 +188,16 @@ public void addModule(Module module) {
197188
}
198189

199190
@Override
200-
public void setModule(Module target, Module editedTask) {
201-
CollectionUtil.requireAllNonNull(target, editedTask);
202-
203-
trackIter.setModule(target, editedTask);
191+
public void setModule(Module target, Module editedModule) {
192+
CollectionUtil.requireAllNonNull(target, editedModule);
193+
trackIter.setModule(target, editedModule);
204194
}
205195

206-
//=========== Filtered Module List Accessors =============================================================
207-
208196
@Override
209197
public ObservableList<Module> getFilteredModuleList() {
210198
return filteredModules;
211199
}
212200

213-
//=========== Task ================================================================================
214-
215201
@Override
216202
public boolean hasTask(Task task) {
217203
requireNonNull(task);
@@ -231,12 +217,9 @@ public void addTask(Task task) {
231217
@Override
232218
public void setTask(Task target, Task editedTask) {
233219
CollectionUtil.requireAllNonNull(target, editedTask);
234-
235220
trackIter.setTask(target, editedTask);
236221
}
237222

238-
//=========== Filtered Task List Accessors =============================================================
239-
240223
@Override
241224
public ObservableList<Task> getFilteredTaskList() {
242225
return filteredTasks;
@@ -284,7 +267,6 @@ public boolean canAddMoreModule() {
284267
@Override
285268
public void setLesson(Lesson target, Lesson editedLesson) {
286269
CollectionUtil.requireAllNonNull(target, editedLesson);
287-
288270
trackIter.setLesson(target, editedLesson);
289271
}
290272

@@ -299,15 +281,11 @@ public void clearAllList() {
299281
updateFilteredTaskList(PREDICATE_SHOW_NO_TASKS);
300282
}
301283

302-
//=========== Filtered Lesson List Accessors =============================================================
303-
304284
@Override
305285
public ObservableList<Lesson> getFilteredLessonList() {
306286
return filteredLessons;
307287
}
308288

309-
//--------------------------------START of V1.3's new functions--------------------------------
310-
311289
@Override
312290
public ObservableList<Lesson> getDayUpcomingLessons(LocalDate date) {
313291
sortLesson();

src/main/java/trackitnus/model/TrackIter.java

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -113,28 +113,28 @@ public boolean hasModule(Module module) {
113113
* Adds a module to the app.
114114
* The module must not already exist in the app.
115115
*/
116-
public void addModule(Module p) {
117-
modules.add(p);
116+
public void addModule(Module module) {
117+
modules.add(module);
118118
}
119119

120120
/**
121-
* Replaces the given module {@code target} in the list with {@code editedModule}.
122-
* {@code target} must exist in the app.
121+
* Replaces the given module {@code moduleToEdit} in the list with {@code editedModule}.
122+
* {@code moduleToEdit} must exist in the app.
123123
* The module identity of {@code editedModule} must not
124124
* be the same as another existing module in the app.
125125
*/
126-
public void setModule(Module target, Module editedModule) {
126+
public void setModule(Module moduleToEdit, Module editedModule) {
127127
requireNonNull(editedModule);
128128

129-
modules.setModule(target, editedModule);
129+
modules.setModule(moduleToEdit, editedModule);
130130
}
131131

132132
/**
133-
* Removes {@code key} from this {@code TrackIter}.
134-
* {@code key} must exist in the app.
133+
* Removes {@code module} from this {@code TrackIter}.
134+
* {@code module} must exist in the app.
135135
*/
136-
public void removeModule(Module key) {
137-
modules.remove(key);
136+
public void removeModule(Module module) {
137+
modules.remove(module);
138138
}
139139

140140
//=========== Contact ================================================================================
@@ -151,28 +151,28 @@ public boolean hasContact(Contact contact) {
151151
* Adds a module to the app.
152152
* The module must not already exist in the app.
153153
*/
154-
public void addContact(Contact p) {
155-
contacts.add(p);
154+
public void addContact(Contact contact) {
155+
contacts.add(contact);
156156
}
157157

158158
/**
159-
* Replaces the given contact {@code target} in the list with {@code editedContact}.
160-
* {@code target} must exist in the app.
159+
* Replaces the given contact {@code contactToEdit} in the list with {@code editedContact}.
160+
* {@code contactToEdit} must exist in the app.
161161
* The contact identity of {@code editedContact} must not
162162
* be the same as another existing contact in the app.
163163
*/
164-
public void setContact(Contact target, Contact editedContact) {
164+
public void setContact(Contact contactToEdit, Contact editedContact) {
165165
requireNonNull(editedContact);
166166

167-
contacts.setContact(target, editedContact);
167+
contacts.setContact(contactToEdit, editedContact);
168168
}
169169

170170
/**
171-
* Removes {@code key} from this {@code TrackIter}.
172-
* {@code key} must exist in the app.
171+
* Removes {@code contact} from this {@code TrackIter}.
172+
* {@code contact} must exist in the app.
173173
*/
174-
public void removeContact(Contact key) {
175-
contacts.remove(key);
174+
public void removeContact(Contact contact) {
175+
contacts.remove(contact);
176176
}
177177

178178

@@ -190,28 +190,28 @@ public boolean hasTask(Task task) {
190190
* Adds a task to the app.
191191
* The task must not already exist in the app.
192192
*/
193-
public void addTask(Task p) {
194-
tasks.add(p);
193+
public void addTask(Task task) {
194+
tasks.add(task);
195195
}
196196

197197
/**
198-
* Replaces the given task {@code target} in the list with {@code editedTask}.
199-
* {@code target} must exist in the app.
198+
* Replaces the given task {@code taskToEdit} in the list with {@code editedTask}.
199+
* {@code taskToEdit} must exist in the app.
200200
* The task identity of {@code editedTask} must not
201201
* be the same as another existing task in the app.
202202
*/
203-
public void setTask(Task target, Task editedTask) {
203+
public void setTask(Task taskToEdit, Task editedTask) {
204204
requireNonNull(editedTask);
205205

206-
tasks.setTask(target, editedTask);
206+
tasks.setTask(taskToEdit, editedTask);
207207
}
208208

209209
/**
210-
* Removes {@code key} from this {@code TrackIter}.
211-
* {@code key} must exist in the app.
210+
* Removes {@code task} from this {@code TrackIter}.
211+
* {@code task} must exist in the app.
212212
*/
213-
public void removeTask(Task key) {
214-
tasks.remove(key);
213+
public void removeTask(Task task) {
214+
tasks.remove(task);
215215
}
216216

217217
//=========== Lesson ================================================================================
@@ -228,28 +228,28 @@ public boolean hasLesson(Lesson lesson) {
228228
* Adds a lesson to the app.
229229
* The lesson must not already exist in the app.
230230
*/
231-
public void addLesson(Lesson p) {
232-
lessons.add(p);
231+
public void addLesson(Lesson lesson) {
232+
lessons.add(lesson);
233233
}
234234

235235
/**
236-
* Replaces the given lesson {@code target} in the list with {@code editedLesson}.
237-
* {@code target} must exist in the app.
236+
* Replaces the given lesson {@code lessonToEdit} in the list with {@code editedLesson}.
237+
* {@code lessonToEdit} must exist in the app.
238238
* The lesson identity of {@code editedLesson} must not
239239
* be the same as another existing lesson in the app.
240240
*/
241-
public void setLesson(Lesson target, Lesson editedLesson) {
241+
public void setLesson(Lesson lessonToEdit, Lesson editedLesson) {
242242
requireNonNull(editedLesson);
243243

244-
lessons.setLesson(target, editedLesson);
244+
lessons.setLesson(lessonToEdit, editedLesson);
245245
}
246246

247247
/**
248-
* Removes {@code key} from this {@code TrackIter}.
249-
* {@code key} must exist in the app.
248+
* Removes {@code lesson} from this {@code TrackIter}.
249+
* {@code lesson} must exist in the app.
250250
*/
251-
public void removeLesson(Lesson key) {
252-
lessons.remove(key);
251+
public void removeLesson(Lesson lesson) {
252+
lessons.remove(lesson);
253253
}
254254

255255
//// util methods

src/main/resources/view/HelpPanel.fxml

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,37 @@
99
<?import javafx.scene.layout.VBox?>
1010
<?import javafx.scene.shape.Line?>
1111
<?import javafx.scene.shape.Rectangle?>
12-
13-
<ListView fx:id="HelpPanel" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
12+
<ListView xmlns:fx="http://javafx.com/fxml/1" fx:id="HelpPanel" xmlns="http://javafx.com/javafx/8">
1413
<VBox styleClass="help_panel">
1514
<padding>
16-
<Insets bottom="1" left="15" right="5" top="1" />
15+
<Insets bottom="1" left="15" right="5" top="1"/>
1716
</padding>
18-
<Label styleClass="module_big_label" text="Command Summary" />
19-
<Line endX="500" style="-fx-stroke: #8C8C89" />
20-
<Rectangle arcHeight="5.0" arcWidth="5.0" fill="#1f93ff00" height="6.0" stroke="#ffffff00" strokeType="INSIDE" width="214.0" />
21-
<Label styleClass="help_intro" text="For more info, refer to User Guide:" />
17+
<Label styleClass="module_big_label" text="Command Summary"/>
18+
<Line endX="500" style="-fx-stroke: #8C8C89"/>
19+
<Rectangle arcHeight="5.0" arcWidth="5.0" fill="#1f93ff00" height="6.0" stroke="#ffffff00" strokeType="INSIDE"
20+
width="214.0"/>
21+
<Label styleClass="help_intro" text="For more info, refer to User Guide:"/>
2222
<HBox>
2323
<Label fx:id="helpMessage" text="Label" wrapText="true" style="-fx-text-fill: #68C2E8">
2424
<HBox.margin>
25-
<Insets right="5.0" />
25+
<Insets right="5.0"/>
2626
</HBox.margin>
27-
<padding>
28-
<Insets top="7.0" />
29-
</padding>
27+
<padding>
28+
<Insets top="7.0"/>
29+
</padding>
3030
</Label>
31-
<Button fx:id="copyButton" mnemonicParsing="false" onAction="#copyUrl" style="-fx-font-size: 15" text="Copy URL">
31+
<Button fx:id="copyButton" mnemonicParsing="false" onAction="#copyUrl" style="-fx-font-size: 15"
32+
text="Copy URL">
3233
<HBox.margin>
33-
<Insets left="5.0" />
34+
<Insets left="5.0"/>
3435
</HBox.margin>
3536
</Button>
3637
</HBox>
3738

3839
<TableView fx:id="helpCardTableView">
39-
<VBox.margin>
40-
<Insets top="10.0" />
41-
</VBox.margin></TableView>
40+
<VBox.margin>
41+
<Insets top="10.0"/>
42+
</VBox.margin>
43+
</TableView>
4244
</VBox>
4345
</ListView>

0 commit comments

Comments
 (0)