Skip to content

Commit 5c274bc

Browse files
authored
Merge pull request nus-cs2103-AY2324S1#106 from saraozn/update-ug-dg
update ug and dg
2 parents 3aa3c25 + afbff8e commit 5c274bc

10 files changed

+252
-5
lines changed

docs/DeveloperGuide.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,6 @@ During this execution process, the existing entity is first retrieved from the m
175175
A new customer or property is then created with the edited fields, and any fields that have not been edited will be copied over from the original entity. The new entity is then added to the model, and the original entity is removed from the model.
176176
The new customer or property is then added into the model, replacing the old one. The new entity will then be displayed to the user, and a success message is displayed.
177177

178-
The following sequence diagram shows how the `EditCustomerCommand` is executed.
179-
![EditCustomerSequenceDiagram](images/EditCustomerSequenceDiagram.png)
180-
181178
#### Design Considerations
182179
**Aspect: How the edit commands should relate to each other:**
183180

@@ -196,6 +193,13 @@ The following sequence diagram shows how the `EditCustomerCommand` is executed.
196193
* We also decided for the edit commands to create a new entity, instead of editing the existing one. This allows us to not include any setters in the `Customer` and `Property` classes, which make the objects immutable, so there is less likelihood of unexpected changes to the object. This enables us to maintain the defensiveness of our code.
197194
By creating a new entity every time the property agent edits, we can easily add the new customer or property into the model, and remove the old one. This also allows us to easily undo the edit command in the future, by simply adding the old entity back into the model.
198195

196+
The following sequence diagram shows how the `EditCustomerCommand` is executed.
197+
198+
![EditCustomerSequenceDiagram](images/EditCustomerSequenceDiagram.png)
199+
200+
The following sequence diagram shows how the `EditPropertyCommand` is executed.
201+
202+
![EditPropertySequenceDiagram](images/EditPropertySequenceDiagram.png)
199203
### Deleting of customers and properties
200204
[Back to top](#table-of-contents)
201205

@@ -218,7 +222,14 @@ When these created command objects are executed by the `LogicManager`, the `Dele
218222
* **Alternative 2:** A single `DeleteCommand` class is used to edit both customer and property.
219223
* Cons:
220224
* Unnecessary complexity is introduced into the system.
225+
226+
The following sequence diagram shows how the `DeleteCustomerCommand` is executed.
227+
228+
![DeleteCustomerSequenceDiagram](images/DeleteCustomerSequenceDiagram.png)
229+
230+
The following sequence diagram shows how the `DeletePropertyCommand` is executed.
221231

232+
![DeletePropertySequenceDiagram](images/DeletePropertySequenceDiagram.png)
222233
### Finding of Customers and Properties
223234
[Back to top](#table-of-contents)
224235

docs/UserGuide.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,31 @@ When command fails:
181181
* `Missing property index` for missing parameter
182182
* `No such property index` for wrong parameter or index beyond list size
183183
* `Invalid command` for misspelling of command
184-
184+
### Editing a customer : `editcust`
185+
Edits an existing customer.
186+
Format: `editcust INDEX [n/NAME] [ph/PHONE] [e/EMAIL] [b/BUDGET] [c/CHARACTERISTIC]…​`
187+
* Edits the customer at the specified `INDEX`. The index refers to the index number shown in the displayed customer list. The index **must be a positive integer** 1, 2, 3, …​
188+
* At least one of the optional fields must be provided.
189+
* Existing values will be updated to the input values.
190+
* When editing tags, the existing tags of the property will be removed i.e adding of tags is not cumulative.
191+
* You can remove all the person’s tags by typing `c/` without
192+
specifying any tags after it.
193+
Examples:
194+
* `editprop 1 ph/91234567 e/[email protected]` Edits the phone number and email of the 1st customer to be `91234567` and `[email protected]` respectively.
195+
* `edit 2 n/Andrew c/` Edits the name of the 2nd customer to be `Andrew` and clears all existing tags.
196+
197+
### Editing a property : `editprop`
198+
Edits an existing property.
199+
Format: `editprop INDEX [n/NAME] [ph/PHONE] [pr/PRICE] [a/ADDRESS] [c/CHARACTERISTIC]…​`
200+
* Edits the property at the specified `INDEX`. The index refers to the index number shown in the displayed property list. The index **must be a positive integer** 1, 2, 3, …​
201+
* At least one of the optional fields must be provided.
202+
* Existing values will be updated to the input values.
203+
* When editing tags, the existing tags of the property will be removed i.e adding of tags is not cumulative.
204+
* You can remove all the person’s tags by typing `c/` without
205+
specifying any tags after it.
206+
Examples:
207+
* `editprop 1 ph/91234567 a/43 Clementi Avenue 3 #03-543` Edits the phone number and address of the 1st property to be `91234567` and `43 Clementi Avenue 3 #03-543` respectively.
208+
* `edit 2 n/Skyview t/` Edits the name of the 2nd property to be `Skyview` and clears all existing tags.
185209
### Finding a customer : `findcust`
186210

187211
Finds and returns a customer or a list of customers whose name contains the substring inputted.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
@startuml
2+
!include style.puml
3+
skinparam ArrowFontStyle plain
4+
5+
box Logic LOGIC_COLOR_T1
6+
participant ":LogicManager" as LogicManager LOGIC_COLOR
7+
participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR
8+
participant ":DeleteCustomerCommandParser" as DeleteCustomerCommandParser LOGIC_COLOR
9+
participant "d:DeleteCustomerCommand" as DeleteCustomerCommand LOGIC_COLOR
10+
participant ":CommandResult" as CommandResult LOGIC_COLOR
11+
end box
12+
13+
box Model MODEL_COLOR_T1
14+
participant ":Model" as Model MODEL_COLOR
15+
end box
16+
17+
[-> LogicManager : execute("delcust 1")
18+
activate LogicManager
19+
20+
LogicManager -> AddressBookParser : parseCommand("delcust 1")
21+
activate AddressBookParser
22+
23+
create DeleteCustomerCommandParser
24+
AddressBookParser -> DeleteCustomerCommandParser
25+
activate DeleteCustomerCommandParser
26+
27+
DeleteCustomerCommandParser --> AddressBookParser
28+
deactivate DeleteCustomerCommandParser
29+
30+
AddressBookParser -> DeleteCustomerCommandParser : parse("1")
31+
activate DeleteCustomerCommandParser
32+
33+
create DeleteCustomerCommand
34+
DeleteCustomerCommandParser -> DeleteCustomerCommand
35+
activate DeleteCustomerCommand
36+
37+
DeleteCustomerCommand --> DeleteCustomerCommandParser : d
38+
deactivate DeleteCustomerCommand
39+
40+
DeleteCustomerCommandParser --> AddressBookParser : d
41+
deactivate DeleteCustomerCommandParser
42+
'Hidden arrow to position the destroy marker below the end of the activation bar.
43+
DeleteCustomerCommandParser -[hidden]-> AddressBookParser
44+
destroy DeleteCustomerCommandParser
45+
46+
AddressBookParser --> LogicManager : d
47+
deactivate AddressBookParser
48+
49+
LogicManager -> DeleteCustomerCommand : execute()
50+
activate DeleteCustomerCommand
51+
52+
DeleteCustomerCommand -> Model : deleteCustomer(1)
53+
activate Model
54+
55+
Model --> DeleteCustomerCommand
56+
deactivate Model
57+
58+
create CommandResult
59+
DeleteCustomerCommand -> CommandResult
60+
activate CommandResult
61+
62+
CommandResult --> DeleteCustomerCommand
63+
deactivate CommandResult
64+
65+
DeleteCustomerCommand --> LogicManager : result
66+
deactivate DeleteCustomerCommand
67+
68+
[<--LogicManager
69+
deactivate LogicManager
70+
@enduml
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
@startuml
2+
!include style.puml
3+
skinparam ArrowFontStyle plain
4+
5+
box Logic LOGIC_COLOR_T1
6+
participant ":LogicManager" as LogicManager LOGIC_COLOR
7+
participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR
8+
participant ":DeletePropertyCommandParser" as DeletePropertyCommandParser LOGIC_COLOR
9+
participant "d:DeletePropertyCommand" as DeletePropertyCommand LOGIC_COLOR
10+
participant ":CommandResult" as CommandResult LOGIC_COLOR
11+
end box
12+
13+
box Model MODEL_COLOR_T1
14+
participant ":Model" as Model MODEL_COLOR
15+
end box
16+
17+
[-> LogicManager : execute("delprop 1")
18+
activate LogicManager
19+
20+
LogicManager -> AddressBookParser : parseCommand("delprop 1")
21+
activate AddressBookParser
22+
23+
create DeletePropertyCommandParser
24+
AddressBookParser -> DeletePropertyCommandParser
25+
activate DeletePropertyCommandParser
26+
27+
DeletePropertyCommandParser --> AddressBookParser
28+
deactivate DeletePropertyCommandParser
29+
30+
AddressBookParser -> DeletePropertyCommandParser : parse("1")
31+
activate DeletePropertyCommandParser
32+
33+
create DeletePropertyCommand
34+
DeletePropertyCommandParser -> DeletePropertyCommand
35+
activate DeletePropertyCommand
36+
37+
DeletePropertyCommand --> DeletePropertyCommandParser : d
38+
deactivate DeletePropertyCommand
39+
40+
DeletePropertyCommandParser --> AddressBookParser : d
41+
deactivate DeletePropertyCommandParser
42+
'Hidden arrow to position the destroy marker below the end of the activation bar.
43+
DeletePropertyCommandParser -[hidden]-> AddressBookParser
44+
destroy DeletePropertyCommandParser
45+
46+
AddressBookParser --> LogicManager : d
47+
deactivate AddressBookParser
48+
49+
LogicManager -> DeletePropertyCommand : execute()
50+
activate DeletePropertyCommand
51+
52+
DeletePropertyCommand -> Model : deleteProperty(1)
53+
activate Model
54+
55+
Model --> DeletePropertyCommand
56+
deactivate Model
57+
58+
create CommandResult
59+
DeletePropertyCommand -> CommandResult
60+
activate CommandResult
61+
62+
CommandResult --> DeletePropertyCommand
63+
deactivate CommandResult
64+
65+
DeletePropertyCommand --> LogicManager : result
66+
deactivate DeletePropertyCommand
67+
68+
[<--LogicManager
69+
deactivate LogicManager
70+
@enduml

docs/diagrams/DeleteSequenceDiagram.puml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ deactivate AddressBookParser
4949
LogicManager -> DeleteCommand : execute()
5050
activate DeleteCommand
5151

52-
DeleteCommand -> Model : deletePerson(1)
52+
DeleteCommand -> Model : delete(1)
5353
activate Model
5454

5555
Model --> DeleteCommand
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
@startuml
2+
!include style.puml
3+
4+
box Logic LOGIC_COLOR_T1
5+
participant ":LogicManager" as LogicManager LOGIC_COLOR
6+
participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR
7+
participant ":EditPropertyCommandParser" as EditPropertyCommandParser LOGIC_COLOR
8+
participant "command:EditPropertyCommand" as EditPropertyCommand LOGIC_COLOR
9+
participant ":CommandResult" as CommandResult LOGIC_COLOR
10+
end box
11+
12+
box Model MODEL_COLOR_T1
13+
participant ":Model" as Model MODEL_COLOR
14+
end box
15+
16+
[-> LogicManager : execute("editprop 1 n/Skyview")
17+
activate LogicManager
18+
19+
LogicManager -> AddressBookParser : parseCommand("editprop 1 n/Skyview")
20+
activate AddressBookParser
21+
22+
create EditPropertyCommandParser
23+
AddressBookParser -> EditPropertyCommandParser : new EditPropertyCommandParser("1 n/Skyview")
24+
activate EditPropertyCommandParser
25+
26+
EditPropertyCommandParser --> AddressBookParser
27+
deactivate EditPropertyCommandParser
28+
29+
AddressBookParser -> EditPropertyCommandParser : parse("1 n/Skyview")
30+
activate EditPropertyCommandParser
31+
32+
create EditPropertyCommand
33+
EditPropertyCommandParser -> EditPropertyCommand : new EditPropertyCommand(1, editPropertyDescriptor)
34+
activate EditPropertyCommand
35+
36+
EditPropertyCommand --> EditPropertyCommandParser : command
37+
deactivate EditPropertyCommand
38+
39+
EditPropertyCommandParser --> AddressBookParser : command
40+
deactivate EditPropertyCommandParser
41+
'Hidden arrow to position the destroy marker below the end of the activation bar.
42+
EditPropertyCommandParser -[hidden]-> AddressBookParser
43+
destroy EditPropertyCommandParser
44+
45+
AddressBookParser --> LogicManager : command
46+
deactivate AddressBookParser
47+
48+
LogicManager -> EditPropertyCommand : execute()
49+
activate EditPropertyCommand
50+
51+
EditPropertyCommand -> EditPropertyCommand : createEditedProperty(propertyToEdit, editPropertyDescriptor)
52+
activate EditPropertyCommand
53+
EditPropertyCommand --> EditPropertyCommand : editedProperty
54+
deactivate EditPropertyCommand
55+
56+
EditPropertyCommand -> Model : setProperty(PropertyToEdit, editedProperty)
57+
58+
EditPropertyCommand -> Model : updateFilteredPropertyList(PREDICATE_SHOW_ALL_PROPERTY)
59+
60+
create CommandResult
61+
EditPropertyCommand -> CommandResult : new CommandResult("Edited property: " + editedProperty)
62+
activate CommandResult
63+
64+
CommandResult --> EditPropertyCommand
65+
deactivate CommandResult
66+
67+
EditPropertyCommand --> LogicManager : commandResult
68+
deactivate EditPropertyCommand
69+
70+
[<--LogicManager : commandResult
71+
deactivate LogicManager
72+
@enduml
29.6 KB
Loading
29.7 KB
Loading
-9.42 KB
Loading
42 KB
Loading

0 commit comments

Comments
 (0)