Skip to content

Commit

Permalink
Merge pull request #138 from Cleon2/feature_improved_ug
Browse files Browse the repository at this point in the history
add uml diagrams for star and unstar commands
  • Loading branch information
Cleon2 authored Nov 2, 2023
2 parents 4cbc533 + 245d909 commit 76a0d47
Show file tree
Hide file tree
Showing 6 changed files with 232 additions and 7 deletions.
13 changes: 13 additions & 0 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,25 @@ The star feature is implemented using the `StarCommand` class. The `StarCommand`
object as a parameter. The 'Index' object is used to identify the `Date` object in the `Model` component to be
starred. The `StarCommand` class then returns a `CommandResult` object that contains the starred `Date` object

The _Acitvity_ diagram summarises what happens after the user enters a star command.
![Star Activity.png](..%2F..%2F..%2FStar%20Activity.png)

The _Sequence_ Diagram below shows how the components interact with each other for the scenario where the user issues
the command `star 1`
![Star Sequence.png](..%2F..%2F..%2FStar%20Sequence.png)

### Unstar dates

The unstar feature is implemented using the `UnstarCommand` class. The `UnstarCommand` class takes in a an 'Index'
object as a parameter. The 'Index' object is used to identify the `Date` object in the `Model` component to be
unstarred. The `UnstarCommand` class then returns a `CommandResult` object that contains the unstarred `Date` object

The _Activity_ diagram summarises what happens after the user enters a star command.
![Unstar Activity.png](..%2F..%2F..%2FUnstar%20Activity.png)

The _Sequence_ Diagram below shows how the components interact with each other for the scenario where the user issues
the command `star 1`
![Unstar Sequence.png](..%2F..%2F..%2FUnstar%20Sequence.png)
--------------------------------------------------------------------------------------------------------------------

## **Documentation, logging, testing, configuration, dev-ops**
Expand Down
21 changes: 21 additions & 0 deletions docs/diagrams/Star Activity.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

@startuml
skin rose
skinparam ActivityFontSize 15
skinparam ArrowFontSize 12

start
:User enters star command;

if () then ([Valid Index])
if () then ([Date is not starred])
:Apply star on date;
else ([Else])
:Command exception is thrown;
endif
else ([Else])
:Command exception is thrown;
endif

stop
@enduml
77 changes: 77 additions & 0 deletions docs/diagrams/Star Sequence.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
@startuml
!include Style.puml
skinparam ArrowFontStyle plain

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":LoveBookParser" as LoveBookParser LOGIC_COLOR
participant ":StarCommandParser" as StarCommandParser LOGIC_COLOR
participant "d:StarCommand" as StarCommand 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("star 1")
activate LogicManager

LogicManager -> LoveBookParser : parseCommand("star 1")
activate LoveBookParser

create StarCommandParser
LoveBookParser -> StarCommandParser
activate StarCommandParser

StarCommandParser --> LoveBookParser
deactivate StarCommandParser

LoveBookParser -> StarCommandParser : parse("star 1")
activate StarCommandParser

create StarCommand
StarCommandParser -> StarCommand
activate StarCommand

StarCommand --> StarCommandParser : d
deactivate StarCommand

StarCommandParser --> LoveBookParser : d
deactivate StarCommandParser
'Hidden arrow to position the destroy marker below the end of the activation bar.
StarCommandParser -[hidden]-> LoveBookParser
destroy StarCommandParser

LoveBookParser --> LogicManager : d
deactivate LoveBookParser

LogicManager -> StarCommand : execute()
activate StarCommand

StarCommand -> Model : setPerson(dateToStar, starredDate)
activate Model


Model --> StarCommand
deactivate Model

StarCommand -> Model : updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS)
activate Model

Model --> StarCommand
deactivate Model

create CommandResult
StarCommand -> CommandResult
activate CommandResult

CommandResult --> StarCommand
deactivate CommandResult

StarCommand --> LogicManager : result
deactivate StarCommand

[<--LogicManager
deactivate LogicManager
@enduml
21 changes: 21 additions & 0 deletions docs/diagrams/Unstar Activity.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

@startuml
skin rose
skinparam ActivityFontSize 15
skinparam ArrowFontSize 12

start
:User enters unstar command;

if () then ([Valid Index])
if () then ([Date is starred])
:Apply unstar on date;
else ([Else])
:Command exception is thrown;
endif
else ([Else])
:Command exception is thrown;
endif

stop
@enduml
77 changes: 77 additions & 0 deletions docs/diagrams/Unstar Sequence.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
@startuml
!include Style.puml
skinparam ArrowFontStyle plain

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":LoveBookParser" as LoveBookParser LOGIC_COLOR
participant ":UnstarCommandParser" as UnstarCommandParser LOGIC_COLOR
participant "d:UnstarCommand" as UnstarCommand 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("unstar 1")
activate LogicManager

LogicManager -> LoveBookParser : parseCommand("unstar 1")
activate LoveBookParser

create UnstarCommandParser
LoveBookParser -> UnstarCommandParser
activate UnstarCommandParser

UnstarCommandParser --> LoveBookParser
deactivate UnstarCommandParser

LoveBookParser -> UnstarCommandParser : parse("unstar 1")
activate UnstarCommandParser

create UnstarCommand
UnstarCommandParser -> UnstarCommand
activate UnstarCommand

UnstarCommand --> UnstarCommandParser : d
deactivate UnstarCommand

UnstarCommandParser --> LoveBookParser : d
deactivate UnstarCommandParser
'Hidden arrow to position the destroy marker below the end of the activation bar.
UnstarCommandParser -[hidden]-> LoveBookParser
destroy UnstarCommandParser

LoveBookParser --> LogicManager : d
deactivate LoveBookParser

LogicManager -> UnstarCommand : execute()
activate UnstarCommand

UnstarCommand -> Model : setPerson(dateToStar, starredDate)
activate Model


Model --> UnstarCommand
deactivate Model

UnstarCommand -> Model : updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS)
activate Model

Model --> UnstarCommand
deactivate Model

create CommandResult
UnstarCommand -> CommandResult
activate CommandResult

CommandResult --> UnstarCommand
deactivate CommandResult

UnstarCommand --> LogicManager : result
deactivate UnstarCommand

[<--LogicManager
deactivate LogicManager
@enduml
30 changes: 23 additions & 7 deletions docs/team/cleon2.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,31 @@ journey.

Given below are my contributions to the project.

* **New Feature**:
* What it does:
* Justification:
* Highlights:
* Credits:
* **Star Command**:
* What it does: Enables the starring of a date
* Justification: To make it easier to identify a date who you like
* Highlights: Created new classes and fields to implement the feature

* **New Feature**:

* **Code contributed**: [RepoSense link]()
* **Unstar Command**:
* What it does: Enables the unstarring of a date
* Justification: To unstar dates that we no longer like
* Highlights: Created new classes and fields to implement the feature

* **Income field**:
* What it does: Added income field for each date
* Justification: Income is an important factor as well in dating.
* Highlights: Created new classes and fields to implement the feature

* **Unit test cases**:
* What it does: Added unit test cases for other commands that outside of those I have implemented, including
setPreferences
* Justification: Unit tests are essential to prevent bugs
* Highlights: Created new classes and fields to implement the feature



* **Code contributed**: [RepoSense link](https://nus-cs2103-ay2324s1.github.io/tp-dashboard/?search=cleon2&sort=groupTitle&sortWithin=title&timeframe=commit&mergegroup=&groupSelect=groupByAuthors&breakdown=true&checkedFileTypes=docs~functional-code~test-code&since=2023-09-22)

* **Project management**:

Expand Down

0 comments on commit 76a0d47

Please sign in to comment.