Skip to content

Commit

Permalink
Merge pull request nus-cs2103-AY2324S1#99 from Chrainx/Update-DG
Browse files Browse the repository at this point in the history
Update dg
  • Loading branch information
Chrainx authored Oct 27, 2023
2 parents 9d64da8 + bb1068e commit 3aa3c25
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 13 deletions.
50 changes: 47 additions & 3 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,39 @@ All properties will be tested using this `PriceAndTagsInRangePredicate`. Propert
**Aspect: How the filtered properties should interact with the model:**
* We also decided for the filter commands to put the filtered properties in a different list (`FilteredPropertyList`), instead of removing the 'unused' properties from the model.

### Matching for Customers and Properties
[Back to top](#table-of-contents)

#### Motivation
The property agent may want to get all properties that satisfy the customers criteria or get all customers that want the properties characteristics. For example, the property agent want to get all properties that certain specified customer want and can afford.
Or, the property agent want to get all customers that might want to buy certain specified property.

#### Implementation
The `MatchCustomerCommand` and `MatchPropertyCommand` classes extends the `Command` class.
They are used to match the details of a customer or property, respectively.
The command expects exactly one "Index" of the customer or property to be match, otherwise an error message will be displayed.
When the match command is inputted, the `MatchCustomerCommandParser` or `MatchPropertyCommandParser` classes are used to parse the user input and create the `MatchCustomerCommand` or `MacthPropertyCommand` objects respectively.
When these created command objects are executed by the `Logic Manager`, the `MatchCustomerCommand#execute(Model model)` or `MatchProeprtyCommand#execute(Model model)` method is called.
These methods will match the customer or property in the model, and return a `ComandResult` object.

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

#### Design Consideration

* *Alternative 1 (current choice):* `MatchPropertyCommand` and `MatchCustomerCommand` are separate, and both inherit from the `Command` class.
* Pros:
* Allows the property agent to match only customers or properties.
* The inheritance of the `Command` class allows us to keep to the Command design pattern, to easily add more types of edit commands in the future, without having to change the existing code.
* Cons:
* More code for each of the classes, which increases the size of the codebase
* More commands for the property agent to remember
* *Alternative 2:* A single `MacthCommand` class is used to match both customers and properties.
* Pros:
* Lesser commands for the property agent to remember
* Cons:
* Unable to match only customers or properties without specify it which increase the complexity of the commands

### Reset the application with `Clear`
[Back to top](#table-of-contents)

Expand Down Expand Up @@ -360,7 +393,6 @@ delay.setOnFinished(e -> primaryStage.hide());
delay.play();
```


### \[Proposed\] Undo/redo feature

#### Proposed Implementation
Expand Down Expand Up @@ -514,6 +546,8 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli
| `* *` | user with a lot of properties | find properties based on properties' details | access specific properties with the detail |
| `* *` | user with a lot of customers | filter customers based on customers' details | get a list of specific customers with the detail |
| `* *` | user with a lot of properties | filter properties based on properties' details | get a list of specific properties with the detail |
| `* *` | user with a lot of customers | get properties based on customers' details | get a list of specific properties with the detail satisfy the customer |
| `* *` | user with a lot of properties | get customers based on properties' details | get a list of specific customers with the detail satisfy the property |
| `*` | user | add notes to customers' profiles | streamline customer management profile |
| `*` | user | add notes to properties' profiles | streamline customer property profile |
| `*` | experienced user using the application with new device | import and export customers' data | transfer customers' data across devices |
Expand Down Expand Up @@ -594,7 +628,17 @@ Actor: Property Agent
2. Property agent enters the characteristics of the properties into the CLI
3. Property agent views the properties that adheres to the conditions given

**Use Case: UC08 - Find specific entity**
**Use Case: UC08 - Match customers to properties**

System: PropertyMatch address book

Actor: Property Agent

1. Property agent identifies the characteristics the customers want that belong to properties
2. Property agent enters the characteristics of the customers into the CLI
3. Property agent views the customers that adheres to the conditions given

**Use Case: UC09 - Find specific entity**

System: PropertyMatch address book

Expand All @@ -604,7 +648,7 @@ Actor: Property Agent
2. Property agent enters the entity index he wants
3. Property agent views the entity

**Use Case: UC09 - Import and export data**
**Use Case: UC10 - Import and export data**

System: PropertyMatch address book

Expand Down
21 changes: 11 additions & 10 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ Parameter:
* `a/ADDRESS` : The propAddress of the property (String)
* `c/CHARACTERISTIC` (Optional) : The characteristics of the property (String)
* `ph/NUMBER` : The contact number (Integer)
* `pr/PRICE` : The price of the property in psf (Number) : The price of the property in psf (Number)
* `pr/PRICE` : The price of the property in psf (Number)


Examples:
* addprop n/Fredy a/randomAddress c/bright;sunny;big;square ph/91135235 pr/5
Expand Down Expand Up @@ -313,12 +314,12 @@ When command fails: Invalid command for misspelling of command

## Command summary

| Action | Format, Examples |
|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|
| **Addprop** | `addprop n/NAME a/ADDRESS [c/CHARACTERISTIC] ph/number pr/price` <br> e.g., `addprop n/Fredy a/randomAddress c/bright;sunny;big;square ph/91135235 pr/5` |
| **Addcust** | `addcust n/NAME p/PHONE e/EMAIL [b/BUDGET] [c/CHARACTERISTIC]` <br> e.g., `addcust n/Fredy p/12345678 e/[email protected] b/100000` |
| **Delprop** | `delprop INDEX`<br> e.g., `delprop 3` |
| **Delcust** | `delcust INDEX`<br> e.g., `delcust 3` |
| **Listprop** | `listprop` |
| **Listcust** | `listcust` |
| **Exit** | `exit`|
| Action | Format, Examples |
|--------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **Addprop** | `addprop n/NAME a/ADDRESS [c/CHARACTERISTIC] ph/number pr/price` <br> e.g., `addprop n/Property a/randomAddress c/bright;sunny;big;square ph/91135235 pr/5` |
| **Addcust** | `addcust n/NAME p/PHONE e/EMAIL [b/BUDGET] [c/CHARACTERISTIC]` <br> e.g., `addcust n/Fredy p/12345678 e/[email protected] b/100000` |
| **Delprop** | `delprop INDEX`<br> e.g., `delprop 3` |
| **Delcust** | `delcust INDEX`<br> e.g., `delcust 3` |
| **Listprop** | `listprop` |
| **Listcust** | `listcust` |
| **Exit** | `exit` |
67 changes: 67 additions & 0 deletions docs/diagrams/MatchCustomerSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
@startuml
!include style.puml

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR
participant ":MatchCustomerCommandParser" as MatchCustomerCommandParser LOGIC_COLOR
participant "command:MatchCustomerCommand" as MatchCustomerCommand 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("matchcust 1")
activate LogicManager

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

create MatchCustomerCommandParser
AddressBookParser -> MatchCustomerCommandParser : new MatchCustomerCommandParser("1")
activate MatchCustomerCommandParser

MatchCustomerCommandParser --> AddressBookParser
deactivate MatchCustomerCommandParser

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

create MatchCustomerCommand
MatchCustomerCommandParser -> MatchCustomerCommand : new MatchCustomerCommand(1, MatchCustomerDescriptor)
activate MatchCustomerCommand

MatchCustomerCommand --> MatchCustomerCommandParser : command
deactivate MatchCustomerCommand

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

AddressBookParser --> LogicManager : command
deactivate AddressBookParser

LogicManager -> MatchCustomerCommand : execute()
activate MatchCustomerCommand

MatchCustomerCommand -> Model : updateFilteredCustomersList()

MatchCustomerCommand -> Model : updateFilteredPropertiesList(PREDICATE_SHOW_ALL_Properties)

create CommandResult
MatchCustomerCommand -> CommandResult : new CommandResult(MatchedCustomer + "Matched with properties " + matchedProperties)
activate CommandResult

CommandResult --> MatchCustomerCommand
deactivate CommandResult

MatchCustomerCommand --> LogicManager : commandResult
deactivate MatchCustomerCommand

[<--LogicManager : commandResult
deactivate LogicManager
@enduml
Binary file added docs/images/MatchCustomerSequenceDiagram.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 3aa3c25

Please sign in to comment.