Skip to content

Commit

Permalink
Merge pull request nus-cs2103-AY2021S1#78 from Licheng-Wu/branch-Upda…
Browse files Browse the repository at this point in the history
…te-DG

Update Developer Guide to include Find Exercises feature
  • Loading branch information
iqbxl authored Oct 20, 2020
2 parents ad02978 + 7610cf7 commit 698fe25
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,20 @@ _{more aspects and alternatives to be added}_

_{Explain here how the data archiving feature will be implemented}_

### Find exercises

The find exercises feature is implemented using `FindExercisesCommandParser`, as well as the following command:
* `FindExercisesCommand`, to be executed when the user inputs the command into fitNUS

`FindExercisesCommandParser` takes in the user input and parses them to return a FindExercisesCommand containing the
corresponding predicate for finding the exercises. When executed, `FindExercisesCommand` will set the predicate of
the respective `FilteredList` for exercises in `ModelManager` such that only exercises matching the predicate will be
displayed in the list.

Given below is the Sequence Diagram for interactions within the Logic component for the execute("find_exercises bench")
API call.
![FindExercisesSequenceDiagram](images/FindExercisesSequenceDiagram.png)


--------------------------------------------------------------------------------------------------------------------

Expand Down
69 changes: 69 additions & 0 deletions docs/diagrams/FindExercisesSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
@startuml
!include style.puml

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR
participant ":FindExercisesCommandParser" as FindExercisesCommandParser LOGIC_COLOR
participant "f:FindExercisesCommand" as FindExercisesCommand 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("find_exercises bench")
activate LogicManager

LogicManager -> AddressBookParser : parseCommand("find_exercises bench")
activate AddressBookParser

create FindExercisesCommandParser
AddressBookParser -> FindExercisesCommandParser
activate FindExercisesCommandParser

FindExercisesCommandParser --> AddressBookParser
deactivate FindExercisesCommandParser

AddressBookParser -> FindExercisesCommandParser : parse("bench")
activate FindExercisesCommandParser

create FindExercisesCommand
FindExercisesCommandParser -> FindExercisesCommand
activate FindExercisesCommand

FindExercisesCommand --> FindExercisesCommandParser : f
deactivate FindExercisesCommand

FindExercisesCommandParser --> AddressBookParser : f
deactivate FindExercisesCommandParser
'Hidden arrow to position the destroy marker below the end of the activation bar.
FindExercisesCommandParser -[hidden]-> AddressBookParser
destroy FindExercisesCommandParser

AddressBookParser --> LogicManager : f
deactivate AddressBookParser

LogicManager -> FindExercisesCommand : execute()
activate FindExercisesCommand

FindExercisesCommand-> Model : updateFilteredExerciseList(predicate)
activate Model

Model --> FindExercisesCommand
deactivate Model

create CommandResult
FindExercisesCommand -> CommandResult
activate CommandResult

CommandResult --> FindExercisesCommand
deactivate CommandResult

FindExercisesCommand --> LogicManager : result
deactivate FindExercisesCommand

[<--LogicManager
deactivate LogicManager
@enduml
Binary file added docs/images/FindExercisesSequenceDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 698fe25

Please sign in to comment.