Skip to content

Commit

Permalink
Merge pull request #334 from Clarenceeey/update/DG
Browse files Browse the repository at this point in the history
Put sequence diagrams for consultations
  • Loading branch information
S-K-Y-Light authored Nov 12, 2024
2 parents 0af058f + a12df79 commit 6526116
Show file tree
Hide file tree
Showing 12 changed files with 415 additions and 99 deletions.
319 changes: 234 additions & 85 deletions docs/DeveloperGuide.md

Large diffs are not rendered by default.

45 changes: 45 additions & 0 deletions docs/diagrams/Consults/ConsultCommands.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
@startuml

!include ../style.puml

skinparam arrowThickness 1.1
skinparam arrowColor LOGIC_COLOR_T4
skinparam classBackgroundColor LOGIC_COLOR

title Add Consult Command and Parser UML Diagram
package Logic {

package Commands {
Class "{abstract}\nCommand" as Command
Class AddConsultCommand
Class CommandResult
}

package "Parser Classes" {
Class AddConsultCommandParser
}
}

package Model {
Class Consultation
Class Student
Class Date
Class Time
}

' Command relationships
Command <|-- AddConsultCommand
Command ..> CommandResult : creates >

' Parser relationships
AddConsultCommandParser ..> AddConsultCommand : creates >

' Model relationships
Consultation *-- "*" Student
Consultation *-- "1" Date
Consultation *-- "1" Time

' Group visibility for logical structure
CommandResult ..> Consultation : creates >

@enduml
84 changes: 84 additions & 0 deletions docs/diagrams/Consults/SequenceDiagramAddToConsultCommand.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@

@startuml
!include ../style.puml
skinparam ArrowFontStyle plain

title AddToConsultCommand Sequence Diagram

box Logic
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":AddressBookParser" as addressBookParser LOGIC_COLOR_T3
participant ":AddToConsultCommandParser" as AddToConsultCommandParser LOGIC_COLOR_T2
participant ":AddToConsultCommand" as AddToConsultCommand LOGIC_COLOR_T1
participant ":CommandResult" as CommandResult LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
Participant ":Model" as model MODEL_COLOR
end box

-[UI_COLOR]> LogicManager : execute("addtoconsult 1 n/John Doe i/3")
activate LogicManager LOGIC_COLOR

'Logic manager calls AddressBookParser and passes the command
LogicManager -[LOGIC_COLOR]> addressBookParser : parseCommand("addtoconsult 1 n/John Doe i/3")
activate addressBookParser LOGIC_COLOR_T3

'AddressBookParser creates an instance of the parser
create AddToConsultCommandParser
addressBookParser -[LOGIC_COLOR_T3]> AddToConsultCommandParser :
activate AddToConsultCommandParser LOGIC_COLOR_T2

AddToConsultCommandParser --[LOGIC_COLOR_T2]> addressBookParser
deactivate AddToConsultCommandParser

' AddressBookParser calls the parse command
addressBookParser -[LOGIC_COLOR_T3]> AddToConsultCommandParser : parse("1 n/John Doe i/3")
activate AddToConsultCommandParser LOGIC_COLOR_T2

'Within the parse command, the parser creates an instance of the command
create AddToConsultCommand
AddToConsultCommandParser --[LOGIC_COLOR_T2]> AddToConsultCommand :
activate AddToConsultCommand LOGIC_COLOR_T1

AddToConsultCommand --[LOGIC_COLOR]> AddToConsultCommandParser
deactivate AddToConsultCommand LOGIC_COLOR_T1

'parser returns the command to the AddressBookParser
AddToConsultCommandParser --[LOGIC_COLOR_T2]> addressBookParser : AddToConsultCommand
deactivate AddToConsultCommandParser

AddToConsultCommandParser --[hidden]> addressBookParser : AddToConsultCommand
destroy AddToConsultCommandParser

addressBookParser --[LOGIC_COLOR_T3]> LogicManager : AddToConsultCommand
deactivate addressBookParser

'LogicManager calls command.execute
LogicManager -[LOGIC_COLOR]> AddToConsultCommand : execute(model)
activate AddToConsultCommand LOGIC_COLOR_T1

'get filteredConsultationList
AddToConsultCommand -[LOGIC_COLOR]> model : addStudent(student)
activate model MODEL_COLOR


model -[MODEL_COLOR]-> AddToConsultCommand
deactivate model

create CommandResult
AddToConsultCommand --[LOGIC_COLOR_T2]> CommandResult
activate CommandResult LOGIC_COLOR
CommandResult --[LOGIC_COLOR]> AddToConsultCommand
deactivate CommandResult


'After adding students, return new consultation
AddToConsultCommand --[LOGIC_COLOR]> LogicManager : CommandResult
deactivate AddToConsultCommand LOGIC_COLOR_T1
AddToConsultCommand --[hidden]> LogicManager : CommandResult
destroy AddToConsultCommand

[<-[UI_COLOR]-LogicManager : CommandResult

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

title addStudent Method Sequence Diagram

box Logic
participant ":AddToConsultCommand" as client LOGIC_COLOR
end box

box Model
participant ":Consultation" as consultation MODEL_COLOR
end box



client -> consultation : addStudent(student)
activate consultation

consultation -> consultation : hasStudent(student)
activate consultation

consultation -> consultation :
deactivate consultation

alt student already in consult

consultation -> client : nothing is added, exception thrown

else student not in consult

consultation -> client : student added to consult successfully

end alt

deactivate consultation

@enduml
28 changes: 14 additions & 14 deletions docs/diagrams/Lessons/SequenceDiagramAddToLessonCommand.puml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ skinparam ArrowFontStyle plain
title AddToLessonCommand Sequence Diagram

box Logic
Participant ":LogicManager" as LogicManager LOGIC_COLOR
Participant ":AddressBookParser" as addressBookParser LOGIC_COLOR_T3
Participant ":AddToLessonCommandParser" as AddToLessonCommandParser LOGIC_COLOR_T2
Participant ":AddToLessonCommand" as AddToLessonCommand LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":AddressBookParser" as addressBookParser LOGIC_COLOR_T3
participant ":AddToLessonCommandParser" as AddToLessonCommandParser LOGIC_COLOR_T2
participant ":AddToLessonCommand" as AddToLessonCommand LOGIC_COLOR_T1
participant ":CommandResult" as CommandResult LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
Expand All @@ -24,7 +25,7 @@ activate addressBookParser LOGIC_COLOR_T3

'AddressBookParser creates an instance of the parser
create AddToLessonCommandParser
addressBookParser -[LOGIC_COLOR_T3]> AddToLessonCommandParser : AddToLessonCommandParser(arguments)
addressBookParser -[LOGIC_COLOR_T3]> AddToLessonCommandParser
activate AddToLessonCommandParser LOGIC_COLOR_T2

AddToLessonCommandParser --[LOGIC_COLOR_T2]> addressBookParser
Expand All @@ -36,7 +37,7 @@ activate AddToLessonCommandParser LOGIC_COLOR_T2

'Within the parse command, the parser creates an instance of the command
create AddToLessonCommand
AddToLessonCommandParser --[LOGIC_COLOR_T2]> AddToLessonCommand : AddToLessonCommand(index, studentNames, indices)
AddToLessonCommandParser --[LOGIC_COLOR_T2]> AddToLessonCommand
activate AddToLessonCommand LOGIC_COLOR_T1

AddToLessonCommand --[LOGIC_COLOR]> AddToLessonCommandParser
Expand All @@ -56,20 +57,19 @@ deactivate addressBookParser
LogicManager -[LOGIC_COLOR]> AddToLessonCommand : execute(model)
activate AddToLessonCommand LOGIC_COLOR_T1

'get filteredLessonList
AddToLessonCommand -[LOGIC_COLOR]> model : getFilteredLessonList()
activate model MODEL_COLOR

model -[MODEL_COLOR]-> AddToLessonCommand
deactivate model

'get filteredStudentList
AddToLessonCommand -[LOGIC_COLOR]> model : filteredStudentList()
AddToLessonCommand -[LOGIC_COLOR]> model : addStudent
activate model MODEL_COLOR

model -[MODEL_COLOR]-> AddToLessonCommand
deactivate model

create CommandResult
AddToLessonCommand --[LOGIC_COLOR_T2]> CommandResult
activate CommandResult LOGIC_COLOR
CommandResult --[LOGIC_COLOR]> AddToLessonCommand
deactivate CommandResult

'After adding students, return new lesson
AddToLessonCommand --[LOGIC_COLOR]> LogicManager : CommandResult
deactivate AddToLessonCommand LOGIC_COLOR_T1
Expand Down
Binary file added docs/images/Consultation/ConsultCommands.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.
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/Lessons/LessonsAndRelatedCommands.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.
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/helpMessage.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 6526116

Please sign in to comment.