Skip to content
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

Update fav/unfav feature to be more specific in developer guide #268

Merged
merged 19 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 76 additions & 28 deletions docs/DeveloperGuide.md

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions docs/diagrams/ExecuteFavCommandSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
@startuml
!include style.puml
skinparam ArrowFontStyle plain

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant "f:FavCommand" as FavCommand LOGIC_COLOR
participant "r:CommandResult" as CommandResult LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
participant ":ModelManager" as Model MODEL_COLOR
end box

activate LogicManager

LogicManager -> FavCommand : execute(model)
activate FavCommand

FavCommand -> Model : getSortedFilteredPersonList()
activate Model
return

ref over FavCommand : create a favourite person

FavCommand -> Model : setPerson(personToFav, favPerson)
activate Model
return

FavCommand -> Model : updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS)
activate Model
return

create CommandResult
FavCommand -> CommandResult++
return

return r
[<- LogicManager
deactivate LogicManager

@enduml
42 changes: 42 additions & 0 deletions docs/diagrams/ExecuteUnfavCommandSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
@startuml
!include style.puml
skinparam ArrowFontStyle plain

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant "u:UnfavCommand" as UnfavCommand LOGIC_COLOR
participant "r:CommandResult" as CommandResult LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
participant ":ModelManager" as Model MODEL_COLOR
end box

activate LogicManager

LogicManager -> UnfavCommand : execute(model)
activate UnfavCommand

UnfavCommand -> Model : getSortedFilteredPersonList()
activate Model
return

ref over UnfavCommand : create an unfavourite person

UnfavCommand -> Model : setPerson(personToUnfav, unfavPerson)
activate Model
return

UnfavCommand -> Model : updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS)
activate Model
return

create CommandResult
UnfavCommand -> CommandResult++
return

return r
[<- LogicManager
deactivate LogicManager

@enduml
23 changes: 23 additions & 0 deletions docs/diagrams/FavActivityDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@startuml
skin rose
skinparam ActivityFontSize 15
skinparam ArrowFontSize 12
start
:User executes fav command;

'Since the beta syntax does not support placing the condition outside the
'diamond we place it as the true branch instead.

if () then ([index is valid])
if () then ([Person is favourite])
:Create new Person with same values but is a favourite;
:Replace the original Person with the new one;
:Refresh the list of Persons;
else ([else])
:Show error message to user that person is already a favourite;
endif
else ([else])
:Show error message to user that index is invalid;
endif
stop
@enduml
31 changes: 31 additions & 0 deletions docs/diagrams/FavRefSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
@startuml
!include style.puml
skinparam ArrowFontStyle plain

mainframe **sd** create a favourite person

box Logic LOGIC_COLOR_T1
participant "f:FavCommand" as FavCommand LOGIC_COLOR
participant FavCommand as FavCommand1 <<class>> LOGIC_COLOR
participant "<<class>>\nPersonUtil" as PersonUtil LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
participant ":Person" as Person MODEL_COLOR
end box

FavCommand -> FavCommand1 : createFavPerson(personToFav)
activate FavCommand
activate FavCommand1

FavCommand1 -> PersonUtil : createPersonWithFavouriteStatus(selectedPerson, favourite)
activate PersonUtil

create Person
PersonUtil -> Person++
return createdPerson

return favPerson
return favPerson

@enduml
54 changes: 3 additions & 51 deletions docs/diagrams/FavSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,13 @@ box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":StaffConnectParser" as StaffConnectParser LOGIC_COLOR
participant ":FavCommandParser" as FavCommandParser LOGIC_COLOR
participant "<<class>>\nParserUtil" as ParserUtil LOGIC_COLOR
participant "f:FavCommand" as FavCommand LOGIC_COLOR
participant "r:CommandResult" as CommandResult LOGIC_COLOR
participant FavCommand as FavCommand1 <<class>> LOGIC_COLOR
participant "<<class>>\nPersonUtil" as PersonUtil LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
participant ":ModelManager" as Model MODEL_COLOR
participant ":Person" as Person MODEL_COLOR
end box

[-> LogicManager : execute(userInput)
[-> LogicManager : execute("fav 1")
activate LogicManager

LogicManager -> StaffConnectParser : parseCommand(userInput)
LogicManager -> StaffConnectParser : parseCommand("fav 1")
activate StaffConnectParser

create FavCommandParser
Expand All @@ -31,13 +22,9 @@ activate FavCommandParser
FavCommandParser --> StaffConnectParser
deactivate FavCommandParser

StaffConnectParser -> FavCommandParser : parse(args)
StaffConnectParser -> FavCommandParser : parse("1")
activate FavCommandParser

FavCommandParser -> ParserUtil : parseIndex(oneBasedIndex)
activate ParserUtil
return

create FavCommand
FavCommandParser -> FavCommand++
return
Expand All @@ -46,39 +33,4 @@ return f
destroy FavCommandParser
return f

LogicManager -> FavCommand : execute(model)
activate FavCommand

FavCommand -> Model : getSortedFilteredPersonList()
activate Model
return

FavCommand -> FavCommand1 : createFavPerson(personToFav)
activate FavCommand1

FavCommand1 -> PersonUtil : createPersonWithFavouriteStatus(Person selectedPerson, Favourite favourite)
activate PersonUtil

create Person
PersonUtil -> Person++
return createdPerson

return favPerson
return favPerson

FavCommand -> Model : setPerson(personToFav, favPerson)
activate Model
return

FavCommand -> Model : updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS)
activate Model
return

create CommandResult
FavCommand -> CommandResult++
return

return r
return

@enduml
23 changes: 23 additions & 0 deletions docs/diagrams/UnfavActivityDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@startuml
skin rose
skinparam ActivityFontSize 15
skinparam ArrowFontSize 12
start
:User executes unfav command;

'Since the beta syntax does not support placing the condition outside the
'diamond we place it as the true branch instead.

if () then ([index is valid])
if () then ([Person is favourite])
:Create new Person with same values but is not a favourite;
:Replace the original Person with the new one;
:Refresh the list of Persons;
else ([else])
:Show error message to user that person is already not a favourite;
endif
else ([else])
:Show error message to user that index is invalid;
endif
stop
@enduml
33 changes: 33 additions & 0 deletions docs/diagrams/UnfavRefSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@startuml
!include style.puml
skinparam ArrowFontStyle plain
skinparam ParticipantPadding 20

mainframe **sd** create an unfavourite person

box Logic LOGIC_COLOR_T1
participant "u:UnfavCommand" as UnfavCommand LOGIC_COLOR
participant UnfavCommand as UnfavCommand1 <<class>> LOGIC_COLOR
participant "<<class>>\nPersonUtil" as PersonUtil LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
participant ":Person" as Person MODEL_COLOR
end box


UnfavCommand -> UnfavCommand1 : createUnfavPerson(personToUnfav)
activate UnfavCommand1

UnfavCommand1 -> PersonUtil : createPersonWithFavouriteStatus(selectedPerson, favourite)
activate PersonUtil

create Person
PersonUtil -> Person++
return createdPerson

return unfavPerson
return unfavPerson


@enduml
54 changes: 3 additions & 51 deletions docs/diagrams/UnfavSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,13 @@ box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":StaffConnectParser" as StaffConnectParser LOGIC_COLOR
participant ":UnfavCommandParser" as UnfavCommandParser LOGIC_COLOR
participant "<<class>>\nParserUtil" as ParserUtil LOGIC_COLOR
participant "u:UnfavCommand" as UnfavCommand LOGIC_COLOR
participant "r:CommandResult" as CommandResult LOGIC_COLOR
participant UnfavCommand as UnfavCommand1 <<class>> LOGIC_COLOR
participant "<<class>>\nPersonUtil" as PersonUtil LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
participant ":ModelManager" as Model MODEL_COLOR
participant ":Person" as Person MODEL_COLOR
end box

[-> LogicManager : execute(userInput)
[-> LogicManager : execute("unfav 1")
activate LogicManager

LogicManager -> StaffConnectParser : parseCommand(userInput)
LogicManager -> StaffConnectParser : parseCommand("unfav 1")
activate StaffConnectParser

create UnfavCommandParser
Expand All @@ -31,13 +22,9 @@ activate UnfavCommandParser
UnfavCommandParser --> StaffConnectParser
deactivate UnfavCommandParser

StaffConnectParser -> UnfavCommandParser : parse(args)
StaffConnectParser -> UnfavCommandParser : parse("1")
activate UnfavCommandParser

UnfavCommandParser -> ParserUtil : parseIndex(oneBasedIndex)
activate ParserUtil
return

create UnfavCommand
UnfavCommandParser -> UnfavCommand++
return
Expand All @@ -46,39 +33,4 @@ return u
destroy UnfavCommandParser
return u

LogicManager -> UnfavCommand : execute(model)
activate UnfavCommand

UnfavCommand -> Model : getSortedFilteredPersonList()
activate Model
return

UnfavCommand -> UnfavCommand1 : createUnfavPerson(personToUnfav)
activate UnfavCommand1

UnfavCommand1 -> PersonUtil : createPersonWithFavouriteStatus(Person selectedPerson, Favourite favourite)
activate PersonUtil

create Person
PersonUtil -> Person++
return createdPerson

return unfavPerson
return unfavPerson

UnfavCommand -> Model : setPerson(personToUnfav, unfavPerson)
activate Model
return

UnfavCommand -> Model : updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS)
activate Model
return

create CommandResult
UnfavCommand -> CommandResult++
return

return r
return

@enduml
Binary file added docs/images/ExecuteFavCommandSequenceDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/FavActivityDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/FavRefSequenceDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/FavSequenceDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/UnfavActivityDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/UnfavRefSequenceDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/UnfavSequenceDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading