Skip to content

Commit c3a82c9

Browse files
authored
Merge branch 'master' into marcus/update-ug-ppp-dg
2 parents 12e687b + b09504f commit c3a82c9

31 files changed

+245
-251
lines changed

docs/DeveloperGuide.md

+49-22
Original file line numberDiff line numberDiff line change
@@ -146,32 +146,57 @@ How the parsing works:
146146

147147

148148
### 3.4 Model component
149+
149150
**API** : [`Model.java`](https://github.com/AY2122S1-CS2103T-W13-4/tp/blob/master/src/main/java/seedu/address/model/Model.java)
150151

152+
**Description** :
153+
154+
The `Model` component is responsible for storing and managing data. It achieves this by maintaining a runtime model of
155+
the data using Java objects that represent real-world entities and associations that simulate relationships between these entities.
156+
157+
**Functionality** :
158+
159+
* The `UI` uses the data inside the `Model` to display to the user.
160+
* The `Storage`uses the data inside the `Model` to store it on the local hard-disk.
161+
* Does not depend on any of the other three components, as it represents data entities of the domain, which should make sense on their own without depending on other components
162+
163+
**Component Structure** :
164+
151165
<img src="images/ModelClassDiagram.png" width="800" />
152166

153-
The `Model` component is made up of the following subpackages,
167+
The `Model` component consists of the following
154168

155-
* [`friend`](https://github.com/AY2122S1-CS2103T-W13-4/tp/tree/master/src/main/java/seedu/address/model/friend)
169+
* [`friend`](https://github.com/AY2122S1-CS2103T-W13-4/tp/tree/master/src/main/java/seedu/address/model/friend) subpackage
156170
* a `Friend` comprises of a `FriendId`, `FriendName`, `Schedule` and a map of `GameFriendLink`s.
157171
* a `Schedule` is made of 7 `Day`s, each consisting of a `DayOfWeek`.
158172
* stores the friends' data i.e., all `Friend` objects in a `UniqueFriendsList` object.
159173

160-
* [`game`](https://github.com/AY2122S1-CS2103T-W13-4/tp/tree/master/src/main/java/seedu/address/model/game)
161-
* a `Game` comprises of a `GameId` object.
174+
* [`game`](https://github.com/AY2122S1-CS2103T-W13-4/tp/tree/master/src/main/java/seedu/address/model/game) subpackage
175+
* a `Game` comprises of a `GameId` object.
162176
* stores the games' data i.e., all `Game` objects in a `UniqueGamesList` object.
163-
164-
* [`gamefriendlink`](https://github.com/AY2122S1-CS2103T-W13-4/tp/tree/master/src/main/java/seedu/address/model/gamefriendlink)
177+
178+
* [`gamefriendlink`](https://github.com/AY2122S1-CS2103T-W13-4/tp/tree/master/src/main/java/seedu/address/model/gamefriendlink) subpackage
165179
* stores the relationship between a `Friend` and a `Game` through their respective `FriendId` and `GameId`, as a `GameFriendLink` object.
166180
* a `GameFriendLink` comprises of a `UserName` and a `SkillValue`.
167181

168-
The `Model` component also,
182+
* `UserPref` object that represents the user’s preferences. This is exposed to the outside as a `ReadOnlyUserPref` object.
183+
184+
The `Model` component manages the data in the following way:
185+
186+
<img src="images/ModelClassDiagram2.png" width="600" />
187+
188+
Friends:
189+
* The Model manages a `FriendsList`, which is made up of a `UniqueFriendsList`, which contains an `ObservableList<Friend>`.
190+
* This `ObservableList<Friend>` is wrapped inside a `FilteredList<Friend>`. This is to enable easy filtering of the friends list for commands like `--list` and `recommend`.
191+
* This `FilteredList<Friend>` is wrapped inside a `SortedList<Friend>`. This is to enable easy sorting of the friends list for commands like `recommend`.
192+
* The `ObservableList<Friend>` is exposed to the `UI` component and is displayed under the 'Friends' section of the User interface.
193+
194+
<img src="images/ModelClassDiagram3.png" width="600" />
169195

170-
* stores the currently 'selected' `Friend` objects (e.g., results of a `list` query) as a separate _filtered_ list which is not exposed to outsiders.
171-
* stores the currently 'selected' and 'sorted' `Friend` objects (e.g., results of a `recommend` query) as a separate _filteredAndSorted_ list which is exposed to outsiders as an unmodifiable `ObservableList<Friend>` that can be 'observed' <br>e.g. the UI's `Friends` Window is bound to this list so that the UI automatically updates when the data in the list changes.
172-
* stores the currently 'selected' `Game` objects (e.g., results of a 'list' query) as a separate _filtered_ list which is exposed to outsiders as an unmodifiable `ObservableList<Game>` that can be 'observed' <br>e.g. the UI's `Games` Window is bound to this list so that the UI automatically updates when the data in the list changes.
173-
* stores a `UserPref` object that represents the user’s preferences. This is exposed to the outside as a `ReadOnlyUserPref` object.
174-
* does not depend on any of the other three components (as the `Model` represents data entities of the domain, they should make sense on their own without depending on other components)
196+
Games:
197+
* The Model manages a `GamesList`, which is made up of a `UniqueGamesList`, which contains an `ObservableList<Game>`.
198+
* This `ObservableList<Game>` is wrapped inside a `FilteredList<Games>`. This is to enable easy filtering of the games list for commands like `--list`.
199+
* The `ObservableList<Game>` is exposed to the `UI` component and is displayed under the 'Games' section of the user interface.
175200

176201
### 3.5 Storage component
177202

@@ -447,12 +472,15 @@ such as `ModelManager#updateFilteredAndSortedFriendsList(Predicate, Comparator)`
447472

448473
### 4.6 Get Feature
449474

450-
#### 4.6.1 Implementation
475+
#### 4.6.1 Description
476+
477+
The `--get` command is used to get/obtain the complete information about a Friend or Game.
478+
479+
#### 4.6.2 Implementation
451480

452481
When called by the `MainWindow#executeCommand`, the `LogicManager#execute` method proceeds to call the `MainParser#parseCommand` method, which returns a `Command` object based on the workflow shown in the activity diagram below.
453482

454483
<img src="images/GetCommandWorkflowActivityDiagram.png" width="1000">
455-
<br><center><ins>Image: Activity diagram showing the workflow of a '--get' command.</ins></center>
456484

457485
The `--get` command is parsed using the following classes:
458486
* For friends:
@@ -480,12 +508,9 @@ After the `LogicManager#execute` receives a `GetFriendCommand` or `GetGameComman
480508
An example execution of a `GetFriendCommand` is shown in the sequence diagram below.
481509

482510
<img src="images/GetSequenceDiagram.png" width="1000">
483-
<br><center><ins>Image: Sequence diagram showing the interaction between various entities<br>of 'Logic' and 'Model' component during the execution of a 'friend --get FRIEND_ID' command.</ins></center>
484511

485512
`GetGameCommand` is executed similarly, but it deals with games and game lists.
486513

487-
#### 4.6.2 Design Considerations
488-
489514
Once a `CommandResult` is created with the correct `Friend` or `Game`, its passed on to the `Ui`, which then in turn takes care of filtering and displaying the right information of the object in focus.
490515
* `CommandResult` with a `Friend` object
491516
* `Ui` creates a `FriendMainCard` that displays all the information of a friend like the `FriendId`, `Name`, `Schedule` and all the `GameFriendLink`s held in the `Friend` object.
@@ -536,28 +561,30 @@ for future multiplayer competitive gaming sessions.
536561

537562
### 6.2 User stories
538563

539-
Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unlikely to have) - `*`
564+
Priorities: High (must have) - `* * *`, Medium (useful to have) - `* *`, Low (nice to have) - `*`
540565

541566
| Priority | As a (describes user) | I want to be able to (functionality) | So that I can (rationale) |
542567
|----------|-----------------------|--------------------------------------------------------------------|-----------------------------------------------------------|
543-
| *** | user | easily add my friends personal info/data (name, id) | store a list of friends who I can possibly play with |
568+
| *** | user | add my friends personal info/data (name, id) | store a list of friends who I can possibly play with |
544569
| *** | user | link my friends to the games they play | associate my friends with a particular game and store their usernames for each game |
545570
| *** | user | view a list of my friends information | see who my friends are |
546571
| *** | user | delete a friend from the contact list | remove friends that were mistakenly added |
547572
| *** | user | see full information of a friend from the contact list | get any information I want about the friend |
548-
| *** | user | easily add games that I want to play with my friends | store the games that I plan to play with my friends |
573+
| *** | user | add games that I want to play with my friends | store the games that I plan to play with my friends |
549574
| *** | user | view a list of my game information | see which of my friends play certain games |
550575
| *** | user | delete a game from the games list | remove games that were mistakenly added or due to typos |
551576
| *** | user | see full information of a game from the games list | see information about which friends play the game and their in-game usernames |
577+
| ** | user | edit my friends name | update my friends' name without having to recreate a friend |
552578
| ** | user | unlink a game from a friend | remove the association between a friend and a certain game |
553579
| ** | user | add my friends' availabilities to my friends' schedules | store what time they are free during the week |
554580
| ** | user | view my friends' availabilities in their schedules | see what time they are free during the week to play with me |
555581
| ** | user | update my friends' availabilities | update their availabilities should their availabilities change |
556582
| ** | user | add my friends' skill levels for each game | store their relative skill levels for each game that they play |
557583
| ** | user | update my friends' skill levels for each game | update their skill levels over time |
558584
| ** | user | view a recommended list of friends for a game and at a certain time | find friends to play a game with me at a certain timing |
559-
| * | user | store friends' skill levels for a category of game | store friends' skill levels for categories of games |
560-
| * | user | view friends' skill levels for a category of game | see which friends are good at certain categories of games |
585+
| * | user | track the match history of my friends | monitor my friends' progress |
586+
| * | user | store my friends' skill levels of different genres of games | know which genre of games to play with my friend |
587+
561588

562589
### 6.3 Use cases
563590

docs/diagrams/BetterModelClassDiagram.puml

-21
This file was deleted.

docs/diagrams/CommitActivityDiagram.puml

-15
This file was deleted.

docs/diagrams/DeleteGameSequenceDiagram.puml

+9-8
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ participant ":LogicManager" as LogicManager LOGIC_COLOR
77
participant ":MainParser" as MainParser LOGIC_COLOR
88
participant ":GameCommandParser" as GameCommandParser LOGIC_COLOR
99
participant ":DeleteGameCommandParser" as DeleteGameCommandParser LOGIC_COLOR
10-
participant "deleteGameCommand:DeleteGameCommand" as DeleteGameCommand LOGIC_COLOR
10+
participant "c:DeleteGameCommand" as DeleteGameCommand LOGIC_COLOR
1111
end box
1212

1313

@@ -18,13 +18,13 @@ LogicManager -> MainParser : parseCommand("game \n--delete DOTA")
1818
activate MainParser
1919

2020
create GameCommandParser
21-
MainParser -> GameCommandParser : new GameCommandParser()
21+
MainParser -> GameCommandParser : new \n GameCommandParser()
2222
activate GameCommandParser
2323

2424
GameCommandParser --> MainParser
2525
deactivate GameCommandParser
2626

27-
MainParser -> GameCommandParser : parse(" --delete DOTA")
27+
MainParser -> GameCommandParser : parse(" --delete \n DOTA")
2828
activate GameCommandParser
2929

3030
create DeleteGameCommandParser
@@ -37,23 +37,24 @@ GameCommandParser -> DeleteGameCommandParser : parse("--delete \n DOTA")
3737
activate DeleteGameCommandParser
3838

3939
create DeleteGameCommand
40-
DeleteGameCommandParser -> DeleteGameCommand : new DeleteGameCommand(gameId)
40+
DeleteGameCommandParser -> DeleteGameCommand : new \n DeleteGameCommand(gameId)
4141
activate DeleteGameCommand
42-
DeleteGameCommand --> DeleteGameCommandParser : deleteGameCommand
42+
DeleteGameCommand --> DeleteGameCommandParser : c
4343
deactivate DeleteGameCommand
4444

4545

46-
DeleteGameCommandParser --> GameCommandParser : deleteGameCommand
46+
DeleteGameCommandParser --> GameCommandParser : c
4747
deactivate DeleteGameCommandParser
4848
DeleteGameCommandParser -[hidden]-> GameCommandParser
4949
destroy DeleteGameCommandParser
5050

51-
GameCommandParser --> MainParser : deleteGameCommand
51+
GameCommandParser --> MainParser : c
5252
deactivate GameCommandParser
5353
GameCommandParser -[hidden]-> MainParser
54+
GameCommandParser -[hidden]-> MainParser
5455
destroy GameCommandParser
5556

56-
LogicManager <--MainParser : deleteGameCommand
57+
LogicManager <--MainParser : c
5758
deactivate MainParser
5859

5960
ref over LogicManager, DeleteGameCommand: Executing DeleteGameCommand

docs/diagrams/DeleteGameSequenceDiagram2.puml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
!include style.puml
33
skinparam defaultFontSize 20
44

5-
mainframe **sd** execute DeleteGameCommand
5+
mainframe **sd** Executing DeleteGameCommand
66

77
box Logic LOGIC_COLOR_T1
88
participant ":LogicManager" as LogicManager LOGIC_COLOR

docs/diagrams/DeleteSequenceDiagram.puml

+7-7
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ participant ":LogicManager" as LogicManager LOGIC_COLOR
77
participant ":MainParser" as MainParser LOGIC_COLOR
88
participant ":FriendCommandParser" as FriendCommandParser LOGIC_COLOR
99
participant ":DeleteFriendCommandParser" as DeleteFriendCommandParser LOGIC_COLOR
10-
participant "deleteFriendCommand:DeleteFriendCommand" as DeleteFriendCommand LOGIC_COLOR
10+
participant "c:DeleteFriendCommand" as DeleteFriendCommand LOGIC_COLOR
1111
participant ":CommandResult" as CommandResult LOGIC_COLOR
1212
end box
1313

1414
box Model MODEL_COLOR_T1
1515
participant ":Model" as Model MODEL_COLOR
1616
end box
1717

18-
[-> LogicManager : execute("friend --delete draco")
18+
[-> LogicManager : execute("friend\n --delete draco")
1919
activate LogicManager
2020

21-
LogicManager -> MainParser : parseCommand("friend --delete draco")
21+
LogicManager -> MainParser : parseCommand("friend\n --delete draco")
2222
activate MainParser
2323

2424
create FriendCommandParser
@@ -45,22 +45,22 @@ create DeleteFriendCommand
4545
DeleteFriendCommandParser -> DeleteFriendCommand
4646
activate DeleteFriendCommand
4747

48-
DeleteFriendCommand --> DeleteFriendCommandParser : deleteFriendCommand
48+
DeleteFriendCommand --> DeleteFriendCommandParser : c
4949
deactivate DeleteFriendCommand
5050

51-
DeleteFriendCommandParser --> FriendCommandParser : deleteFriendCommand
51+
DeleteFriendCommandParser --> FriendCommandParser : c
5252
deactivate DeleteFriendCommandParser
5353
'Hidden arrow to position the destroy marker below the end of the activation bar.
5454
DeleteFriendCommandParser -[hidden]-> FriendCommandParser
5555
destroy DeleteFriendCommandParser
5656

57-
FriendCommandParser --> MainParser : deleteFriendCommand
57+
FriendCommandParser --> MainParser : c
5858
deactivate FriendCommandParser
5959
'Hidden arrow to position the destroy marker below the end of the activation bar.
6060
FriendCommandParser -[hidden]-> MainParser
6161
destroy FriendCommandParser
6262

63-
MainParser --> LogicManager : deleteFriendCommand
63+
MainParser --> LogicManager : c
6464
deactivate MainParser
6565

6666
LogicManager -> DeleteFriendCommand : execute()

docs/diagrams/GetSequenceDiagram.puml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
@startuml
22
!include style.puml
33
skinparam defaultFontSize 18
4-
skinparam maxMessageSize 10
54

65
box Logic LOGIC_COLOR_T1
76

@@ -41,12 +40,13 @@ Model --> GetFriendCommand : FRIEND
4140
deactivate Model
4241

4342
create CommandResult
44-
GetFriendCommand -> CommandResult : CommandResult(messageToDisplay, CommandType.FRIEND_GET, FRIEND)
43+
GetFriendCommand -> CommandResult : CommandResult(...)
4544
activate CommandResult
4645

4746
CommandResult --> GetFriendCommand
4847
deactivate CommandResult
4948

5049
GetFriendCommand --> LogicManager : CommandResult
50+
deactivate GetFriendCommand
5151

5252
@enduml

docs/diagrams/LinkSequenceDiagram1.puml

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ participant ":LogicManager" as LogicManager LOGIC_COLOR
77
participant ":MainParser" as MainParser LOGIC_COLOR
88
participant ":FriendCommandParser" as FriendCommandParser LOGIC_COLOR
99
participant ":LinkFriendCommandParser" as LinkFriendCommandParser LOGIC_COLOR
10-
participant "linkFriendCommand:LinkFriendCommand" as LinkFriendCommand LOGIC_COLOR
10+
participant "c:LinkFriendCommand" as LinkFriendCommand LOGIC_COLOR
1111
end box
1212

1313
box Model MODEL_COLOR_T1
@@ -44,22 +44,22 @@ create LinkFriendCommand
4444
LinkFriendCommandParser -> LinkFriendCommand
4545
activate LinkFriendCommand
4646

47-
LinkFriendCommand --> LinkFriendCommandParser : linkFriendCommand
47+
LinkFriendCommand --> LinkFriendCommandParser : c
4848
deactivate LinkFriendCommand
4949

50-
LinkFriendCommandParser --> FriendCommandParser : linkFriendCommand
50+
LinkFriendCommandParser --> FriendCommandParser : c
5151
deactivate LinkFriendCommandParser
5252
'Hidden arrow to position the destroy marker below the end of the activation bar.
5353
LinkFriendCommandParser -[hidden]-> FriendCommandParser
5454
destroy LinkFriendCommandParser
5555

56-
FriendCommandParser --> MainParser : linkFriendCommand
56+
FriendCommandParser --> MainParser : c
5757
deactivate FriendCommandParser
5858
'Hidden arrow to position the destroy marker below the end of the activation bar.
5959
FriendCommandParser -[hidden]-> MainParser
6060
destroy FriendCommandParser
6161

62-
MainParser --> LogicManager : linkFriendCommand
62+
MainParser --> LogicManager : c
6363
deactivate MainParser
6464

6565
ref over LogicManager, Model: Executing LinkFriendCommand

docs/diagrams/LinkSequenceDiagram2.puml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
skinparam defaultFontSize 20
44
skinparam maxMessageSize 10
55

6-
mainframe **sd** execute LinkFriendCommand
6+
mainframe **sd** Executing LinkFriendCommand
77

88
box Logic LOGIC_COLOR_T1
99

docs/diagrams/ModelClassDiagram2.puml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
@startuml
2+
!include style.puml
3+
skinparam arrowThickness 1.1
4+
skinparam arrowColor MODEL_COLOR
5+
skinparam UiBackgroundColor UI_COLOR
6+
skinparam genericDisplay old
7+
skinparam defaultFontSize 20
8+
9+
Package Model {
10+
Class ObservableList<Friend> <<Interface>> MODEL_COLOR
11+
Class FriendsList MODEL_COLOR
12+
13+
Package friend {
14+
Class UniqueFriendsList MODEL_COLOR
15+
}
16+
17+
Class FilteredList<Friend> MODEL_COLOR
18+
Class SortedList<Friend> MODEL_COLOR
19+
}
20+
21+
Package UI {
22+
Class FriendListPanel UI_COLOR
23+
}
24+
25+
FriendsList *-down-> "1" UniqueFriendsList
26+
FriendsList -[hidden]right-- SortedList
27+
UniqueFriendsList *-down-> "1" ObservableList
28+
FilteredList *-down-> "1" ObservableList
29+
SortedList *-down-> "1" FilteredList
30+
31+
FriendListPanel .-left-> ObservableList UI_COLOR
32+
33+
@enduml

0 commit comments

Comments
 (0)