Skip to content

Commit 22e8046

Browse files
authored
Merge pull request #94 from Alteqa/branch-updatedg
Update DG queryPatient and queryDoctor
2 parents b8cc855 + 2a3977e commit 22e8046

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed

docs/DeveloperGuide.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,33 @@ The sequence diagram below closely describes the interaction between the various
300300

301301

302302

303+
304+
### Query `doctor` and `patient`
305+
306+
Queries a 'doctor' or 'patient' entry by indicating their name or a substring of their name.
307+
This command is implemented through the `QueryDoctor` and `QueryPatient` classes which extend the `Command` class.
308+
309+
* Step 1. User enters an `querypatient` or `querydoctor` command.
310+
* Step 2. The `AddressBookParser` will call `parseCommand` on the user's input string and return an instance of `queryDoctorCommandParser` or `queryPatientCommandParser`.
311+
* Step 3. The `parse` command in `queryDoctorCommandParser` or `queryPatientCommandParser` calls `ParserUtil` to create instances of objects for each of the fields.
312+
* If there are any missing fields, a `CommandException` is thrown.
313+
* If input arguments does not match contraints for the fields, a `IllegalArgumentException` is thrown.
314+
315+
The activity diagram below demonstrates this error handling process in more detail.
316+
317+
<img src="images/QueryPersonActivityDiagram.png" width="800" />
318+
319+
* Step 4. The `parse` command in `queryDoctorCommandParser` or `queryDoctorCommandParser` return an instance of `queryPatientCommand` or `queryPatientCommand` respectively.
320+
* Step 5. The `LogicManager` calls the `execute` method in `queryDoctorCommandParser` or `queryDoctorCommandParser`.
321+
* Step 6. The `execute` method in `queryDoctorCommandParser` or `queryDoctorCommandParser` executes and calls `updateFilteredPersonList` in model to get a filtered list of `Doctor` or `Patient`.
322+
* Step 7. Success message gets printed onto the results display to notify user and the list of matching results is produced.
323+
324+
325+
Why is this implemented this way?
326+
1. Making both `Doctor` and `Patient` class extend the `Person` class makes it easier to execute query operations.
327+
2. `Doctor` and `Patient` all exhibit similar qualities, and thus can inherit from the `Person` superclass.
328+
329+
303330
### \[Proposed\] Undo/redo feature
304331

305332
#### Proposed Implementation
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
@startuml
2+
skin rose
3+
skinparam ActivityFontSize 15
4+
skinparam ArrowFontSize 12
5+
6+
start
7+
:User enters command to query doctor or patient;
8+
9+
10+
if () then ([missing required fields])
11+
:Show error message\nfor missing required fields;
12+
else ([else])
13+
:Search Doctor/Patient from person list;
14+
:Update the 'person' panel\nin the GUI to display the list;
15+
:Show success message\nwith removed doctor/patient information;
16+
endif
17+
18+
19+
stop
20+
@enduml
23.6 KB
Loading

0 commit comments

Comments
 (0)