forked from nus-cs2113-AY2324S2/tp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sequence Diagram for set-genre and label
- Loading branch information
1 parent
08ba060
commit 6bd82ca
Showing
4 changed files
with
164 additions
and
51 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,45 @@ | ||
|
||
|
||
@startuml | ||
participant User | ||
participant "ParserMain" as ParserMain | ||
participant "ParserGenre" as ParserGenre | ||
participant "BookList" as BookList | ||
participant "BookGenre" as BookGenre | ||
participant "Ui" as Ui | ||
|
||
User -> ParserMain : set-genre [BOOK_INDEX] | ||
ParserMain -> ParserGenre : executeParseSetGenre(books, inputArray) | ||
ParserGenre -> BookList : validate index | ||
ParserGenre -> ParserGenre : genreSelectionPrinter() | ||
ParserGenre -> User : Display available genres | ||
|
||
alt selecting existing genre | ||
User -> ParserGenre : Select genre number | ||
ParserGenre -> BookList : getAvailableGenres() | ||
ParserGenre -> BookGenre : setBookGenreByIndex(index, selectedGenre, books) | ||
BookGenre -> BookList : getBook(index) | ||
BookGenre -> Ui : setGenreBookMessage(title, genre) | ||
Ui -> User : confirmation message | ||
else adding new genre | ||
User -> ParserGenre : 6 (Add new genre) | ||
ParserGenre -> User : Enter new genre | ||
User -> ParserGenre : Input custom genre | ||
ParserGenre -> BookList : Add new genre to list | ||
ParserGenre -> BookGenre : setBookGenreByIndex(index, newGenre, books) | ||
BookGenre -> BookList : getBook(index) | ||
BookGenre -> Ui : setGenreBookMessage(title, genre) | ||
Ui -> User : confirmation message | ||
end | ||
|
||
@enduml | ||
|
||
|
||
|
||
Flow: | ||
1. The user initiates the set-genre command. | ||
2. ParserMain processes the input and delegates the command to ParserGenre. | ||
3. ParserGenre then interacts with BookList to validate the book index and displays the available genres. | ||
4. The user selects a genre or adds a new one, which ParserGenre processes. | ||
5. If a new genre is added, it is included in the available genres in BookList. | ||
6. Finally, BookGenre sets the genre for the specific book. |
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,39 @@ | ||
@startuml | ||
participant User | ||
participant "ParserMain" as ParserMain | ||
participant "ParserLabel" as ParserLabel | ||
participant "BookList" as BookList | ||
participant "BookLabel" as BookLabel | ||
participant "Ui" as Ui | ||
|
||
User -> ParserMain : label [BOOK_INDEX] [LABEL] | ||
activate ParserMain | ||
ParserMain -> ParserLabel : executeParseSetLabel(books, inputArray) | ||
activate ParserLabel | ||
|
||
ParserLabel -> BookList : getBook(index) | ||
activate BookList | ||
BookList --> ParserLabel : book | ||
deactivate BookList | ||
|
||
ParserLabel -> BookLabel : setBookLabelByIndex(index, label, books) | ||
activate BookLabel | ||
|
||
BookLabel -> Ui : labelBookMessage(title, label) | ||
activate Ui | ||
Ui -> User : confirmation message | ||
deactivate Ui | ||
|
||
deactivate BookLabel | ||
deactivate ParserLabel | ||
deactivate ParserMain | ||
@enduml | ||
|
||
|
||
|
||
Flow: | ||
1. The user initiates the label command with a book index and a label. | ||
2. ParserMain receives the command and delegates to ParserLabel. | ||
3. ParserLabel parses the command, validates the input, and then calls BookLabel to set the label for the specified book. | ||
4. BookLabel updates the label in the BookMain instance. | ||
5. Finally, a confirmation message is displayed to the user. |