forked from nus-cs2103-AY2223S1/tp
-
Notifications
You must be signed in to change notification settings - Fork 6
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 #528 from Ferusel/tingkai/update-dg
Update Developer Guide
- Loading branch information
Showing
12 changed files
with
352 additions
and
24 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 |
---|---|---|
@@ -1,22 +1,35 @@ | ||
<!-- markdownlint-disable-file first-line-h1 --> | ||
|
||
#### General Implementation Details | ||
|
||
The statistics command is implemented as a standalone command that ties together the `Item` and `Tag` class. By performing calculations, it returns relevant statistics to the user. | ||
|
||
The class diagram is as such: | ||
|
||
<!-- TODO: ADD ITEM CLASS DIAGRAM --> | ||
|
||
#### General Design Considerations | ||
The `stats` command calculates and provides users a list of statistics relating to FoodRem's inventory. The list of statistics provided is as follows: | ||
* Top three most expensive items | ||
* Total amount of expired food | ||
* Top three most common tags | ||
|
||
#### Displaying Statistics | ||
|
||
##### Overview | ||
The activity diagram is as such: | ||
|
||
<!-- TODO: ACTIVITY DIAGRAM --> | ||
<!-- TODO: Short Description of Command --> | ||
|
||
##### Feature Details | ||
The sequence diagram is as such: | ||
|
||
<!-- TODO: SEQUENCE DIAGRAM --> | ||
<!-- TODO: Description of how Command works --> | ||
|
||
##### Feature Considerations | ||
##### Feature Details | ||
1. The user calls the `stats` command. | ||
2. FoodRem performs the necessary calculations to obtain the statistics. FoodRem then displays the result to the user. | ||
3. If there are fewer than three items, or if there are fewer than three tags, FoodRem displays a placeholder "-". | ||
|
||
<!-- TODO: Command Considerations --> | ||
|
||
##### Feature Considerations | ||
The three statistics were chosen as a baseline because they are a good starting point for users to help track their food waste. For example, the user can obtain the total amount of wasted food, which is food whose expiry date has already been passed. Future extensions can include additional statistics, or even provide further arguments to selectively display desired statistics. For example, `stats topThreeMostExpensive` would display the statistics for the top three most expensive items only. |
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,24 @@ | ||
@startuml | ||
!pragma useVerticalIf on | ||
start | ||
:User enters edit command; | ||
if () then ([else]) | ||
:Error: Invalid index provided; | ||
stop | ||
([Positive index provided]) elseif () then ([else]) | ||
:Error: Invalid command format; | ||
stop | ||
([at least one field to be edited is provided]) elseif () then ([else]) | ||
:Error: Invalid index provided; | ||
stop | ||
([Item index is in valid range of Item List])elseif () then ([else]) | ||
:Error: Item already exists in the Item List; | ||
stop | ||
else ([Edited item does not share a name with any other Items]) | ||
endif | ||
:edit command successfully executes. | ||
Item is edited.; | ||
stop | ||
|
||
@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,110 @@ | ||
|
||
@startuml | ||
!include style.puml | ||
|
||
box Logic LOGIC_COLOR_T1 | ||
participant ":LogicManager" as LogicManager LOGIC_COLOR | ||
participant ":FoodRemParser" as FoodRemParser LOGIC_COLOR | ||
participant ":EditCommandParser" as EditCommandParser LOGIC_COLOR | ||
participant ":Index" as Index LOGIC_COLOR | ||
participant "editItemDescriptor:EditItemDescriptor" as EditItemDescriptor LOGIC_COLOR | ||
participant ":EditCommand" as EditCommand LOGIC_COLOR | ||
participant "editedItem:Item" as Item LOGIC_COLOR | ||
participant ":ItemWithMessage" as ItemWithMessage LOGIC_COLOR | ||
participant ":CommandResult" as CommandResult LOGIC_COLOR | ||
|
||
|
||
end box | ||
|
||
box Model MODEL_COLOR_T1 | ||
participant ":Model" as Model MODEL_COLOR | ||
end box | ||
|
||
[-> LogicManager : execute("edit 1 n/newname") | ||
activate LogicManager | ||
|
||
LogicManager -> FoodRemParser : parseCommand("edit 1 n/newname") | ||
activate FoodRemParser | ||
|
||
create EditCommandParser | ||
FoodRemParser -> EditCommandParser | ||
activate EditCommandParser | ||
|
||
EditCommandParser --> FoodRemParser | ||
deactivate EditCommandParser | ||
|
||
FoodRemParser -> EditCommandParser : parse("edit 1 n/newname") | ||
activate EditCommandParser | ||
|
||
create Index | ||
EditCommandParser -> Index | ||
activate Index | ||
|
||
Index --> EditCommandParser | ||
deactivate Index | ||
|
||
create EditItemDescriptor | ||
EditCommandParser -> EditItemDescriptor | ||
activate EditItemDescriptor | ||
|
||
EditItemDescriptor -> EditCommandParser | ||
deactivate EditItemDescriptor | ||
'Hidden arrow to position the destroy marker below the end of the activation bar. | ||
EditItemDescriptor -[hidden]-> EditCommandParser | ||
destroy EditItemDescriptor | ||
|
||
create EditCommand | ||
EditCommandParser -> EditCommand | ||
activate EditCommand | ||
|
||
EditCommand --> EditCommandParser | ||
deactivate EditCommand | ||
|
||
EditCommandParser --> FoodRemParser | ||
deactivate EditCommandParser | ||
|
||
FoodRemParser --> LogicManager | ||
deactivate FoodRemParser | ||
destroy EditCommandParser | ||
|
||
LogicManager -> EditCommand : execute(model) | ||
activate EditCommand | ||
|
||
EditCommand -> Model : getCurrentList() | ||
activate Model | ||
|
||
Model --> EditCommand | ||
deactivate Model | ||
|
||
EditCommand -> EditCommand : createEditedItem(itemToEdit, editItemDescriptor) | ||
activate EditCommand | ||
|
||
create Item | ||
EditCommand -> Item | ||
activate Item | ||
|
||
Item --> EditCommand | ||
deactivate Item | ||
|
||
EditCommand --> EditCommand | ||
deactivate EditCommand | ||
|
||
create ItemWithMessage | ||
EditCommand -> ItemWithMessage | ||
activate ItemWithMessage | ||
|
||
ItemWithMessage --> EditCommand | ||
deactivate ItemWithMessage | ||
|
||
create CommandResult | ||
EditCommand -> CommandResult | ||
activate CommandResult | ||
|
||
CommandResult --> EditCommand | ||
deactivate CommandResult | ||
|
||
deactivate EditCommand | ||
|
||
[<--LogicManager | ||
deactivate LogicManager | ||
@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,21 @@ | ||
@startuml | ||
!pragma useVerticalIf on | ||
start | ||
:User enters new command; | ||
if () then ([else]) | ||
:Error: Invalid command format; | ||
stop | ||
([Item name is provided and arguments are valid]) elseif () then ([else]) | ||
:Error: Item already exists; | ||
stop | ||
([Item does not exist in Item List]) elseif () then ([else]) | ||
:Error: Insufficient storage space for Items; | ||
stop | ||
else ([Storage space for Items is available]) | ||
endif | ||
:new command successfully executes. | ||
Item is edited.; | ||
stop | ||
|
||
@enduml | ||
|
Oops, something went wrong.