Skip to content

Commit f8686b8

Browse files
authored
Merge pull request #238 from Lava-Iris/edit-documentation
Edit documentation
2 parents e46a93f + 10b5063 commit f8686b8

10 files changed

+149
-11
lines changed

docs/DeveloperGuide.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ The following sequence diagram shows how `add` works:
408408

409409
The `edit` command is used to change the information of an existing `Person` in ConnectUS with the information fields specified by the user, namely the `Name`, `Phone`, `Email`, `Address`, `Birthday`, `Social Media` (i.e. Telegram, Instagram, WhatsApp), and `Birthday` fields.
410410

411-
The format for the `edit` command can be found [here](https://ay2223s2-cs2103t-w15-1.github.io/tp/UserGuide.html#editing-a-person--edit).
411+
The format for the `edit` command can be found [here](https://ay2223s2-cs2103t-w15-1.github.io/tp/UserGuide.html#45-editing-a-contact-edit).
412412

413413
<div style="page-break-after: always"></div>
414414

@@ -578,14 +578,44 @@ The following sequence diagram shows how `delete-t` works:
578578

579579
**Overview:**
580580

581+
The `search` command is used to search ConnectUS for all `Person`s for whom the specified keyword matches the specified field information in the `Name`, `Phone`, `Email`, `Address`, `Birthday`, `Social Media` (i.e. Telegram, Instagram, WhatsApp), `Birthday` and `tag` (`Module`, `CCA`, `Major`, `Remarks`) fields. If no field is specified, the command searches ConnectUS for all `Person`s for whom the specified keyword matches any of the information fields.
582+
583+
The format for the `search` command can be found [here](https://ay2223s2-cs2103t-w15-1.github.io/tp/UserGuide.html#49-searching-for-contact-information-search).
584+
581585
**Feature Details:**
582586

587+
1. The user specifies keywords to search ConnectUS with.
588+
2. At least one keyword must be provided. If no keyword is provided, an error is thrown. The user is prompted to re-enter the command correctly.
589+
3. All fields provided must have a keyword associated. If an empty field is provided, an error is thrown. The user is prompted to re-enter the command correctly.
590+
4. Every `Person` in the `Model` is tested against the specified keywords. If all the keywords with fields match the corresponding information fields, and the keywords without fields match at least one information field, the `Person` is displayed. If any of the keywords do not match, the `Person` is filtered out.
591+
592+
The following activity diagram shows the logic of searching for in the contact list.
593+
594+
![SearchCommandActivityDiagram](images/SearchCommandActivityDiagram.png)
595+
596+
The sequence of the `search` command is as follows:
597+
598+
1. The command `search INPUT` is entered by the user, where the `INPUT` is optional keywords without fields followed by keywords with fields (e.g. `search alex cca/chess`).
599+
2. `Logic Manager` calls the `ConnectUsParser#parseCommand` with the given `INPUT`
600+
3. `ConnectUsParser` parses the command word. creating an instance of `SearchCommandParser` to `parse` the `informationFields` via the respective `ParserUtil` functions.
601+
4. `SearchCommandParser` creates the corresponding `FieldsContainKeywordsPredicate` object. This `FieldsContainKeywordsPredicate` object is taken as the input of a new `SearchCommand` object created by `SearchCommandParser`.
602+
5. `Logic Manager` executes `SearchCommand#execute`, updating the filtered person list of the model using the `model#updateFilteredPersonList` with the `FieldsContainKeywordsPredicate` object used to create the `SearchCommand` as the argument.
603+
6. The `FieldsContainKeywordsPredicate#test` matches each keyword with the information fields of the `Person` object being tested. If any keyword does not match, the `Person` object fails the test.
604+
7. A `Command Result` is returned with the result of the execution.
605+
606+
The following sequence diagram shows how `search` works:
607+
![SearchCommandSequenceDiagram](images/SearchCommandSequenceDiagram.png)
608+
609+
The following sequence diagram provides details on how the `informationFields` are being parsed by `ParserUtil`:
610+
![SearchCommandParseInformationFieldsSequenceDiagram](images/SearchCommandParseInformationFieldsDiagram.png)
611+
583612
[↑ Back to top of section](#4-implementation)
584613

585614
[↑ Back to table of contents](#table-of-contents)
586615

587616
<div style="page-break-after: always"></div>
588617

618+
589619
## 4.8 Upcoming Birthdays Command
590620

591621
**Overview:**

docs/UserGuide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ Format: `search [KEYWORD]... [n/NAME_KEYWORD] [p/PHONE_KEYWORD] [e/EMAIL_KEYWORD
591591

592592
> For keywords without a specified field, finds all contacts whose information from any field contains the given keywords.<br>For keywords in a specified field, finds all contacts whose field contains given keyword.
593593
594-
There are 2 methods in which you can search for a contact.
594+
There are 2 methods which you can use concurrently to search for a contact.
595595

596596
**Method 1:**
597597

docs/diagrams/AddCommandActivityDiagram.puml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
@startuml
22
!pragma useVerticalIf on
33
start
4-
:User enters add command;
5-
if () then ([else])
4+
:User enters new command;
5+
if () then ( [else])
66
:Error: Invalid command format;
77
stop
8-
([Person name is provided and arguments are valid]) elseif () then ([else])
8+
( [Person name is provided and arguments are valid]) elseif () then ( [else])
99
:Error: Person already exists;
1010
stop
11-
else ([Person does not exist in Contact List])
11+
else ( [Person does not exist in Contact List])
1212
endif
1313
:add command successfully executes.;
1414
stop

docs/diagrams/EditCommandActivityDiagram.puml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
!pragma useVerticalIf on
33
start
44
:User enters edit command;
5-
if () then ([else])
5+
if () then ( [else])
66
:Error: Invalid index provided;
77
stop
8-
([Positive index provided]) elseif () then ([else])
8+
( [Positive index provided]) elseif () then ( [else])
99
:Error: Invalid command format;
1010
stop
11-
([at least one field to be edited is provided]) elseif () then ([else])
11+
( [at least one field to be edited is provided]) elseif () then ( [else])
1212
:Error: Invalid index provided;
1313
stop
14-
([Person index is in valid range of contact list])elseif () then ([else])
14+
( [Person index is in valid range of contact list])elseif () then ( [else])
1515
:Error: Person already exists in the contact list;
1616
stop
17-
else ([Edited Person does not share a name with any other Persons])
17+
else ( [Edited Person does not share a name with any other Persons])
1818
endif
1919
:Edit command successfully executes.
2020
Person is successfully edited.;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@startuml
2+
!pragma useVerticalIf on
3+
4+
:User enters search command;
5+
if () then ( [else])
6+
:Error: Invalid command provided;
7+
stop
8+
( [At least one keyword is provided]) elseif () then ( [else])
9+
:Error: Invalid command format;
10+
stop
11+
else ( [Keyword is provided for every field mentioned])
12+
endif
13+
:Search command successfully executes.
14+
Filtered list based on given keywords is displayed.;
15+
stop
16+
17+
@enduml
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@startuml
2+
!include style.puml
3+
mainframe **ref** Parse Information Fields
4+
5+
skinparam defaultFontSize 15
6+
skinparam titleFontSize 15
7+
8+
box Logic LOGIC_COLOR_T1
9+
participant ":SearchCommandParser" as SearchCommandParser LOGIC_COLOR
10+
participant "FieldsContainKeywordsPredicate" as FieldsContainKeywordsPredicate LOGIC_COLOR
11+
end box
12+
13+
activate SearchCommandParser
14+
15+
opt ifPreamblePresent
16+
SearchCommandParser->FieldsContainKeywordsPredicate:setKeywords(keywords)
17+
activate FieldsContainKeywordsPredicate
18+
return
19+
end
20+
opt ifFieldPrefixPresent
21+
SearchCommandParser->FieldsContainKeywordsPredicate:setField(fieldKeyword)
22+
activate FieldsContainKeywordsPredicate
23+
return
24+
end
25+
26+
@enduml
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
@startuml
2+
!include style.puml
3+
4+
skinparam defaultFontSize 15
5+
skinparam SequenceReferencebackgroundColor LightYellow
6+
7+
box Logic LOGIC_COLOR_T1
8+
participant ":LogicManager" as LogicManager LOGIC_COLOR
9+
participant ":ConnectUsParser" as ConnectUsParser LOGIC_COLOR
10+
participant ":SearchCommandParser" as SearchCommandParser LOGIC_COLOR
11+
participant ":SearchCommand" as SearchCommand LOGIC_COLOR
12+
participant ":CommandResult" as CommandResult LOGIC_COLOR
13+
end box
14+
15+
box Model MODEL_COLOR_T1
16+
participant ":FieldsContainKeywordsPredicate" as FieldsContainKeywordsPredicate MODEL_COLOR
17+
participant ":Person" as Person MODEL_COLOR
18+
participant ":Model" as Model MODEL_COLOR
19+
end box
20+
21+
[-> LogicManager : execute(input)
22+
activate LogicManager
23+
24+
LogicManager -> ConnectUsParser : parseCommand(input)
25+
activate ConnectUsParser
26+
27+
create SearchCommandParser
28+
ConnectUsParser -> SearchCommandParser++
29+
return
30+
31+
ConnectUsParser -> SearchCommandParser:parse(args)
32+
activate SearchCommandParser
33+
34+
ref over SearchCommandParser
35+
Search Parse Args
36+
end
37+
38+
create FieldsContainKeywordsPredicate
39+
SearchCommandParser -> FieldsContainKeywordsPredicate++
40+
return e
41+
42+
create SearchCommand
43+
SearchCommandParser -> SearchCommand++
44+
45+
return
46+
return searchCommand
47+
destroy SearchCommandParser
48+
return searchCommand
49+
50+
LogicManager->SearchCommand : execute(model)
51+
activate SearchCommand
52+
53+
SearchCommand -> Model : updateFilteredPersonList(fieldsContainKeywordsPredicate)
54+
activate Model
55+
return
56+
57+
create CommandResult
58+
SearchCommand ->CommandResult++
59+
return
60+
61+
return commandResult
62+
return
63+
64+
@enduml
65+
19.4 KB
Loading
18.1 KB
Loading
54.5 KB
Loading

0 commit comments

Comments
 (0)