Skip to content

Commit

Permalink
Merge pull request AY2324S2-CS2103T-T15-1#249 from alfaloo/debug
Browse files Browse the repository at this point in the history
Add execute sequence diagrams
  • Loading branch information
Alteqa authored Apr 15, 2024
2 parents 341142e + 6ff99a3 commit 447aa63
Show file tree
Hide file tree
Showing 10 changed files with 240 additions and 1 deletion.
63 changes: 63 additions & 0 deletions docs/diagrams/AddPatientCommandExecuteSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
@startuml
!include style.puml
skinparam ArrowFontStyle plain

box Logic LOGIC_COLOR_T1
participant ":AddPatientCommand" as AddPatientCommand LOGIC_COLOR
participant ":CommandResult" as CommandResult LOGIC_COLOR
end box

box Commons LOGGER_COLOR_T1
participant ":Logger" as Logger LOGGER_COLOR
end box

box Model MODEL_COLOR_T1
participant ":Model" as Model MODEL_COLOR
end box

[-> AddPatientCommand : execute()
activate AddPatientCommand


AddPatientCommand -> Logger: log(Level.INFO, "Duplicate")
activate Logger
Logger -> Logger: log
Logger -> AddPatientCommand
deactivate Logger


alt model.hasPerson(toAdd)
AddPatientCommand -> Model: hasPerson(toAdd)
activate Model
Model -> AddPatientCommand
deactivate Model
[<--AddPatientCommand: throw CommandException()
else else
AddPatientCommand -> Model : hasPerson(toAdd)
activate Model

Model --> AddPatientCommand

AddPatientCommand -> Model : addPerson(toAdd)

Model --> AddPatientCommand
deactivate Model

AddPatientCommand -> Logger: log(Level.INFO, "Success")
activate Logger
Logger -> Logger: log
Logger -> AddPatientCommand
deactivate Logger

create CommandResult
AddPatientCommand -> CommandResult
activate CommandResult

CommandResult --> AddPatientCommand : result
deactivate CommandResult

[<--AddPatientCommand : result
deactivate AddPatientCommand
end

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

box Logic LOGIC_COLOR_T1
participant ":DeleteCommand" as DeleteCommand LOGIC_COLOR
participant ":CommandResult" as CommandResult LOGIC_COLOR
end box

box Commons LOGGER_COLOR_T1
participant ":Index" as Index LOGGER_COLOR
end box

box Model MODEL_COLOR_T1
participant ":Model" as Model MODEL_COLOR
end box

[-> DeleteCommand : execute()
activate DeleteCommand

DeleteCommand -> Model: getFilteredPersonList()
activate Model
Model -> DeleteCommand
deactivate Model

alt index.getZeroBased() >= lastShownList.size()
DeleteCommand -> Index: getZeroBased()
activate Index
Index -> DeleteCommand
deactivate Index

[<--DeleteCommand: throw CommandException()
else else
DeleteCommand -> Index: getZeroBased()
activate Index
Index -> DeleteCommand
deactivate Index

DeleteCommand -> Model : deletePerson(personToDelete)
activate Model

Model --> DeleteCommand
deactivate Model

create CommandResult
DeleteCommand -> CommandResult
activate CommandResult

CommandResult --> DeleteCommand : result
deactivate CommandResult

[<--DeleteCommand : result
deactivate DeleteCommand
end

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

box Logic LOGIC_COLOR_T1
participant ":EditCommand" as EditCommand LOGIC_COLOR
participant ":CommandResult" as CommandResult LOGIC_COLOR
end box

box Commons LOGGER_COLOR_T1
participant ":Index" as Index LOGGER_COLOR
end box

box Model MODEL_COLOR_T1
participant ":Model" as Model MODEL_COLOR
end box

[-> EditCommand : execute()
activate EditCommand

EditCommand -> Model: getFilteredPersonList()
activate Model
Model -> EditCommand
deactivate Model

alt index.getZeroBased() >= lastShownList.size()
EditCommand -> Index: getZeroBased()
activate Index
Index -> EditCommand
deactivate Index

[<--EditCommand: throw CommandException()
else else
EditCommand -> Index: getZeroBased()
activate Index
Index -> EditCommand
deactivate Index

EditCommand -> EditCommand: createEditedPerson(personToEdit, editPersonDescriptor)
alt model.hasPerson(editedPerson)
EditCommand -> Model: hasPerson(editedPerson)
activate Model
Model -> EditCommand
deactivate Model
[<--EditCommand: throw CommandException()
else else
EditCommand -> Model : hasPerson(editedPerson)
activate Model

Model --> EditCommand

EditCommand -> Model : setPerson(personToEdit, editedPerson)

Model --> EditCommand

EditCommand -> Model : updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS);

Model --> EditCommand
deactivate Model

create CommandResult
EditCommand -> CommandResult
activate CommandResult

CommandResult --> EditCommand : result
deactivate CommandResult

[<--EditCommand : result
deactivate EditCommand
end
end

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

box Logic LOGIC_COLOR_T1
participant ":QueryPatientCommand" as QueryPatientCommand LOGIC_COLOR
participant ":CommandResult" as CommandResult LOGIC_COLOR
end box

box Commons LOGGER_COLOR_T1
participant ":Logger" as Logger LOGGER_COLOR
end box

box Model MODEL_COLOR_T1
participant ":Model" as Model MODEL_COLOR
end box

[-> QueryPatientCommand : execute()
activate QueryPatientCommand

QueryPatientCommand -> Model : updateFilteredPersonList(predicate)
activate Model

Model --> QueryPatientCommand

deactivate Model

QueryPatientCommand -> Logger: log(Level.INFO, "Success")
activate Logger
Logger -> Logger: log
Logger -> QueryPatientCommand
deactivate Logger

create CommandResult
QueryPatientCommand -> CommandResult
activate CommandResult

CommandResult --> QueryPatientCommand : result
deactivate CommandResult

[<--QueryPatientCommand : result
deactivate QueryPatientCommand

@enduml
3 changes: 3 additions & 0 deletions docs/diagrams/style.puml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
!define STORAGE_COLOR_T3 #806600
!define STORAGE_COLOR_T2 #544400

!define LOGGER_COLOR #cc0099
!define LOGGER_COLOR_T1 #ff99ff

!define USER_COLOR #000000

skinparam Package {
Expand Down
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/EditCommandExecuteSequenceDiagram.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.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class Appointment {
private static final Logger logger = LogsCenter.getLogger(Appointment.class);

private static final String MESSAGE_CONSTRAINTS_INVALID_DATE =
"Appointment should be made with a date-time today onwards";
"Appointments should not be scheduled in the past.";

// The doctor in charge of the appointment
private Nric doctorNric;
Expand Down

0 comments on commit 447aa63

Please sign in to comment.