-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CS2113-T11-3] Florizz #29
base: master
Are you sure you want to change the base?
Changes from 193 commits
fee78ea
5d5f2eb
a3be983
aeb552d
efb2b23
18235e4
8581d68
9d5a550
7c4f6fc
8e35626
9fc1248
6e1c302
cfbdff5
847e593
936d400
3189fde
8ef4179
6c5fa7c
52d826a
49a3ed9
28bbf24
51f8a3d
a369d85
e97ddf4
9ddbde1
9efb1c8
699c9c0
3357206
ddf9253
d7ac4aa
122ba84
45d4501
a839c58
34679b0
8022308
5d0e16d
033f315
8edb617
a0c1005
9fd0204
b61fd24
db806d4
a2e490b
1d35566
c1105a8
f24a493
d9bff58
e0596dc
d3de93b
e69bd2f
f1f6f24
f8dca7e
16d6f14
96dd298
9d992aa
6e74721
ca1c508
5dd5baf
3b41c21
a426e28
c7e6452
d9b3899
1df428d
2f8b264
5203d5d
d4abf15
ae9d470
a71ce66
15ff815
31d4e70
56ab34c
fc16ba9
e0077a0
c062a9a
3763d69
86bc983
3e9961c
270117b
ca80351
df73d2a
82355d8
4cf7eb7
9661be0
3defca4
7a73fe7
c8005d4
de5031b
7abddb2
294383a
2c227e3
aedc8c7
4dc8165
d06c37c
f3bcf72
f317c46
aa7f464
e6bab99
ddb7275
c5c8949
2eb4552
2b3dccb
3198abe
d76a8fd
9119497
55157b0
c1c02ea
7410a08
f19cd55
590877f
6a497bb
522140f
182f21e
c1c29c5
ec34185
52c6b48
efed9d0
8b0447c
b6019bd
affab09
4cd873a
844c0a4
09aaf7b
2dcc86d
89d6e6f
cf5874e
487447e
fe1c5fd
3cbfbc3
1172e82
1566961
66c278c
a422521
15198b0
0afbf63
4fe40a2
06de178
8e781b5
02b58c6
00e0407
9e191e9
a547efd
cf19688
930b2ab
687224f
b224e0f
56a762b
3554131
38b88b0
f75189c
e31bfc3
2b3bd20
7c504d9
bc23e3d
69cfba7
138e26c
2b58cdb
5f700a9
3509042
728ff40
c9cd9d1
af18aa4
0829906
7bce708
3156964
15f07e5
d81b239
bb505b8
e1ae51f
de448a8
4d3c12b
54b5937
09079e3
f6adb3e
7f76565
8ea63ca
3ba51d6
d3ce3e5
a5613a7
bc56fb2
75b11d7
b0aff65
e2fd3de
94c789f
c17090b
8a6b893
56f3d50
f322f19
6a503d3
35e8dac
9120a94
f2f3227
7559236
ab5e538
ae26401
0b8d894
e6c5fff
c7da4a5
3db412a
a350bac
8fa7cb1
3fc60d5
37be645
c16de10
b419e79
a7e65bb
e266939
d204876
208a704
c663e8c
cd9601b
8017ee2
6a7deff
928220a
f21a2a0
ddd2963
3e1def7
46998d2
2dc6a5f
8610744
b15cda8
4da42be
f859bbc
eb9e5bb
98644b1
d48a15a
6573068
c0f9eb4
876a7cc
9c4d2e1
34d3618
4219294
44c80db
b4b288b
1b305d2
6d59605
045c36b
e84c03a
444a5f2
de65788
b7fcf3b
a6bffed
105bb30
a00fef1
028c3b4
eae1890
935f85b
9e16963
245eb92
08abaa7
5c15044
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,5 @@ bin/ | |
|
||
/text-ui-test/ACTUAL.TXT | ||
text-ui-test/EXPECTED-UNIX.TXT | ||
/florizz-out/logs | ||
/florizz-out/data |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Manifest-Version: 1.0 | ||
Main-Class: florizz.core.Florizz | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
# About us | ||
|
||
Display | Name | Github Profile | Portfolio | ||
--------|:----:|:--------------:|:---------: | ||
![](https://via.placeholder.com/100.png?text=Photo) | John Doe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Don Joe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Ron John | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | John Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Don Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
Display | Name | Github Profile | Portfolio | ||
--------|:-------------------:|:--------------:|:---------: | ||
![](https://via.placeholder.com/100.png?text=Photo) | Ian Freda Hariyanto | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Mohamed Ijaaz | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Jeffinson Darmawan | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Samuel Ong | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Don Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,35 +4,186 @@ | |
|
||
{list here sources of all reused/adapted ideas, code, documentation, and third-party libraries -- include links to the original source as well} | ||
|
||
## Design & implementation | ||
## Design | ||
Florizz consists of four components, Ui, Logic, Model and Storage. These components are all called on by the Main component, Florizz.java, which simply handles the app initialisation. | ||
|
||
{Describe the design and implementation of the product. Use UML diagrams and short code snippets where applicable.} | ||
App initialisation: Initialises the various components, then begins reading inputs from the user | ||
|
||
![Architecture](UML-diagrams/Samuel/Architecture.png) | ||
|
||
## Product scope | ||
### Target user profile | ||
`Ui`: takes in user inputs from the CLI and sends it to the Logic component. Also handles all writing of messages to the user | ||
|
||
{Describe the target user profile} | ||
`Logic`: takes in string input from Ui, and parses it into commands to be executed on variables stored in the model. Calls Ui to provide the user with feedback that the action has or has not been completed. | ||
|
||
### Value proposition | ||
`Model`: Handles all the cached variables, i.e. the list of Bouquets created by the user, the list of available Flowers that the user can add to their Bouquets | ||
|
||
{Describe the value proposition: what problem does it solve?} | ||
`Storage`: Handles storing and reading from hardware, such as saving the list of bouquets created by the user so they can access it later. | ||
|
||
## User Stories | ||
## Implementation | ||
|
||
### Adding/Removing Bouquets | ||
|
||
![AddBouquets](UML-diagrams/Samuel/AddBouquets.png) | ||
To add a new bouquet to the list of Bouquets saved in the BouquetList variable, the user would have to type `add <bouquet name>` into the CLI, which is then handled by `Ui.getInput` and passed to `Parser`, which | ||
creates a Command `Addcommand` with a new Bouquet of that name as an argument. This command is then sent back to `Florizz`, the main class, where it is then executed. | ||
|
||
If a bouquet of the same name already exists in BouquetList, an exception will be thrown and the user will be prompted to choose another name. This is facilitated by overriding the .equals() method in the `Bouquet` class such that | ||
when two Bouquets are compared, .equals() returns true when they have the same name, regardless of which flowers are contained within each `Bouquet`. This decision was made mainly to facilitate `DeleteBouquetCommand`, | ||
so we can simply call BouquetList.remove(BouquetToRemove) and the correct bouquet will be removed even if the BouquetToRemove is simply an empty `Bouquet` with the same name as the one in the list. | ||
|
||
After adding the `Bouquet` to `BouquetList`, the new `Bouquet` is then sent to `ui.printBouquetAdded`, where a confirmation message will be printed to the user. | ||
|
||
Removing Bouquets follows a similar logic, just that instead of calling `BouquetList.add(Bouquet)`, executing `DeleteBouquetCommand` calls `BouquetList.remove(Bouquet)`, removing the `Bouquet` as mentioned above. | ||
|
||
### Flower Information Command | ||
|
||
`info <flowerName>` command prints information about the specified flower | ||
|
||
![Info Command Sequence Diagram](/docs/UML-diagrams/Ian/InfoCommandUML.png) | ||
|
||
Step 1: Flower information mechanism utilize the `parser` class to parse user command for a specific flower name inputted. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The step numbers in the section below (Flower Remove Command) are in bold, should standardise the formatting? |
||
|
||
Step 2: Once `parser` detect that `info` keyword is used, it will instantiate `InfoCommand` class and run its `execute()` method. | ||
|
||
Step 3: `InfoCommand` class will call `printFlowerInfo()` method of `Ui` class | ||
|
||
Step 4: `get()` of `FlowerDictionary` class will then be called in order to retrive information about the specified flower. This information will be printed by the `Ui` class | ||
|
||
### Flower Remove Command | ||
|
||
`remove <flowerName> /q <quantity> /from <bouquetName>` removes flower(s) from a bouquet | ||
|
||
![Remove Command Sequence Diagram](UML-diagrams/Jeffinson/Jeffinson-UML-Remove.png); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
Removing flowers utilise the `parser` class to parse user command to identify which flower to remove, | ||
how much to remove and from which bouquet to remove. | ||
|
||
**Step 1:** User will input the flower name, quantity and bouquet name into the `Parser.parser()` method, after which `RemoveFlowerCommand` | ||
class will be instantiated and run its `execute()` method. | ||
|
||
**Step 2:** An object of type `RemoveFlowerCommand` is returned which contains the name, quantity of the flower to be added, and the target bouquet | ||
|
||
**Step 3:** Within the `RemoveFlowerCommand`, `execute()` method is called to execute the removal of flower command | ||
|
||
**Step 4:** The flowers are removed and a confirmation message is sent back to the user | ||
|
||
|Version| As a ... | I want to ... | So that I can ...| | ||
|--------|----------|---------------|------------------| | ||
|v1.0|new user|see usage instructions|refer to them when I forget how to use the application| | ||
|v2.0|user|find a to-do item by name|locate a to-do without having to go through the entire list| | ||
### Flower Help Command | ||
|
||
## Non-Functional Requirements | ||
`help` Shows a list of valid commands | ||
|
||
{Give non-functional requirements} | ||
![Help Command Sequence Diagram](UML-diagrams/Jeffinson/Jeffinson-UML-Help.png); | ||
|
||
## Glossary | ||
Help command utilises the `parser` class to identify the keyword `help` | ||
|
||
* *glossary item* - Definition | ||
**Step 1: ** User will write `help` and `HelpCommand` class will be instantiated and `execute()` method will run. | ||
|
||
## Instructions for manual testing | ||
**Step 2:** `HelpCommand` class will call `printHelpMessage()` method of `Ui` class | ||
|
||
{Give instructions on how to do a manual product testing e.g., how to load sample data to be used for testing} | ||
**Step 3:** The list of valid commands will be printed by the `Ui` class | ||
|
||
### Add Flower Command | ||
|
||
`add <flower> /q <quantity> /to <targetBouquet>` command adds specified number of flower to a bouquet | ||
|
||
![Add Flower Command Diagram](/docs/UML-diagrams/Ijaaz/Ijaaz-UML.png) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Diagram not showing up in the DG |
||
|
||
Step 1: Firstly the input is put into the `Parser.parse()` method to identify that it is infact an add flower command. | ||
|
||
Step 2: Then an object of type `AddFlowerCommand` is returned which contains the name, quantity of the flower to be added, as well as the target bouquet | ||
|
||
Step 3: The `execute()` method is called to execute the add flower command | ||
|
||
Step 4: The target bouquet, which is under model, is updated accordingly | ||
|
||
Step 5: A confirmation message is then sent back to the user | ||
|
||
### [Proposed] Storage | ||
|
||
#### Proposed Implementation: | ||
|
||
The proposed storage mechanism will utilize a class `storage` who is in charge of getting the file, `encoder` which will encode current model into a .txt file format, `decoder` which will decode .txt file into a usable model. | ||
|
||
![Storage Class Diagram](/docs/UML-diagrams/Ian/storage.png) | ||
|
||
#### Design Considerations: | ||
- Alternative 1 (current choice): use .txt files as storage | ||
- Pros: | ||
- Easier to implement | ||
- .txt file is very readable even outside of programme | ||
- Cons: | ||
- .txt file can be easily changed outside of programme, making storage of model prone to parsing failure | ||
- Alternative 2: use .csv files as storage | ||
- Pros: | ||
- A more standardize format that is easily accepted by other 3rd party software | ||
- Cons: | ||
- More difficulty to set up the decoder | ||
- .csv file can be easily changed outside of programme, making storage of model prone to parsing failure | ||
|
||
|
||
# Appendix: Requirements | ||
|
||
## Product scope | ||
|
||
### Target user profile: | ||
- has a need of purchasing a bouquet | ||
- prefers desktop apps over other types | ||
- can type reasonably fast | ||
- prefers typing to mouse interactions | ||
- is comfortable using CLI apps | ||
|
||
### Value proposition: | ||
- organise flowers faster than using a GUI driven app | ||
- curate flowers automatically based on context given through typed text | ||
|
||
## User Stories | ||
Priorities: High (must have) `* * *`, Medium (nice to have) `* *`, Low (unlikely to have) `*` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So are all the user stories here already implemented? Not very clear about that? |
||
|
||
| No | As a ... | I can ... | So that I can ... | Priority | | ||
|-----|-----------------|--------------------------------------------------|-------------------------------------------------------------------------------|----------| | ||
| 1 | first-time user | see an intro message detailing a command flow | easily know what commands to type | *** | | ||
| 2 | user | add flowers into my list | easily manage the list | *** | | ||
| 3 | user | remove flowers from my list | update my list of flowers | *** | | ||
| 4 | user | navigate a list of flowers | easily know what flowers to add to my bouquet | *** | | ||
| 5 | user | specify the occasion I am buying flowers for | get suggestion on appropriate flowers to buy without wasting time researching | *** | | ||
| 6 | user | make new bouquets | make multiple bouquets for different occasion | *** | | ||
| 7 | advanced user | see detailed information of each flower | be more knowledgeable in the flowers I buy | ** | | ||
| 8 | user | save my bouquets to hardware | view it for a later date | ** | | ||
| 9 | user | export my list of flowers to readable files | save and share it externally | ** | | ||
| 10 | advanced user | mix and match flowers manually | have a customised bouquet | ** | | ||
| 11 | user | filter flowers based on colours | add matching flowers into my bouquet | ** | | ||
| 12 | first-time user | type `help` for usage of command | better use the app | ** | | ||
| 13 | user | view an image of specified flower | better visualise how the bouquet will look like | ** | | ||
| 14 | user | calculate the approximate cost of bouquets | better budget my bouquet | * | | ||
| 15 | user | ask how to prepare bouquets | make my own bouquets from flowers I bought | * | | ||
| 16 | user | view locations of flower shops around me | buy fresh flower conveniently | * | | ||
|
||
## Use cases | ||
|
||
(For all all use cases below, the System is `Florizz` and the Actor is the `user`, unless specified otherwise) | ||
|
||
**Use case: Create a new bouquet named "for valentine" and add 3 stalks of rose into the bouquet** | ||
|
||
Main Success Scenario (MSS): | ||
1. User creates new bouquet named "for valentine" | ||
2. Programme responds that a new bouquet is successfully created | ||
3. User adds 3 stalks of rose into the bouquet | ||
4. Programme responds that the 3 stalks of rose has been successfully added | ||
5. Programme displays the current state of "for valentine" bouquet and all the flowers inside it | ||
|
||
** Use case: Removing flowers from a bouquet named "for valentine" ** | ||
|
||
Main Success Scenario (MSS): | ||
1. User removes 5 stalks of rose from the bouquet named "for valentine" | ||
2. Programme responds that 5 stalks of rose from the specified bouquet successfully | ||
3. Programme displays the current state of "for valentine" bouquet and all the flowers inside it | ||
|
||
**Extensions** | ||
- 1a. The bouquet named "for valentine" does not exist | ||
- 1a. Florizz shows an error message | ||
|
||
Use case ends. | ||
|
||
- 2a. There are less than 5 stalks of rose in the specified bouquet | ||
- 2a1. Florizz shows an error message | ||
|
||
Use case ends. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
@startuml | ||
'https://plantuml.com/sequence-diagram | ||
|
||
!define LOGIC_COLOUR #bcf5c9 | ||
!define LOGIC_COLOUR_T1 #3dfc6a | ||
!define MODEL_COLOUR #f5a2a2 | ||
!define MODEL_COLOUR_T1 #fc1e1e | ||
!define UI_COLOUR #FFDA17 | ||
!define UI_COLOUR_T1 #FFF5C0 | ||
@enduml |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Parser calling InfoCommand, is the arrow suppose to point to the start of InfoCommand's activation bar? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
@startuml | ||
'https://plantuml.com/sequence-diagram | ||
!include Ijaaz-style.puml | ||
|
||
actor "user" as user | ||
participant ":Florizz" as Florizz | ||
box Logic LOGIC_COLOUR | ||
participant ":Parser" as Parser LOGIC_COLOUR_T1 | ||
participant "a:InfoCommand" as InfoCommand LOGIC_COLOUR_T1 | ||
participant "b:FlowerDictionary" as FlowerDictionary LOGIC_COLOUR_T1 | ||
end box | ||
|
||
box Ui UI_COLOUR | ||
participant ":UI" as Ui UI_COLOUR_T1 | ||
end box | ||
|
||
[-> Florizz : execute("info rose") | ||
activate Florizz | ||
|
||
Florizz -> Parser : parse("info rose") | ||
activate Parser | ||
|
||
create InfoCommand | ||
Parser -> InfoCommand : InfoCommand("rose") | ||
activate InfoCommand | ||
|
||
InfoCommand --> Parser : a | ||
deactivate InfoCommand | ||
|
||
Parser --> Florizz : a | ||
deactivate Parser | ||
|
||
Florizz -> InfoCommand : execute() | ||
activate InfoCommand | ||
|
||
InfoCommand -> Ui : printFlowerInfo("rose") | ||
activate Ui | ||
|
||
Ui -> FlowerDictionary : get("rose") | ||
activate FlowerDictionary | ||
FlowerDictionary ---> Ui | ||
deactivate FlowerDictionary | ||
|
||
Ui --> InfoCommand | ||
deactivate Ui | ||
|
||
InfoCommand --> Florizz | ||
deactivate InfoCommand | ||
|
||
<--Florizz | ||
@enduml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
@startuml | ||
package "Storage Component" { | ||
class StorageManager { | ||
-URL: String | ||
+getFile(): void | ||
+retrieve(): Data | ||
+delete(): void | ||
} | ||
|
||
class Encoder { | ||
-bouquet: Bouquet | ||
+encodeBouquet(:bouquet): void | ||
} | ||
|
||
class Decoder { | ||
-bouquet: Bouquet | ||
+decodeBouquet(): Bouquet | ||
} | ||
|
||
StorageManager -- Encoder | ||
StorageManager -- Decoder | ||
} | ||
@enduml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
@startuml | ||
'https://plantuml.com/sequence-diagram | ||
!include Ijaaz-style.puml | ||
|
||
actor "user" as user | ||
participant ":Florizz" as Florizz | ||
box Logic LOGIC_COLOUR | ||
participant ":Parser" as Parser LOGIC_COLOUR_T1 | ||
participant "a:AddFlowerCommand" as AddFlowerCommand LOGIC_COLOUR_T1 | ||
end box | ||
|
||
box Model MODEL_COLOUR | ||
participant ":Model" as Model MODEL_COLOUR_T1 | ||
end box | ||
|
||
[-> Florizz : execute("add rose /q 1 /to mum") | ||
activate Florizz | ||
|
||
Florizz -> Parser : parse("add rose /q 1 /to mum") | ||
activate Parser | ||
|
||
create AddFlowerCommand | ||
Parser -> AddFlowerCommand : AddFlowerCommand("rose", 1, "mum") | ||
activate AddFlowerCommand | ||
|
||
AddFlowerCommand --> Parser : a | ||
deactivate AddFlowerCommand | ||
|
||
Parser --> Florizz : a | ||
deactivate Parser | ||
|
||
Florizz -> AddFlowerCommand : execute() | ||
activate AddFlowerCommand | ||
|
||
AddFlowerCommand -> Model : addFlower("rose", 1) | ||
activate Model | ||
|
||
Model --> AddFlowerCommand | ||
deactivate Model | ||
|
||
AddFlowerCommand --> Florizz | ||
deactivate AddFlowerCommand | ||
|
||
<--Florizz | ||
@enduml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section is quite long, maybe can change to point form?