Skip to content

Commit

Permalink
Merge pull request nus-cs2103-AY2324S1#106 from saraozn/update-ug-dg
Browse files Browse the repository at this point in the history
update ug and dg
  • Loading branch information
saraozn committed Oct 27, 2023
2 parents 3aa3c25 + afbff8e commit 5c274bc
Show file tree
Hide file tree
Showing 10 changed files with 252 additions and 5 deletions.
17 changes: 14 additions & 3 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,6 @@ During this execution process, the existing entity is first retrieved from the m
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.
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.

The following sequence diagram shows how the `EditCustomerCommand` is executed.
![EditCustomerSequenceDiagram](images/EditCustomerSequenceDiagram.png)

#### Design Considerations
**Aspect: How the edit commands should relate to each other:**

Expand All @@ -196,6 +193,13 @@ The following sequence diagram shows how the `EditCustomerCommand` is executed.
* 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.
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.

The following sequence diagram shows how the `EditCustomerCommand` is executed.

![EditCustomerSequenceDiagram](images/EditCustomerSequenceDiagram.png)

The following sequence diagram shows how the `EditPropertyCommand` is executed.

![EditPropertySequenceDiagram](images/EditPropertySequenceDiagram.png)
### Deleting of customers and properties
[Back to top](#table-of-contents)

Expand All @@ -218,7 +222,14 @@ When these created command objects are executed by the `LogicManager`, the `Dele
* **Alternative 2:** A single `DeleteCommand` class is used to edit both customer and property.
* Cons:
* Unnecessary complexity is introduced into the system.

The following sequence diagram shows how the `DeleteCustomerCommand` is executed.

![DeleteCustomerSequenceDiagram](images/DeleteCustomerSequenceDiagram.png)

The following sequence diagram shows how the `DeletePropertyCommand` is executed.

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

Expand Down
26 changes: 25 additions & 1 deletion docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,31 @@ When command fails:
* `Missing property index` for missing parameter
* `No such property index` for wrong parameter or index beyond list size
* `Invalid command` for misspelling of command

### Editing a customer : `editcust`
Edits an existing customer.
Format: `editcust INDEX [n/NAME] [ph/PHONE] [e/EMAIL] [b/BUDGET] [c/CHARACTERISTIC]…​`
* 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, …​
* At least one of the optional fields must be provided.
* Existing values will be updated to the input values.
* When editing tags, the existing tags of the property will be removed i.e adding of tags is not cumulative.
* You can remove all the person’s tags by typing `c/` without
specifying any tags after it.
Examples:
* `editprop 1 ph/91234567 e/[email protected]` Edits the phone number and email of the 1st customer to be `91234567` and `[email protected]` respectively.
* `edit 2 n/Andrew c/` Edits the name of the 2nd customer to be `Andrew` and clears all existing tags.

### Editing a property : `editprop`
Edits an existing property.
Format: `editprop INDEX [n/NAME] [ph/PHONE] [pr/PRICE] [a/ADDRESS] [c/CHARACTERISTIC]…​`
* 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, …​
* At least one of the optional fields must be provided.
* Existing values will be updated to the input values.
* When editing tags, the existing tags of the property will be removed i.e adding of tags is not cumulative.
* You can remove all the person’s tags by typing `c/` without
specifying any tags after it.
Examples:
* `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.
* `edit 2 n/Skyview t/` Edits the name of the 2nd property to be `Skyview` and clears all existing tags.
### Finding a customer : `findcust`

Finds and returns a customer or a list of customers whose name contains the substring inputted.
Expand Down
70 changes: 70 additions & 0 deletions docs/diagrams/DeleteCustomerSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
@startuml
!include style.puml
skinparam ArrowFontStyle plain

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR
participant ":DeleteCustomerCommandParser" as DeleteCustomerCommandParser LOGIC_COLOR
participant "d:DeleteCustomerCommand" as DeleteCustomerCommand LOGIC_COLOR
participant ":CommandResult" as CommandResult LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
participant ":Model" as Model MODEL_COLOR
end box

[-> LogicManager : execute("delcust 1")
activate LogicManager

LogicManager -> AddressBookParser : parseCommand("delcust 1")
activate AddressBookParser

create DeleteCustomerCommandParser
AddressBookParser -> DeleteCustomerCommandParser
activate DeleteCustomerCommandParser

DeleteCustomerCommandParser --> AddressBookParser
deactivate DeleteCustomerCommandParser

AddressBookParser -> DeleteCustomerCommandParser : parse("1")
activate DeleteCustomerCommandParser

create DeleteCustomerCommand
DeleteCustomerCommandParser -> DeleteCustomerCommand
activate DeleteCustomerCommand

DeleteCustomerCommand --> DeleteCustomerCommandParser : d
deactivate DeleteCustomerCommand

DeleteCustomerCommandParser --> AddressBookParser : d
deactivate DeleteCustomerCommandParser
'Hidden arrow to position the destroy marker below the end of the activation bar.
DeleteCustomerCommandParser -[hidden]-> AddressBookParser
destroy DeleteCustomerCommandParser

AddressBookParser --> LogicManager : d
deactivate AddressBookParser

LogicManager -> DeleteCustomerCommand : execute()
activate DeleteCustomerCommand

DeleteCustomerCommand -> Model : deleteCustomer(1)
activate Model

Model --> DeleteCustomerCommand
deactivate Model

create CommandResult
DeleteCustomerCommand -> CommandResult
activate CommandResult

CommandResult --> DeleteCustomerCommand
deactivate CommandResult

DeleteCustomerCommand --> LogicManager : result
deactivate DeleteCustomerCommand

[<--LogicManager
deactivate LogicManager
@enduml
70 changes: 70 additions & 0 deletions docs/diagrams/DeletePropertySequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
@startuml
!include style.puml
skinparam ArrowFontStyle plain

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR
participant ":DeletePropertyCommandParser" as DeletePropertyCommandParser LOGIC_COLOR
participant "d:DeletePropertyCommand" as DeletePropertyCommand LOGIC_COLOR
participant ":CommandResult" as CommandResult LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
participant ":Model" as Model MODEL_COLOR
end box

[-> LogicManager : execute("delprop 1")
activate LogicManager

LogicManager -> AddressBookParser : parseCommand("delprop 1")
activate AddressBookParser

create DeletePropertyCommandParser
AddressBookParser -> DeletePropertyCommandParser
activate DeletePropertyCommandParser

DeletePropertyCommandParser --> AddressBookParser
deactivate DeletePropertyCommandParser

AddressBookParser -> DeletePropertyCommandParser : parse("1")
activate DeletePropertyCommandParser

create DeletePropertyCommand
DeletePropertyCommandParser -> DeletePropertyCommand
activate DeletePropertyCommand

DeletePropertyCommand --> DeletePropertyCommandParser : d
deactivate DeletePropertyCommand

DeletePropertyCommandParser --> AddressBookParser : d
deactivate DeletePropertyCommandParser
'Hidden arrow to position the destroy marker below the end of the activation bar.
DeletePropertyCommandParser -[hidden]-> AddressBookParser
destroy DeletePropertyCommandParser

AddressBookParser --> LogicManager : d
deactivate AddressBookParser

LogicManager -> DeletePropertyCommand : execute()
activate DeletePropertyCommand

DeletePropertyCommand -> Model : deleteProperty(1)
activate Model

Model --> DeletePropertyCommand
deactivate Model

create CommandResult
DeletePropertyCommand -> CommandResult
activate CommandResult

CommandResult --> DeletePropertyCommand
deactivate CommandResult

DeletePropertyCommand --> LogicManager : result
deactivate DeletePropertyCommand

[<--LogicManager
deactivate LogicManager
@enduml
2 changes: 1 addition & 1 deletion docs/diagrams/DeleteSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ deactivate AddressBookParser
LogicManager -> DeleteCommand : execute()
activate DeleteCommand

DeleteCommand -> Model : deletePerson(1)
DeleteCommand -> Model : delete(1)
activate Model

Model --> DeleteCommand
Expand Down
72 changes: 72 additions & 0 deletions docs/diagrams/EditPropertySequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
@startuml
!include style.puml

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR
participant ":EditPropertyCommandParser" as EditPropertyCommandParser LOGIC_COLOR
participant "command:EditPropertyCommand" as EditPropertyCommand LOGIC_COLOR
participant ":CommandResult" as CommandResult LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
participant ":Model" as Model MODEL_COLOR
end box

[-> LogicManager : execute("editprop 1 n/Skyview")
activate LogicManager

LogicManager -> AddressBookParser : parseCommand("editprop 1 n/Skyview")
activate AddressBookParser

create EditPropertyCommandParser
AddressBookParser -> EditPropertyCommandParser : new EditPropertyCommandParser("1 n/Skyview")
activate EditPropertyCommandParser

EditPropertyCommandParser --> AddressBookParser
deactivate EditPropertyCommandParser

AddressBookParser -> EditPropertyCommandParser : parse("1 n/Skyview")
activate EditPropertyCommandParser

create EditPropertyCommand
EditPropertyCommandParser -> EditPropertyCommand : new EditPropertyCommand(1, editPropertyDescriptor)
activate EditPropertyCommand

EditPropertyCommand --> EditPropertyCommandParser : command
deactivate EditPropertyCommand

EditPropertyCommandParser --> AddressBookParser : command
deactivate EditPropertyCommandParser
'Hidden arrow to position the destroy marker below the end of the activation bar.
EditPropertyCommandParser -[hidden]-> AddressBookParser
destroy EditPropertyCommandParser

AddressBookParser --> LogicManager : command
deactivate AddressBookParser

LogicManager -> EditPropertyCommand : execute()
activate EditPropertyCommand

EditPropertyCommand -> EditPropertyCommand : createEditedProperty(propertyToEdit, editPropertyDescriptor)
activate EditPropertyCommand
EditPropertyCommand --> EditPropertyCommand : editedProperty
deactivate EditPropertyCommand

EditPropertyCommand -> Model : setProperty(PropertyToEdit, editedProperty)

EditPropertyCommand -> Model : updateFilteredPropertyList(PREDICATE_SHOW_ALL_PROPERTY)

create CommandResult
EditPropertyCommand -> CommandResult : new CommandResult("Edited property: " + editedProperty)
activate CommandResult

CommandResult --> EditPropertyCommand
deactivate CommandResult

EditPropertyCommand --> LogicManager : commandResult
deactivate EditPropertyCommand

[<--LogicManager : commandResult
deactivate LogicManager
@enduml
Binary file added docs/images/DeleteCustomerSequenceDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/DeletePropertySequenceDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/DeleteSequenceDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/EditPropertySequenceDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5c274bc

Please sign in to comment.