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.
Browse files
Browse the repository at this point in the history
#158 update dg with add order feature
- Loading branch information
Showing
28 changed files
with
232 additions
and
84 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
@startuml | ||
'https://plantuml.com/class-diagram | ||
|
||
CafeCtrl "1" --> "1" UI | ||
CafeCtrl "1" --> "1" Parser | ||
CafeCtrl "1" --> "1" Sales | ||
CafeCtrl "1" --> "1" Pantry | ||
CafeCtrl "1" o-- "*" Command | ||
|
||
Command <|- AddOrderCommand | ||
Parser "1" --> "*" AddOrderCommand | ||
AddOrderCommand --> OrderList | ||
AddOrderCommand "1" --> "1" Chef | ||
AddOrderCommand --> Pantry | ||
OrderList "1" --> "*" Order | ||
Sales --> "1...*" OrderList | ||
|
||
class CafeCtrl { | ||
- setup() | ||
- run() | ||
+ main(args : String[]) | ||
} | ||
|
||
class Command { | ||
|
||
} | ||
|
||
class UI { | ||
{static} - scanner : Scanner | ||
+ receiveUserInput() : String | ||
+ showMenuTop() : void | ||
+ showChefMessage() : void | ||
+ showTotalCost(dollarCost : String) : void | ||
} | ||
|
||
class AddOrderCommand { | ||
# orderList : OrderList | ||
# ui : Ui | ||
# pantry : Pantry | ||
+ execute() : void | ||
} | ||
|
||
class Parser { | ||
{static} + parseCommand(menu : Menu, userInput : String, ui : Ui, pantry : Pantry, sales : Sales, currentDate : CurrentDate) : Command | ||
{static} - prepareOrder(menu : Menu, arguments : String, ui : Ui, pantry : Pantry, sales : Sales, currentDate : CurrentDate) : Command | ||
} | ||
|
||
class OrderList { | ||
- orderList : ArrayList<Order> | ||
- totalOrderListCost : float | ||
+ addOrder() : void | ||
+ addCost() : void | ||
+ getTotalCost() : float | ||
} | ||
|
||
class Order { | ||
- orderedDish : Dish | ||
- dishQty : int | ||
- ingredientList : ArrayList<Ingredient> | ||
- isComplete : boolean | ||
- totalOrderCost : float | ||
- getDishPrice() : float | ||
- setIngredientList() : ArrayList<Ingredient> | ||
+ getIngredientList() : ArrayList<Ingredient> | ||
+ getTotalOrderCost() : float | ||
+ setComplete() : void | ||
+ getIsComplete() : boolean | ||
} | ||
|
||
class Chef { | ||
- order : Order | ||
- pantry : Pantry | ||
- ui : Ui | ||
+ cookDish() : void | ||
} | ||
|
||
class Pantry { | ||
- pantryStock : ArrayList<Ingredient> | ||
- menuItems : ArrayList<Dish> | ||
- ui : Ui | ||
+ decreaseIngredientsStock(dishIngredient : ArrayList<Ingredient>) : void | ||
} | ||
|
||
class Sales { | ||
- orderLists : ArrayList<OrderList> | ||
- daysAccounted : int | ||
} | ||
|
||
@enduml |
File renamed without changes.
File renamed without changes.
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 | ||
'https://plantuml.com/sequence-diagram | ||
|
||
autonumber | ||
|
||
-> ":AddOrderCommand" : execute() | ||
activate ":AddOrderCommand" | ||
":AddOrderCommand" -> ":OrderList" : addOrder(order : Order) | ||
activate ":OrderList" | ||
return | ||
":AddOrderCommand" -> ":Chef" : new Chef(order : Order, pantry : Pantry, ui : Ui) | ||
activate ":Chef" | ||
return chef : Chef | ||
":AddOrderCommand" -> ":Chef" : cookDish() | ||
activate ":Chef" | ||
opt !order.isComplete() | ||
":Chef" -> ":Ui" : showChefMessage() | ||
activate ":Ui" | ||
":Ui" -> ":Ui" : showToUser(args : String) | ||
activate ":Ui" | ||
return | ||
return | ||
":Chef" -> ":Order" : getIngredientList() | ||
activate ":Order" | ||
return ingredientList : ArrayList<Ingredient> | ||
":Chef" -> ":Pantry" : decreaseIngredientsStock(ingredientList : ArrayList<Ingredient>) | ||
activate ":Pantry" | ||
return | ||
":Chef" -> ":Order" : setComplete() | ||
activate ":Order" | ||
return | ||
end | ||
":Chef" -> ":Ui" : showToUser(args : String) | ||
activate ":Ui" | ||
return | ||
return | ||
opt order.isComplete() | ||
":AddOrderCommand" -> ":OrderList" : addCost(order : Order) | ||
activate ":OrderList" | ||
return | ||
end | ||
":AddOrderCommand" -> ":OrderList" : getTotalCost() | ||
activate ":OrderList" | ||
return totalOrderListCost : float | ||
":AddOrderCommand" -> ":Ui" : showTotalCost(totalOrderListCost) | ||
activate ":Ui" | ||
":Ui" -> ":Ui" : showToUser(args : String) | ||
activate ":Ui" | ||
return | ||
return | ||
return | ||
@enduml |
File renamed without changes.
26 changes: 13 additions & 13 deletions
26
...umldiagrams/EditPriceCommand_execute.puml → ...ms/sequence/EditPriceCommand_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,13 +1,13 @@ | ||
@startuml | ||
'https://plantuml.com/sequence-diagram | ||
|
||
autonumber | ||
|
||
Main -> EditPriceCommand: execute() | ||
activate EditPriceCommand | ||
EditPriceCommand -> Dish: setPrice(price: float) | ||
activate Dish | ||
EditPriceCommand -> Ui: showEditPriceMessages() | ||
deactivate EditPriceCommand | ||
deactivate Dish | ||
@enduml | ||
@startuml | ||
'https://plantuml.com/sequence-diagram | ||
|
||
autonumber | ||
|
||
Main -> EditPriceCommand: execute() | ||
activate EditPriceCommand | ||
EditPriceCommand -> Dish: setPrice(price: float) | ||
activate Dish | ||
EditPriceCommand -> Ui: showEditPriceMessages() | ||
deactivate EditPriceCommand | ||
deactivate Dish | ||
@enduml |
File renamed without changes.
File renamed without changes.
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
52 changes: 26 additions & 26 deletions
52
docs/umldiagrams/Parser.puml → docs/diagrams/sequence/Parser.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,26 +1,26 @@ | ||
@startuml | ||
'https://plantuml.com/sequence-diagram | ||
|
||
actor User | ||
|
||
User -> Main: fullUserInput | ||
activate Main | ||
Main -> Parser: parseCommand(fullUserInput: String) | ||
activate Parser | ||
|
||
alt COMMAND_WORD | ||
Parser -> Parser: prepareCommand(requiredArguments) | ||
activate Parser | ||
Parser -> Command: Command() | ||
activate Command | ||
Command --> Parser: command | ||
deactivate Command | ||
deactivate Parser | ||
end alt | ||
|
||
deactivate Parser | ||
|
||
Parser --> Main: command | ||
Main -> Command: execute() | ||
activate Command | ||
@enduml | ||
@startuml | ||
'https://plantuml.com/sequence-diagram | ||
|
||
actor User | ||
|
||
User -> Main: fullUserInput | ||
activate Main | ||
Main -> Parser: parseCommand(fullUserInput: String) | ||
activate Parser | ||
|
||
alt COMMAND_WORD | ||
Parser -> Parser: prepareCommand(requiredArguments) | ||
activate Parser | ||
Parser -> Command: Command() | ||
activate Command | ||
Command --> Parser: command | ||
deactivate Command | ||
deactivate Parser | ||
end alt | ||
|
||
deactivate Parser | ||
|
||
Parser --> Main: command | ||
Main -> Command: execute() | ||
activate Command | ||
@enduml |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
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
Oops, something went wrong.