-
Notifications
You must be signed in to change notification settings - Fork 89
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-T17-2] CafeCTRL #14
base: master
Are you sure you want to change the base?
Changes from 250 commits
c2e5d0c
0dc39bb
1f53b9c
32a18bb
1c9c475
002138b
e60a02a
3ef9520
df55bc8
ede4342
9c80fc3
8d2f29e
b4acb84
ad81169
c460bae
23d7f8b
5de6fc9
6f7526d
11dc0cb
1a0025b
13f73b0
cba4af9
6f934de
92a3073
600ede0
b522977
a516273
0fda7d9
59359ef
363a89b
6d5c64a
ed8fabf
c4c0009
b42e44c
ff06160
a122c3f
0a2996a
fa189ae
0b28754
68a532c
90d7528
00d977d
03cc365
e76fc31
4aadb07
0962c62
1860742
68698da
bfe545c
16dca45
257540b
7536828
7d79f50
3876bb9
b54b380
35115ad
41b693e
2579e3e
62a6099
8311bd9
2ef94c7
8472c4b
af9d862
ced653f
f26744b
8b103eb
459144d
c65114d
22af8c0
de520bb
8c3b0c6
124baf2
6396a80
3cf0e86
f98139d
419eb11
d1abc91
f6dad25
e42c6d7
28d2c33
66becd9
88182f0
6556585
b721daa
e8e7e10
5ed0008
24a11c1
d9c82f2
296f71d
ce52191
57023da
237419d
0e8a2c0
ddbe823
3fa34de
0b64876
d54d01c
78093ff
3c0f2dd
f300a74
4df42b0
8d2a283
da86bbe
4f9540d
e594262
1357238
273c063
2bbca99
4abbf3f
77e1c72
f0e1bdd
1212ef6
4a20b29
6a15c01
5c1113c
b897297
327b44a
b1096d9
bc62c5b
50902a6
a9d282f
648e9fe
bc6bac8
9784662
f05609b
96151da
775f7cc
709c0bd
025dc44
c468153
4a5bdf8
14d5b0e
9b94d06
8c6a5c9
3b38993
7ae759b
b7c08b6
41b6693
0fd634e
9ea67c5
bcd42b3
16697bd
bce2ee1
18594eb
590597b
e4716bb
ec219d7
b3cde80
bb544ab
1f60e2a
fbc355c
5495765
3fece68
a83defa
aed269d
b0a0cbf
70bb27a
3cf1e03
46ba05d
927feec
6d2e8b2
7795bac
4a5519d
44d728c
ad6fa2b
ac8fddf
fac41f1
173bc37
d8bfe96
b78cee5
2dcaa35
3a93909
80b464e
d007813
2734620
8d30658
d4031eb
ff72eb0
16ff7a4
7c4962d
3f5d746
177c979
ba4f595
e27a795
fbdfc4c
9032698
4992ae3
ad1f273
f72cc6e
561f74e
5ebca21
ddd88c7
12e639b
45fd69c
ba27496
855d4ce
fd79c2b
69718b9
393beca
c5f18e0
e0ac8d3
956634e
3a9d442
3d9d018
e75d6a3
52ad74a
6db47af
bf4eedd
35f30a7
d16bbb7
61a1ef6
25e7d39
43a2ebd
1f1ff80
eaed86f
3cdc854
234c862
2af72b1
90e66d7
7e02db4
62f49ea
2eabb48
7f513db
475cdce
ade34a1
2859132
ba5a021
6c8a74d
891f03e
289ee61
5ea7df4
5680041
1855718
e338697
82fed56
fae600f
36ad50e
7f0ddcf
9c6bbb5
2b02dd5
e61fef9
781b9e6
0c7dfcc
69eabbc
826b3e3
56cd519
01dd638
1923eba
825ed91
56507bd
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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
# 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) | Shanice | [Github](https://github.com/ShaniceTang) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Naychi | [Github](https://github.com/NaychiMin/tp) | [Portfolio](docs/team/johndoe.md) | ||
![](https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.scmp.com%2Fweek-asia%2Fpolitics%2Farticle%2F3095228%2Fmalaysia-najibs-cheesy-super-ring-jibe-comes-back-bite-him-after&psig=AOvVaw2ohFjBBhoZxtARfOKEnTXE&ust=1696586245977000&source=images&cd=vfe&opi=89978449&ved=0CBEQjRxqFwoTCJiboLbS3oEDFQAAAAAdAAAAABAE) | Zi Yi | [Github](https://github.com/ziyi105) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Dexter Hoon | [Github](https://github.com/DextheChik3n) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Chua Zhong Heng | [Github](https://github.com/Cazh1/tp) | [Portfolio](docs/team/johndoe.md) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,10 +4,154 @@ | |
|
||
{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 | ||
|
||
{Describe the design and implementation of the product. Use UML diagrams and short code snippets where applicable.} | ||
### Parser | ||
API: [Parser.java]({repoURL}src/main/java/seedu/cafectrl/parser/Parser.java) | ||
|
||
![Parser Class Diagram](images/class/Parser.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. The accessibility of a variable or method should be + (public) or - (private) instead of colours by default in plantUML |
||
|
||
*Figure 1: Parser Class Diagram* | ||
|
||
Note that `CafeCtrl` only have access to the interface `ParserUtil` although the run-time type object is `Parser`. With this, we are able to decrease coupling between `CafeCtrl` and `Parser`, allowing for easier maintenance. This also ensures the testability as we could provide mock or stub dependencies during testing, we could isolate the behavior of the class and focus on unit testing without external dependencies. | ||
|
||
![Parser Parsing User Input Sequence Diagram](images/sequence/Parser.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. Alt should have multiple braches, if there's only one possible branch, should use opt instead |
||
|
||
*Figure 2: Parser Parsing User Input Sequence Diagram* | ||
|
||
When user input a string to `Main`, it passes the full user input to `Parser` via `parseCommand`. In `parseCommand`, it finds the matching keyword for different command from the user input, then it calls the respective `prepareCommand` method within `Parser`. `prepareCommand` then generates the corresponding command class and return it to `parseCommand`, which returns the `Command` back to `Main` for execution. | ||
|
||
### Storage | ||
API: [Storage.java]({repoURL}src/main/java/seedu/cafectrl/storage/Storage.java) | ||
|
||
![Storage Class Diagram](images/class/Storage.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. Same issue regarding accessibility as before 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 storage class diagram does not follow CS2113 standard. You may want to look at the notes. For example, shouldn't have the C logo etc. |
||
|
||
*Figure 3: Storage Class Diagram* | ||
|
||
The `Storage` class, | ||
- loads and saves the list of dishes on the `Menu`, available ingredient stock in `Pantry` and orders for the day in `OrderList` in a text file. | ||
- depends on `Menu`, `Pantry` and `Sales` objects (which are found in the data package). | ||
- is composed of `FileManager` object as the text file needs to be located first before reading or writing. | ||
|
||
## Features | ||
|
||
### Add Dish | ||
|
||
![Add Dish Execution](images/sequence/AddDishCommand_execute.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. No figure number |
||
*Figure X: Execution of add_dish command* | ||
|
||
API: [AddDishCommand.java](https://github.com/AY2324S1-CS2113-T17-2/tp/blob/master/src/main/java/seedu/cafectrl/command/AddDishCommand.java) | ||
|
||
The `add_dish` command, add a dish to the `Menu` object and prints out a formatted message to state the name, price and ingredients entered for the dish. | ||
|
||
when the `execute()` method from `AddDishCommand` is called in the main class `CafeCtrl`, the `addDish()` method is first called to add the `Dish` object to the `Menu`. It will then call the `printAddDishMessage()` method, which gets all the parameters of the `Dish` object (dishName, dishPrice, dishIngredients) and passes them to the `Ui` to then be printed out to the User. | ||
|
||
Separation of Concerns was applied to ensure the `Ui` is only responsible with only displaying messages while the `Menu` deals with the logic of adding dish to the menu. This implementation also encapsulates the details of adding a dish and displaying messages. For example, The `AddDishCommand` class doesn't need to know how the internal details of the dish adding and message printing are performed. | ||
|
||
### Adding a Dish | ||
|
||
### List Menu | ||
A `list_menu` command can be used to display all the `Dish` objects stored in `Menu`. | ||
|
||
The following class diagram illustrates the relationship between the respective classes involved in the creation and execution of a list_menu command. | ||
![List Menu Execution](images/class/ListMenuCommandClass.png) | ||
|
||
![List Menu Execution](images/sequence/ListMenuCommand_execute.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. Adding the number for each step is not necessary |
||
Figure 1: Execution of list_menu command | ||
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. Why is this figure 1? |
||
|
||
API: [ListMenuCommand.java]({repoURL}src/main/java/seedu/cafectrl/command/ListMenuCommand.java) | ||
|
||
When the `execute()` method of ListMenuCommand is invoked in Main, it checks if the size of the menu by running `menu.getSize()`. | ||
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. It's nice to check whether the list is empty or not before the execution. |
||
|
||
1) If the menu is empty, it will call its `printEmptyMenu()` method to display to the user a `MENU_EMPTY_MESSAGE` in the Ui object and returns afterward. | ||
2) If the menu is not empty, it will call its `printFullMenu()` method. | ||
`printFullMenu()` will first print the top portion of the menu using the Ui object. | ||
It then iterates through the `Dish` objects in `Menu` in a "for" loop, using `menu.getDishFromId()` to retrieve the Dish object. | ||
The `dishName` and `dishPrice` are both access from `Dish` Class using `getName()` and `getPrice()` respectively. | ||
The data are then packaged nicely in a `leftAlignFormat`, with (indexNum + ". " + dishName," $" + dishPrice) such that | ||
e.g. (1. Chicken Rice $2.50) is shown. | ||
|
||
### Add Order | ||
A add_order command can be used to add `order` to an `orderList` in `Sales`. | ||
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. 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. Noted, thanks! |
||
|
||
The following class diagram illustrates the relationship between the respective classes involved in the creation and execution of an add_order command. | ||
![Add_Order Execution](images/class/AddOrderCommandClass.png) | ||
|
||
![Add_order Execution](images/sequence/AddOrderCommand_execute.png) | ||
|
||
Figure 1: Execution of add_order command | ||
|
||
API: [AddOrderCommand.java]({repoURL}src/main/java/seedu/cafectrl/command/ListMenuCommand.java) | ||
|
||
When the `execute()` method of AddOrderCommand is invoked in Main, the parsed `order` object is added to the `orderList`. | ||
|
||
A `Chef` object is then created to process the order by running `cookDish()`. | ||
This method first checks if the order has already been completed by running `order.getIsCompleted()`. | ||
If the order has not been completed, the `showDeleteMesage()` in the Ui component is triggered to display a message to show the user that the dish is being 'prepared'. | ||
An ArrayList of Ingredients, ingredientList, is retrieved from the `order` object by `order.getIngredientList()`. | ||
This ingredientList is passed into the `pantry` object in `pantry.decreaseIngredientsStock()` to process the ingredients used from the pantry stock. | ||
The order is then marked as completed by `order.setComplete()` | ||
|
||
Returning to the AddOrderCommand, the `order` object is checked to be completed again by running `order.getIsCompleted()`. | ||
This verifies that the ingredientList has been successfully retrieved and passed into `pantry.decreaseIngredientsStock()` to run without errors. | ||
After verifying that the order has been completed, the cost of the order is added to the total order by `orderList.addCost()`. | ||
|
||
The total sum of orders in the `orderList` object is retrieved using `orderList.getTotalCost()`. | ||
This is then passed into Ui using `ui.showTotalCost()` to display a message to the user with the total order cost. | ||
|
||
### List Ingredients | ||
![List Ingredient Execution](images/sequence/ListIngredientCommand_execute.png) | ||
|
||
*Figure 2: Execution of list_ingredient command* | ||
|
||
API: [ListIngredientCommand.java]({repoURL}src/main/java/seedu/cafectrl/command/ListIngredientCommand.java) | ||
|
||
| No | Step | Description | | ||
|----|-------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| 1 | Initialization | The sequence begins with the `Main` class invoking the `execute` method of the `ListIngredientCommand` after parsing a user command. | | ||
| 2-3 | Interaction with 'Menu' | The `ListIngredientCommand` communicates with the `Menu` class, invoking the `getMenuItemsList()` method to retrieve a list of menu items. The function returns an ArrayList of objects of 'Dish' type. | | ||
| 4 | Interaction with 'Ui' | The `ListIngredientCommand` communicates with the `Ui` class, invoking the `printIngredients()` method to print out the list of ingredients used for the selected dish. <br/> * The function returns an ArrayList of objects of 'Dish' type. The `get()` method is then invoked to get the dish of the specified index. However, this is ommitted to prevent unnecessary sophistication. | | ||
| 5-6 | Interaction with 'Dish' | The `Ui` class communicates with the `Dish` class, invoking the `getIngredients()` method to obtain the list of ingredients for the selected dish. The `Dish` class responds with an ArrayList of objects of 'Ingredient' type to the `Ui` class. | | ||
| 7-8 | Iteration through Ingredients | There is a loop that iterates through each ingredient in the list. The `Ui` class interacts with the `Ingredients` class, converting each ingredient to a string containing the ingredient and quantity needed. | | ||
| 9-10 | Display to User | The `Ui` class showcases the information to the user through the `showToUser()` method. | | ||
|
||
### Delete Dish | ||
|
||
![Delete Dish Execution](images/sequence/DeleteDishCommand_execute.png) | ||
<br>*Figure X: Execution of delete dish command | ||
|
||
API: [DeleteDishCommand.java]({repoURL}src/main/java/seedu/cafectrl/command/DeleteDishCommand.java) | ||
|
||
When the `execute()` method of `DeleteDishCommand` is invoked in `Main`, it subsequently calls `getMenuItemsList().get(dishIndexToBeDeleted)` method on the `Menu` object to retrieve the `Dish` object to be deleted. | ||
Following this, the `showDeleteMesage()` method in the Ui component is triggered to display a message to show the user which dish is about to be deleted. | ||
Afterward, `DeleteDishCommand` calls `removeDish(dishIndexToBeDeleted)` of the `Menu` object to remove the selected dish at the index indicated by the user. | ||
This sequence of actions orchestrates the flow of information and operations between `Main`, `DeleteDishCommand`, `Menu`, and `Ui` components, ensuring the seamless handling of the dish deleting functionality within the application. | ||
|
||
|
||
`DeleteDishCommand` is implemented in such a way because: | ||
1. It promotes loose coupling between components. For instance, `Main` doesn't need to know the details of how the `execute()` of `DeleteDishCommand` is executed or how the message is displayed in `Ui`. | ||
2. Each component has a specific role and responsibility. `Main` is responsible for receiving user input and invoking `execute()`, `DeleteDishCommand` is responsible for encapsulating the delete operation, `Menu` is responsible for managing the menu items, and `Ui` is responsible for displaying messages to the user. This separation of concerns makes the code more maintainable and easier to understand. | ||
|
||
### Edit Price | ||
|
||
![Edit Price Execution](images/sequence/EditPriceCommand_execute.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. Activation bar for 6th step should start after the arrow 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. It seems like the method called in 6th step doesn't follow the sequence diagram format? 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. 8th step arrow may need to point to the start of the activation bar 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. in 6th step should have an arrow before 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. hmm I dont quite get what you mean, could you specify where should the arrow be at? |
||
|
||
*Figure 3: Execution of edit_price command* | ||
|
||
API: [EditPriceCommand.java]({repoURL}src/main/java/seedu/cafectrl/command/EditPriceCommand.java) | ||
|
||
When the `execute()` method of `EditPriceCommand` is invoked in `Main`, it subsequently calls the `setPrice()` method on the `Dish` object to modify the price of the specific dish. Following this, the `showEditPriceMessages()` method in the `Ui` component is triggered to retrieve and display a message from `Messages` related to the successful execution of the price modification process. This sequence of actions orchestrates the flow of information and operations between the `Main`, `EditPriceCommand`, `Dish`, and `Ui` components, ensuring the seamless handling of the price editing functionality within the application. | ||
|
||
### Help | ||
|
||
![Help Execution](images/sequence/HelpCommand_execute.png) | ||
|
||
*figure 4: Execution of help command* | ||
|
||
API: [HelpCommand.java]({repoURL}src/main/java/seedu/cafectrl/command/HelpCommand.java) | ||
|
||
When the `execute()` method of `HelpCommand` is invoked in `Main`, it subsequently calls the `showHelp()` method in `Ui`. In `showHelp()`, messages related to command usage will be retrieved and be printed out using by self-invoking `showToUserWithSpaceInBetweenLines(messages: String...)`. | ||
|
||
## Product scope | ||
### Target user profile | ||
|
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.
Maybe remove the default placeholder text