Skip to content

Commit

Permalink
Merge branch 'master' into MI-final
Browse files Browse the repository at this point in the history
  • Loading branch information
Ijaaz01 committed Apr 15, 2024
2 parents e84c03a + 444a5f2 commit de65788
Show file tree
Hide file tree
Showing 19 changed files with 422 additions and 151 deletions.
68 changes: 6 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,8 @@
# Duke project template
# Florizz

This is a project template for a greenfield Java project. It's named after the Java mascot _Duke_. Given below are instructions on how to use it.
An easy-to-use bouquet recommendation software using CLI.

## Setting up in Intellij

Prerequisites: JDK 11 (use the exact version), update Intellij to the most recent version.

1. **Ensure Intellij JDK 11 is defined as an SDK**, as described [here](https://www.jetbrains.com/help/idea/sdk.html#set-up-jdk) -- this step is not needed if you have used JDK 11 in a previous Intellij project.
1. **Import the project _as a Gradle project_**, as described [here](https://se-education.org/guides/tutorials/intellijImportGradleProject.html).
1. **Verify the set up**: After the importing is complete, locate the `src/main/java/seedu/duke/Duke.java` file, right-click it, and choose `Run Duke.main()`. If the setup is correct, you should see something like the below:
```
> Task :compileJava
> Task :processResources NO-SOURCE
> Task :classes
> Task :Duke.main()
Hello from
____ _
| _ \ _ _| | _____
| | | | | | | |/ / _ \
| |_| | |_| | < __/
|____/ \__,_|_|\_\___|
What is your name?
```
Type some word and press enter to let the execution proceed to the end.

## Build automation using Gradle

* This project uses Gradle for build automation and dependency management. It includes a basic build script as well (i.e. the `build.gradle` file).
* If you are new to Gradle, refer to the [Gradle Tutorial at se-education.org/guides](https://se-education.org/guides/tutorials/gradle.html).

## Testing

### I/O redirection tests

* To run _I/O redirection_ tests (aka _Text UI tests_), navigate to the `text-ui-test` and run the `runtest(.bat/.sh)` script.

### JUnit tests

* A skeleton JUnit test (`src/test/java/seedu/duke/DukeTest.java`) is provided with this project template.
* If you are new to JUnit, refer to the [JUnit Tutorial at se-education.org/guides](https://se-education.org/guides/tutorials/junit.html).

## Checkstyle

* A sample CheckStyle rule configuration is provided in this project.
* If you are new to Checkstyle, refer to the [Checkstyle Tutorial at se-education.org/guides](https://se-education.org/guides/tutorials/checkstyle.html).

## CI using GitHub Actions

The project uses [GitHub actions](https://github.com/features/actions) for CI. When you push a commit to this repo or PR against it, GitHub actions will run automatically to build and verify the code as updated by the commit/PR.

## Documentation

`/docs` folder contains a skeleton version of the project documentation.

Steps for publishing documentation to the public:
1. If you are using this project template for an individual project, go your fork on GitHub.<br>
If you are using this project template for a team project, go to the team fork on GitHub.
1. Click on the `settings` tab.
1. Scroll down to the `GitHub Pages` section.
1. Set the `source` as `master branch /docs folder`.
1. Optionally, use the `choose a theme` button to choose a theme for your documentation.
Useful links:
* [User Guide](docs/UserGuide.md)
* [Developer Guide](docs/DeveloperGuide.md)
* [About Us](docs/AboutUs.md)
8 changes: 4 additions & 4 deletions docs/AboutUs.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

Display | Name | Github Profile | Portfolio
--------|:-------------------:|:----------------------------------------------:|:---------:
![](https://via.placeholder.com/100.png?text=Photo) | Ian Freda Hariyanto | [Github](https://github.com/IanFH) | [Portfolio](docs/team/ianfh.md)
![](https://via.placeholder.com/100.png?text=Photo) | Mohamed Ijaaz | [Github](https://github.com/Ijaaz01) | [Portfolio](docs/team/ijaaz01.md)
![](https://via.placeholder.com/100.png?text=Photo) | Jeffinson Darmawan | [Github](https://github.com/JeffinsonDarmawan) | [Portfolio](docs/team/jeffinsondarmawan.md)
![](https://via.placeholder.com/100.png?text=Photo) | Samuel Ong | [Github](https://github.com/samuelory) | [Portfolio](docs/team/samuelory.md)
![](https://via.placeholder.com/100.png?text=Photo) | Ian Freda Hariyanto | [Github](https://github.com/IanFH) | [Portfolio](team/ianfh.md)
![](https://via.placeholder.com/100.png?text=Photo) | Mohamed Ijaaz | [Github](https://github.com/Ijaaz01) | [Portfolio](team/ijaaz01.md)
![](https://via.placeholder.com/100.png?text=Photo) | Jeffinson Darmawan | [Github](https://github.com/JeffinsonDarmawan) | [Portfolio](team/jeffinsondarmawan.md)
![](https://via.placeholder.com/100.png?text=Photo) | Samuel Ong | [Github](https://github.com/samuelory) | [Portfolio](team/samuelory.md)

84 changes: 66 additions & 18 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,41 @@ 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
### Flower Help Command

`help` Shows a list of valid commands

![Help Command Sequence Diagram](UML-diagrams/Jeffinson/Jeffinson-UML-Help.png);

Help command utilises the `parser` class to identify the keyword `help`

**Step 1:** User will write `help` and `HelpCommand` class will be instantiated and `execute()` method will run.

**Step 2:** `HelpCommand` class will call `printHelpMessage()` method of `Ui` class

**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](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.

**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

### Remove Flower Command

`remove <flowerName> /q <quantity> /from <bouquetName>` removes flower(s) from a bouquet

![Remove Command Sequence Diagram](UML-diagrams/Jeffinson/Jeffinson-UML-Remove.png);
![Remove Command Sequence Diagram](UML-diagrams/Jeffinson/Jeffinson-UML-Remove.png)

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.
Expand All @@ -67,35 +97,53 @@ class will be instantiated and run its `execute()` method.

**Step 4:** The flowers are removed and a confirmation message is sent back to the user

### Flower Help Command
### Recommend Command

`help` Shows a list of valid commands
`recommend` recommends a bouquet based on user input

![Help Command Sequence Diagram](UML-diagrams/Jeffinson/Jeffinson-UML-Help.png);
![Recommend Command Sequence Diagram](UML-diagrams/Ian/RecommendCommand.png)
*simplified version of the sequence diagram*

Help command utilises the `parser` class to identify the keyword `help`
**Step 1:** User will input `recommend` into the CLI, which will be parsed by the `parser` class to identify.

**Step 1: ** User will write `help` and `HelpCommand` class will be instantiated and `execute()` method will run.
**Step 2:** `RecommendCommand` class will be instantiated and run its `execute()` method.

**Step 2:** `HelpCommand` class will call `printHelpMessage()` method of `Ui` class
**Step 3:** Various methods will be called to get the user input. In order, the methods are `askOccasion(...)`, `askColour(...)`, `askSize(...)`, `askBouquetName(...)`, `askSize()`, `addRandomFlowers()`, `askSaveBouquet()`.

**Step 3:** The list of valid commands will be printed by the `Ui` class
#### askOccasion(...)

### Add Flower Command
A deeper look into the `askOccasion(...)` method

`add <flower> /q <quantity> /to <targetBouquet>` command adds specified number of flower to a bouquet
![askOccasion Sequence Diagram](UML-diagrams/Ian/askOccasion.png)

![Add Flower Command Diagram](UML-diagrams/Ijaaz/AddFlowerCommand.png)
**Step 1:** `askOccasion(...)` method will call `Ui.askOccasion()` to get the user input.

Step 1: Firstly the input is put into the `Parser.parse()` method to identify that it is infact an add flower command.
**Step 2:** `askOccasion(...)` method will call `Parser` to validate the format of user input.

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:** `askOccasion(...)` method will check with `Flower` class to see if the occasion is valid.

Step 3: The `execute()` method is called to execute the add flower command
**Step 4:** once format is validated and the occasion inputted is valid, the method will return the occasion.

Step 4: The target bouquet, which is under model, is updated accordingly
#### askColour(...), askSize(...), askBouquetName(...), askSize(...), addRandomFlowers(...), askSaveBouquet()

Step 5: A confirmation message is then sent back to the user
The other methods will follow a similar structure as `askOccasion(...)` method, where the user input is taken, validated, and then stored in the `RecommendCommand` class to be further processed.

### Compare Flower Command

`compare <flower1> /vs/ <flower2>` command compares two flowers based on their flowers names.

![Compare Flower Command Diagram](UML-diagrams/Jeffinson/Jeffinson-UML-compare.png)

Step 1: User will input the two flower names into the `Parser.parse()` method to identify the `compare` command keyword
and the presence of the 2 flowers in the userInput to compare

Step 2: An object of type `CompareCommand` is then returned which contains the names of the two flowers to be compared.

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

Step 4: Ui.printCompareFlowers() is called to print the comparison of the two flowers

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

### Save Command

Expand Down Expand Up @@ -163,7 +211,7 @@ Main Success Scenario (MSS):
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" **
**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"
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Florizz

An easy to use bouquet recomendation software using CLI
An easy to use bouquet recommendation software using CLI

Useful links:
* [User Guide](UserGuide.md)
Expand Down
Binary file added docs/UML-diagrams/Ian/RecommendCommand.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/UML-diagrams/Ian/askOccasion.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions docs/UML-diagrams/Ian/askOccasion.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@startuml
'https://plantuml.com/sequence-diagram
!include Ian-style.puml

box Logic LOGIC_COLOUR
participant ":Parser" as Parser LOGIC_COLOUR_T1
participant "a:RecommendCommand" as RecommendCommand LOGIC_COLOUR_T1
participant "b:Flower" as Flower LOGIC_COLOUR_T1

box Ui UI_COLOUR
participant ":Ui" as Ui UI_COLOUR_T1

activate RecommendCommand

loop !isValidFormat && !isValidOccasion
RecommendCommand -> Ui : printAskOccasion()

activate Ui
Ui --> RecommendCommand : input
deactivate Ui

RecommendCommand -> Parser : parseOccasion(input)
activate Parser
Parser --> RecommendCommand : isValidFormat
deactivate Parser

RecommendCommand -> Flower : isValidOccasion()
activate Flower
Flower --> RecommendCommand :isValidOccasion
deactivate Flower

end
@enduml
42 changes: 42 additions & 0 deletions docs/UML-diagrams/Ian/command.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
@startuml
'https://plantuml.com/sequence-diagram
!include Ian-style.puml

actor "user" as user
participant ":Florizz" as Florizz
box Logic LOGIC_COLOUR
participant ":Parser" as Parser LOGIC_COLOUR_T1
participant "a:RecommendCommand" as RecommendCommand LOGIC_COLOUR_T1

[-> Florizz : execute("recommend")
activate Florizz

Florizz -> Parser : parse("recommend")
activate Parser

create RecommendCommand
Parser -> RecommendCommand : RecommendCommand("rose")
activate RecommendCommand

RecommendCommand --> Parser : a
deactivate RecommendCommand

Parser --> Florizz : a
deactivate Parser

Florizz -> RecommendCommand : execute()
activate RecommendCommand

RecommendCommand -> RecommendCommand: askOccasion(...)
RecommendCommand -> RecommendCommand: askColour(...)
RecommendCommand -> RecommendCommand: askBouquetName(...)
RecommendCommand -> RecommendCommand: askSize(...);
RecommendCommand -> RecommendCommand: addRandomFlowers(...)
RecommendCommand -> RecommendCommand: askSaveBouquet(...);

RecommendCommand --> Florizz
deactivate RecommendCommand

<--Florizz
deactivate Florizz
@enduml
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/UML-diagrams/Jeffinson/Jeffinson-UML-Remove.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 56 additions & 0 deletions docs/UML-diagrams/Jeffinson/Jeffinson-UML-compare.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
@startuml
!include Jeffinson-style.puml

actor "user" as user
participant ":Florizz" as Florizz
box Logic LOGIC_COLOUR
participant ":Parser" as Parser LOGIC_COLOUR_T1
participant "a:CompareCommand" as CompareCommand 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("compare rose /vs/ lily")
activate Florizz

Florizz -> Parser : parse("compare rose /vs/ lily")
activate Parser

create CompareCommand
Parser -> CompareCommand : CompareCommand("rose", "lily")
activate CompareCommand

CompareCommand --> Parser : a
deactivate CompareCommand

Parser --> Florizz : a
deactivate Parser

Florizz -> CompareCommand : execute()
activate CompareCommand

CompareCommand -> Ui : printCompareFlowers("rose")
activate Ui

Ui -> FlowerDictionary : get("rose")
activate FlowerDictionary
FlowerDictionary ---> Ui
deactivate FlowerDictionary

Ui -> FlowerDictionary : get("lily")
activate FlowerDictionary
FlowerDictionary ---> Ui
deactivate FlowerDictionary

Ui --> CompareCommand
deactivate Ui

CompareCommand --> Florizz
deactivate CompareCommand

<--Florizz
deactivate Florizz
@enduml
Loading

0 comments on commit de65788

Please sign in to comment.