forked from nus-cs2113-AY2324S1/tp
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #343 from NaychiMin/Update-DG-with-changes-made-v2.1
Task 342, Update DG, UG and PPP
- Loading branch information
Showing
20 changed files
with
376 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 49 additions & 29 deletions
78
docs/diagrams/sequence/ListIngredientCommand_execute.puml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,61 @@ | ||
@startuml | ||
!define COMMAND class ListIngredientCommand | ||
!define UI class Ui | ||
!define MENU class Menu | ||
!define DISH class Dish | ||
!define COMMAND class ":ListIngredientCommand" | ||
!define UI class ":Ui" | ||
!define MENU class ":Menu" | ||
!define DISH class ":Dish" | ||
!define PARSER class Parser | ||
|
||
autonumber | ||
-> ListIngredientCommand: execute() | ||
|
||
activate ListIngredientCommand | ||
ListIngredientCommand -> Menu : getMenuItemsList() | ||
activate Menu | ||
Menu --> ListIngredientCommand: selectedDish : Dish | ||
deactivate Menu | ||
-> ":ListIngredientCommand": execute() | ||
|
||
activate ":ListIngredientCommand" | ||
":ListIngredientCommand" -> ":Menu" : getMenuItemsList() | ||
activate ":Menu" | ||
":Menu" --> ":ListIngredientCommand": selectedDish : ":Dish" | ||
deactivate ":Menu" | ||
|
||
":ListIngredientCommand" -> ":Ui" : showListIngredientsMessage(selectedDish: Dish) | ||
activate ":Ui" | ||
|
||
":Ui" -> ":Ui" : showDishName(dish: Dish) | ||
activate ":Ui" | ||
":Ui" -> ":Dish" : dish.getName() | ||
activate ":Dish" | ||
return : String | ||
return | ||
|
||
":Ui" -> ":Ui" : showIngredientList(dish : Dish) | ||
activate ":Ui" | ||
|
||
":Ui" -> ":Dish" : selectedDish.getIngredients() | ||
activate ":Dish" | ||
return ingredients: ArrayList<Ingredient> | ||
|
||
ListIngredientCommand -> Ui : printIngredients(selectedDish: Dish) | ||
activate Ui | ||
Ui -> Dish : selectedDish.getIngredients() | ||
activate Dish | ||
Dish --> Ui : ingredients: Ingredient | ||
deactivate Dish | ||
|
||
|
||
loop ingredients | ||
Ui -> Ingredients: ingredient.toString() | ||
activate Ingredients | ||
Ingredients --> Ui | ||
deactivate Ingredients | ||
":Ui" -> ":Ingredients": ingredient.getName() | ||
activate ":Ingredients" | ||
":Ingredients" --> ":Ui" :String | ||
deactivate ":Ingredients" | ||
":Ui" -> ":Ingredients": ingredient.getQty() | ||
activate ":Ingredients" | ||
":Ingredients" --> ":Ui" :int | ||
deactivate ":Ingredients" | ||
":Ui" -> ":Ingredients": ingredient.getUnit() | ||
activate ":Ingredients" | ||
":Ingredients" --> ":Ui" :String | ||
deactivate ":Ingredients" | ||
":Ui" -> ":Ui" : formatListIngredient(ingredientName: String, ingredientAmount: String) | ||
activate ":Ui" | ||
return | ||
end loop | ||
|
||
Ui -> Ui: showToUser(message: String) | ||
activate Ui | ||
Ui --> Ui | ||
deactivate Ui | ||
Ui --> ListIngredientCommand | ||
deactivate Ui | ||
deactivate ListIngredientCommand | ||
<-- ListIngredientCommand | ||
":Ui" -> ":Ui": showIngredientsEndCap() | ||
activate ":Ui" | ||
return | ||
return | ||
return | ||
|
||
@enduml | ||
@enduml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
@startuml | ||
!define COMMAND class ":ListSaleByDayCommand" | ||
!define SALES class ":Sales" | ||
!define ORDERLIST class ":OrderList" | ||
!define ORDER class ":Order" | ||
!define UI class ":Ui" | ||
|
||
autonumber | ||
|
||
-> ":ListSaleByDayCommand": execute() | ||
|
||
activate ":ListSaleByDayCommand" | ||
":ListSaleByDayCommand" -> ":Sales": sales.printSaleByDay(ui: ":Ui", menu: Menu, day: int) | ||
activate ":Sales" | ||
":Sales" -> ":OrderList": orderList.hasCompleteOrders() | ||
|
||
activate ":OrderList" | ||
return :boolean | ||
|
||
alt no complete order || no orders | ||
":Sales" -> ":Ui" : showToUser(message: String) | ||
activate ":Ui" | ||
return | ||
":Sales" --> ":ListSaleByDayCommand" | ||
<-- ":ListSaleByDayCommand" | ||
end alt | ||
|
||
":Sales" -> ":Ui": showSalesTop() | ||
activate ":Ui" | ||
return | ||
":Sales" -> ":OrderList": orderList.printOrderList() | ||
activate ":OrderList" | ||
|
||
loop order | ||
":OrderList" -> ":OrderList": aggregateOrders() | ||
activate ":OrderList" | ||
return | ||
end loop | ||
|
||
loop aggregatedOrder | ||
":OrderList" -> ":Order" **: | ||
activate ":Order" | ||
return aggregatedOrder: ":Order" | ||
":OrderList" -> ":Order": aggregatedOrder.getDishName() | ||
activate ":Order" | ||
return :String | ||
":OrderList" -> ":Order": aggregatedOrder.getQty() | ||
activate ":Order" | ||
return :String | ||
":OrderList" -> ":Order": aggregatedOrder.getTotalOrderCost() | ||
activate ":Order" | ||
return :float | ||
destroy ":Order" | ||
":OrderList" -> ":Ui": showSalesAll(dishName: String, dishQty: int, dishPrice: String) | ||
activate ":Ui" | ||
":Ui" -> ":Ui": formatShowSales(dishName: String, dishQty: int, dishPrice: String) | ||
activate ":Ui" | ||
return | ||
return | ||
end loop | ||
":OrderList" -> ":Ui": showSalesBottom() | ||
activate ":Ui" | ||
return | ||
":OrderList" -> ":Ui": showSalesCost() | ||
activate ":Ui" | ||
return | ||
":OrderList" -> ":Ui": showSalesBottom() | ||
activate ":Ui" | ||
return | ||
return | ||
return | ||
return | ||
|
||
@enduml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
@startuml | ||
!define FUNCTION class calculateMaxDish | ||
!define PANTRY class ":Pantry" | ||
!define INGREDIENT class ":Ingredient" | ||
!define DISH class ":Dish" | ||
|
||
autonumber | ||
|
||
-> ":Pantry": calculateMaxDish(dish: ":Dish", menu: Menu, order: Order) | ||
activate ":Pantry" | ||
|
||
":Pantry" -> ":Dish" : dish.getName() | ||
activate ":Dish" | ||
return dishName:String | ||
|
||
":Pantry" -> ":Pantry" : retrieveIngredientsForDish(dishName: String) | ||
activate ":Pantry" | ||
return dishIngredients: ArrayList<":Ingredient"> | ||
|
||
loop dishIngredients | ||
":Pantry" -> ":Ingredient" **: | ||
activate ":Ingredient" | ||
return dishIngredient: ":Ingredient" | ||
|
||
":Pantry" -> ":Pantry" : calculateMaxDishForEachIngredient(dishIngredient: Ingredient) | ||
activate ":Pantry" | ||
return numOfDish: int | ||
|
||
alt !order.getIsComplete() | ||
":Pantry" -> ":Pantry" : handleIncompleteDishCase(dishIngredient: Ingredient), order: Order, numOfDish: int) | ||
activate ":Pantry" | ||
|
||
alt lacking ingredients (numOfDish < orderQty) | ||
":Pantry" -> ":Pantry": handleRestock(dishIngredient: ":Ingredient", orderQty: int) | ||
activate ":Pantry" | ||
return | ||
end alt | ||
return | ||
|
||
else order.getIsComplete() | ||
":Pantry" -> ":Pantry" : handleZeroDishCase(dishIngredient: Ingredient), order: Order, numOfDish: int) | ||
activate ":Pantry" | ||
alt lacking ingredients (numOfDish == 0) | ||
":Pantry" -> ":Pantry": handleRestock(dishIngredient: ":Ingredient", orderQty: int) | ||
activate ":Pantry" | ||
return | ||
end alt | ||
return | ||
end loop | ||
return maxNumOfDish: int | ||
|
||
@enduml |
Oops, something went wrong.