Skip to content
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

Final pr for dg, ug and ppp #181

Merged
merged 2 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 11 additions & 18 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Help command utilises the `parser` class to identify the keyword `help`

`add <flower> /q <quantity> /to <targetBouquet>` command adds specified number of flower to a bouquet

![Add Flower Command Diagram](UML-diagrams/Ijaaz/Ijaaz-UML.png)
![Add Flower Command Diagram](UML-diagrams/Ijaaz/AddFlowerCommand.png)

**Step 1:** Firstly the input is put into the `Parser.parse()` method to identify that it is infact an add flower command.

Expand Down Expand Up @@ -145,28 +145,21 @@ Step 4: Ui.printCompareFlowers() is called to print the comparison of the two fl

Step 5: A table is printed out to the user showing the comparison between the two flowers

### [Proposed] Storage
### Save Command

#### Proposed Implementation:
`save <bouquetName>` command adds specified number of flower to a bouquet

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.
![Save Command Diagram](UML-diagrams/Ijaaz/SaveCommand.png)

![Storage Class Diagram](UML-diagrams/Ian/storage.png)
Step 1: Firstly the input is put into the `Parser.parse()` method to identify that it is infact a save command.

#### 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
Step 2: Then an object of type `SaveCommand` is returned which contains the name of the bouquet to be saved

Step 3: The `execute()` method is called to execute the save command

Step 4: The target bouquet is then sent to Storage to be saved locally

Step 5: A confirmation message is then sent back to the user

# Appendix: Requirements

Expand Down
Binary file removed docs/UML-diagrams/Ijaaz/(old)Ijaaz-UML.png
Binary file not shown.
Binary file added docs/UML-diagrams/Ijaaz/AddFlowerCommand.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
62 changes: 62 additions & 0 deletions docs/UML-diagrams/Ijaaz/AddFlowerCommand.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
@startuml
'https://plantuml.com/sequence-diagram
!include Ijaaz-style.puml

actor "user" as user
box Ui UI_COLOUR
participant ":Ui" as Ui UI_COLOUR_T1
end box
participant ":Florizz" as Florizz
box Logic LOGIC_COLOUR
participant ":Parser" as Parser LOGIC_COLOUR_T1
participant ":FuzzyLogic" as Fuzzy 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

user -> Ui : readInput("add rose /c red /q 1 /to mum")
activate Ui

Ui -> Florizz : execute("add rose /c red /q 1 /to mum")
activate Florizz

Florizz -> Parser : parse("add rose /c red /q 1 /to mum")
activate Parser

Parser -> Fuzzy : CommandHandler(""add rose /c red /q 1 /to mum")
activate Fuzzy

Fuzzy --> Parser : {"add","Rose /c red /q 1 /to mum", null}
deactivate Fuzzy

Parser -> Parser : handleAddFlowerCommand()

create AddFlowerCommand
Parser -> AddFlowerCommand : AddFlowerCommand("rose", "red", 1, "mum")
activate AddFlowerCommand

AddFlowerCommand --> Parser : a
deactivate AddFlowerCommand

Parser --> Florizz : a
deactivate Parser

Florizz -> AddFlowerCommand : execute()
activate AddFlowerCommand

AddFlowerCommand -> Model : addFlower("rose", "red", 1)
activate Model

Model --> AddFlowerCommand
deactivate Model

AddFlowerCommand --> Ui : printAddFlowerSuccess()
Ui --> user : "Successfully added..."
deactivate Ui

AddFlowerCommand --> Florizz : true
deactivate AddFlowerCommand
@enduml
Binary file removed docs/UML-diagrams/Ijaaz/Ijaaz-UML.png
Binary file not shown.
46 changes: 0 additions & 46 deletions docs/UML-diagrams/Ijaaz/Ijaaz-UML.puml

This file was deleted.

4 changes: 3 additions & 1 deletion docs/UML-diagrams/Ijaaz/Ijaaz-style.puml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@startuml
@startuml
'https://plantuml.com/sequence-diagram

!define LOGIC_COLOUR #bcf5c9
Expand All @@ -7,4 +7,6 @@
!define MODEL_COLOUR_T1 #fc1e1e
!define UI_COLOUR #FFDA17
!define UI_COLOUR_T1 #FFF5C0
!define STORAGE_COLOUR #9fb5f5
!define STORAGE_COLOUR_T1 #3667f5
@enduml
Binary file added docs/UML-diagrams/Ijaaz/SaveCommand.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 71 additions & 0 deletions docs/UML-diagrams/Ijaaz/SaveCommand.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
@startuml
'https://plantuml.com/sequence-diagram

!include Ijaaz-style.puml

actor "user" as user
box Ui UI_COLOUR
participant ":Ui" as Ui UI_COLOUR_T1
end box
participant ":Florizz" as Florizz
box Logic LOGIC_COLOUR
participant ":Parser" as Parser LOGIC_COLOUR_T1
participant ":FuzzyLogic" as Fuzzy LOGIC_COLOUR_T1
participant "s:SaveCommand" as SaveCommand LOGIC_COLOUR_T1
end box

box Model MODEL_COLOUR
participant ":Model" as Model MODEL_COLOUR_T1
end box

box Storage STORAGE_COLOUR
participant ":Storage" as Storage STORAGE_COLOUR_T1
end box

user -> Ui : readInput("save mum")
activate Ui

Ui -> Florizz : execute("save mum")
activate Florizz

Florizz -> Parser : parse("save mum")
activate Parser

Parser -> Fuzzy : CommandHandler("save mum")
activate Fuzzy

Fuzzy --> Parser : {"save","mum", null}
deactivate Fuzzy

create SaveCommand
Parser -> SaveCommand : SaveCommand("mum")
activate SaveCommand

SaveCommand --> Parser : s
deactivate SaveCommand

Parser --> Florizz : s
deactivate Parser

Florizz -> SaveCommand : execute()
activate SaveCommand

SaveCommand -> Model : bouquetList.get(idx)
activate Model

Model --> SaveCommand : bouquetToSave
deactivate Model

SaveCommand -> Storage : saveBouquet(bouquetToSave)
activate Storage

Storage --> SaveCommand
deactivate Storage

SaveCommand --> Ui : printSaveSuccess()
Ui --> user : "Successfully saved..."
deactivate Ui

SaveCommand --> Florizz : true
deactivate SaveCommand
@enduml
26 changes: 3 additions & 23 deletions docs/team/ijaaz01.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,35 +33,15 @@ flowers to put into a bouquet for various occasions.
flowers related to a specific occasion if one was specified.

* **Enhancements to Existing Features**
* Helped to change the logic of the `recommend command` mostly implemented by my teammate Ian, so that it did not kick
* Helped to change the logic of the `recommend` command mostly implemented by my teammate Ian, so that it did not kick
users out of 'recommend mode' when given a bad input. [proof](https://github.com/AY2324S2-CS2113-T11-3/tp/pull/155/files)
* Updated the `info` command to allow it to display the information for a flower even if its meaning and ocassions had
no entries. This required updating the item key for the fuzzy logic function implemented by my teammate Jeff. [proof](https://github.com/AY2324S2-CS2113-T11-3/tp/pull/157/files)

* **Documentation**
* **UG**:
### List all available flowers: `flowers`
List all available flowers in the database currently, also able to filter presented flowers according to occasion
### Save a bouquet to device: `save`
Saves chosen bouquet, if it exists, locally to the users device

Format: `save <bouquetName>`

- Bouquet must exist before it can be saved

Examples:
- `save moms bouquet`

Expected Output:
```
Successfully saved moms bouquet. You can find it at 'florizz-out/saved/moms bouquet.txt
```
### Autosave
Florizz automatically backs up all your bouquet data onto your device in a `FlorizzBouquets.txt` file.
As such the user can transfer their bouquet data between devices by simply moving the text file to the `florizz-out/data/`
folder. However, editing this text file is not recommended as the format is very specific, so users
should do so at their own risk
* Added documentation for `save` and `flowers` as well as AutoSave

* **DG**:
![Add Flower Command Diagram](/docs/UML-diagrams/Ijaaz/(old)Ijaaz-UML.png)
* Created sequence diagrams for save command and addFlower command

2 changes: 2 additions & 0 deletions src/test/java/florizz/core/ParserTest.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package florizz.core;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;

class ParserTest {
Expand Down
Loading