Skip to content

Commit

Permalink
Update DG with implementation details
Browse files Browse the repository at this point in the history
  • Loading branch information
ruishanteo committed Nov 3, 2023
1 parent db328c6 commit a7231f8
Show file tree
Hide file tree
Showing 9 changed files with 443 additions and 189 deletions.
404 changes: 238 additions & 166 deletions docs/DeveloperGuide.md

Large diffs are not rendered by default.

38 changes: 15 additions & 23 deletions docs/diagrams/AddTutorActivityDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,27 @@ skin rose
skinparam ActivityFontSize 15
skinparam ArrowFontSize 12
start
:User executes command;
:User runs add-t command;

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

if () then ([all fields present])
if () then ([no repeated fields])
if () then ([valid name])
if () then ([valid phone])
if () then ([valid email])
if () then ([non-duplicate tutor])
:Add tutor to AddressBook;
else ([else])
:ErrorDuplicateTutor;
endif
else ([else])
:Error: Emails should be of the format local-part@domain...;
endif
else ([else])
:Error: Phone numbers should only contain numbers, ...;
endif
else ([else])
:Error: Names should only contain alphanumeric characters, ...;
endif
:Parse user input;

if () then ([input is valid])
:Construct new Person object;
:Construct AddTutorCommand object;
:Return back to LogicManager;
:LogicManager executes AddTutorCommand;
if () then ([person does not already exist])
:Insert person to PersonList;
:Update UI;
else ([else])
:ErrorDuplicatePrefixes;
:Display duplicate person error message;
endif
else ([else])
:ErrorInvalidCommandFormat;
:Display error message;

endif
stop
@enduml
@enduml
71 changes: 71 additions & 0 deletions docs/diagrams/ChangeThemeSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
@startuml
!include style.puml
skinparam ArrowFontStyle plain
box Ui UI_COLOR_T1
participant ":Ui" as Ui UI_COLOR
end box

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR
participant ":ThemeCommandParser" as ThemeCommandParser LOGIC_COLOR
participant "d:ThemeCommand" as ThemeCommand LOGIC_COLOR
participant ":CommandResult" as CommandResult LOGIC_COLOR
end box

[-> Ui :
activate Ui

Ui -> LogicManager : execute\n("theme\ndark")
activate LogicManager

LogicManager -> AddressBookParser : parseCommand\n("theme dark")
activate AddressBookParser

create ThemeCommandParser
AddressBookParser -> ThemeCommandParser
activate ThemeCommandParser

ThemeCommandParser --> AddressBookParser
deactivate ThemeCommandParser

AddressBookParser -> ThemeCommandParser : parse("dark")
activate ThemeCommandParser

create ThemeCommand
ThemeCommandParser -> ThemeCommand
activate ThemeCommand

ThemeCommand --> ThemeCommandParser : c
deactivate ThemeCommand

ThemeCommandParser --> AddressBookParser : c
deactivate ThemeCommandParser
'Hidden arrow to position the destroy marker below the end of the activation bar.
ThemeCommandParser -[hidden]-> AddressBookParser
destroy ThemeCommandParser

AddressBookParser --> LogicManager : c
deactivate AddressBookParser

LogicManager -> ThemeCommand : execute()
activate ThemeCommand

create CommandResult
ThemeCommand -> CommandResult
activate CommandResult

CommandResult --> ThemeCommand : result
deactivate CommandResult

ThemeCommand --> LogicManager : result
deactivate ThemeCommand

LogicManager --> Ui : result
deactivate LogicManager

Ui --> Ui : handle\nChange\nTheme()

[<--Ui
deactivate Ui
@enduml
34 changes: 34 additions & 0 deletions docs/diagrams/EditScheduleActivityDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
@startuml
skin rose
skinparam ActivityFontSize 15
skinparam ArrowFontSize 12
start
:User runs edit-s command;

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

:Parse user input;

if () then ([input is valid])
:Construct EditScheduleDescriptor object;
:Construct EditScheduleCommand object;
:Return back to LogicManager;
:LogicManager executes EditScheduleCommand;
:Construct edited Schedule;
if () then ([edited schedule does not already exist])
if () then ([edited schedule does not clash with existing schedule])
:Replace schedule with edited schedule in ScheduleList;
:Update UI;
else ([else])
:Display clashing schedule error message;
endif
else ([else])
:Display duplicate schedule error message;
endif
else ([else])
:Display error message;

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

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR
participant ":EditScheduleCommandParser" as EditScheduleCommandParser LOGIC_COLOR
participant "e:EditScheduleDescriptor" as EditScheduleDescriptor LOGIC_COLOR
participant "d:EditScheduleCommand" as EditScheduleCommand LOGIC_COLOR
participant ":CommandResult" as CommandResult LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
participant ":Model" as Model MODEL_COLOR
participant "editedSchedule:Schedule" as EditedSchedule MODEL_COLOR
end box

[-> LogicManager : execute("edit-s 1 st/st/2023-09-15T09:00")
activate LogicManager

LogicManager -> AddressBookParser : parseCommand("edit-s 1 st/2023-09-15T09:00")
activate AddressBookParser

create EditScheduleCommandParser
AddressBookParser -> EditScheduleCommandParser
activate EditScheduleCommandParser

EditScheduleCommandParser --> AddressBookParser
deactivate EditScheduleCommandParser

AddressBookParser -> EditScheduleCommandParser : parse("1 st/2023-09-15T09:00")
activate EditScheduleCommandParser

create EditScheduleDescriptor
EditScheduleCommandParser -> EditScheduleDescriptor
activate EditScheduleDescriptor

EditScheduleDescriptor --> EditScheduleCommandParser : e
deactivate EditScheduleDescriptor

create EditScheduleCommand
EditScheduleCommandParser -> EditScheduleCommand
activate EditScheduleCommand

EditScheduleCommand --> EditScheduleCommandParser : d
deactivate EditScheduleCommand

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

AddressBookParser --> LogicManager : d
deactivate AddressBookParser

LogicManager -> EditScheduleCommand : execute()
activate EditScheduleCommand

create EditedSchedule
EditScheduleCommand -> EditedSchedule ++
return
EditScheduleCommand -> Model ++ : hasSchedule(editedSchedule)
return
EditScheduleCommand -> Model ++ : setSchedule(scheduleToEdit, editedSchedule)
return
EditScheduleCommand -> Model ++ : updateFilteredScheduleList()
deactivate Model

deactivate Model

create CommandResult
EditScheduleCommand -> CommandResult
activate CommandResult

CommandResult --> EditScheduleCommand
deactivate CommandResult

EditScheduleCommand --> LogicManager : result
deactivate EditScheduleCommand

[<--LogicManager
deactivate LogicManager
@enduml
Binary file modified docs/images/AddTutorActivityDiagram.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/ChangeThemeSequenceDiagram.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/EditScheduleActivityDiagram.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/EditScheduleSequenceDiagram.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 a7231f8

Please sign in to comment.