Skip to content

Commit 3aa3c25

Browse files
authored
Merge pull request nus-cs2103-AY2324S1#99 from Chrainx/Update-DG
Update dg
2 parents 9d64da8 + bb1068e commit 3aa3c25

File tree

4 files changed

+125
-13
lines changed

4 files changed

+125
-13
lines changed

docs/DeveloperGuide.md

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,39 @@ All properties will be tested using this `PriceAndTagsInRangePredicate`. Propert
320320
**Aspect: How the filtered properties should interact with the model:**
321321
* 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.
322322

323+
### Matching for Customers and Properties
324+
[Back to top](#table-of-contents)
325+
326+
#### Motivation
327+
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.
328+
Or, the property agent want to get all customers that might want to buy certain specified property.
329+
330+
#### Implementation
331+
The `MatchCustomerCommand` and `MatchPropertyCommand` classes extends the `Command` class.
332+
They are used to match the details of a customer or property, respectively.
333+
The command expects exactly one "Index" of the customer or property to be match, otherwise an error message will be displayed.
334+
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.
335+
When these created command objects are executed by the `Logic Manager`, the `MatchCustomerCommand#execute(Model model)` or `MatchProeprtyCommand#execute(Model model)` method is called.
336+
These methods will match the customer or property in the model, and return a `ComandResult` object.
337+
338+
The following sequence diagram shows how the `MatchCustomerCommand` is executed.
339+
![MatchCustomerSequenceDiagram](images/MatchCustomerSequenceDiagram.png)
340+
341+
#### Design Consideration
342+
343+
* *Alternative 1 (current choice):* `MatchPropertyCommand` and `MatchCustomerCommand` are separate, and both inherit from the `Command` class.
344+
* Pros:
345+
* Allows the property agent to match only customers or properties.
346+
* 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.
347+
* Cons:
348+
* More code for each of the classes, which increases the size of the codebase
349+
* More commands for the property agent to remember
350+
* *Alternative 2:* A single `MacthCommand` class is used to match both customers and properties.
351+
* Pros:
352+
* Lesser commands for the property agent to remember
353+
* Cons:
354+
* Unable to match only customers or properties without specify it which increase the complexity of the commands
355+
323356
### Reset the application with `Clear`
324357
[Back to top](#table-of-contents)
325358

@@ -360,7 +393,6 @@ delay.setOnFinished(e -> primaryStage.hide());
360393
delay.play();
361394
```
362395

363-
364396
### \[Proposed\] Undo/redo feature
365397

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

597-
**Use Case: UC08 - Find specific entity**
631+
**Use Case: UC08 - Match customers to properties**
632+
633+
System: PropertyMatch address book
634+
635+
Actor: Property Agent
636+
637+
1. Property agent identifies the characteristics the customers want that belong to properties
638+
2. Property agent enters the characteristics of the customers into the CLI
639+
3. Property agent views the customers that adheres to the conditions given
640+
641+
**Use Case: UC09 - Find specific entity**
598642

599643
System: PropertyMatch address book
600644

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

607-
**Use Case: UC09 - Import and export data**
651+
**Use Case: UC10 - Import and export data**
608652

609653
System: PropertyMatch address book
610654

docs/UserGuide.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ Parameter:
7474
* `a/ADDRESS` : The propAddress of the property (String)
7575
* `c/CHARACTERISTIC` (Optional) : The characteristics of the property (String)
7676
* `ph/NUMBER` : The contact number (Integer)
77-
* `pr/PRICE` : The price of the property in psf (Number) : The price of the property in psf (Number)
77+
* `pr/PRICE` : The price of the property in psf (Number)
78+
7879

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

314315
## Command summary
315316

316-
| Action | Format, Examples |
317-
|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|
318-
| **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` |
319-
| **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` |
320-
| **Delprop** | `delprop INDEX`<br> e.g., `delprop 3` |
321-
| **Delcust** | `delcust INDEX`<br> e.g., `delcust 3` |
322-
| **Listprop** | `listprop` |
323-
| **Listcust** | `listcust` |
324-
| **Exit** | `exit`|
317+
| Action | Format, Examples |
318+
|--------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|
319+
| **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` |
320+
| **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` |
321+
| **Delprop** | `delprop INDEX`<br> e.g., `delprop 3` |
322+
| **Delcust** | `delcust INDEX`<br> e.g., `delcust 3` |
323+
| **Listprop** | `listprop` |
324+
| **Listcust** | `listcust` |
325+
| **Exit** | `exit` |
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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 ":MatchCustomerCommandParser" as MatchCustomerCommandParser LOGIC_COLOR
8+
participant "command:MatchCustomerCommand" as MatchCustomerCommand 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("matchcust 1")
17+
activate LogicManager
18+
19+
LogicManager -> AddressBookParser : parseCommand("matchcust 1")
20+
activate AddressBookParser
21+
22+
create MatchCustomerCommandParser
23+
AddressBookParser -> MatchCustomerCommandParser : new MatchCustomerCommandParser("1")
24+
activate MatchCustomerCommandParser
25+
26+
MatchCustomerCommandParser --> AddressBookParser
27+
deactivate MatchCustomerCommandParser
28+
29+
AddressBookParser -> MatchCustomerCommandParser : parse("1")
30+
activate MatchCustomerCommandParser
31+
32+
create MatchCustomerCommand
33+
MatchCustomerCommandParser -> MatchCustomerCommand : new MatchCustomerCommand(1, MatchCustomerDescriptor)
34+
activate MatchCustomerCommand
35+
36+
MatchCustomerCommand --> MatchCustomerCommandParser : command
37+
deactivate MatchCustomerCommand
38+
39+
MatchCustomerCommandParser --> AddressBookParser : command
40+
deactivate MatchCustomerCommandParser
41+
'Hidden arrow to position the destroy marker below the end of the activation bar.
42+
MatchCustomerCommandParser -[hidden]-> AddressBookParser
43+
destroy MatchCustomerCommandParser
44+
45+
AddressBookParser --> LogicManager : command
46+
deactivate AddressBookParser
47+
48+
LogicManager -> MatchCustomerCommand : execute()
49+
activate MatchCustomerCommand
50+
51+
MatchCustomerCommand -> Model : updateFilteredCustomersList()
52+
53+
MatchCustomerCommand -> Model : updateFilteredPropertiesList(PREDICATE_SHOW_ALL_Properties)
54+
55+
create CommandResult
56+
MatchCustomerCommand -> CommandResult : new CommandResult(MatchedCustomer + "Matched with properties " + matchedProperties)
57+
activate CommandResult
58+
59+
CommandResult --> MatchCustomerCommand
60+
deactivate CommandResult
61+
62+
MatchCustomerCommand --> LogicManager : commandResult
63+
deactivate MatchCustomerCommand
64+
65+
[<--LogicManager : commandResult
66+
deactivate LogicManager
67+
@enduml
58.3 KB
Loading

0 commit comments

Comments
 (0)