Skip to content

Commit

Permalink
Merge pull request AY2324S2-CS2103T-T08-1#232 from laney0808/dg
Browse files Browse the repository at this point in the history
DG: Lan Yu
  • Loading branch information
NatLeong authored Apr 13, 2024
2 parents cbacb66 + 8953267 commit 65cd725
Show file tree
Hide file tree
Showing 11 changed files with 277 additions and 106 deletions.
182 changes: 92 additions & 90 deletions docs/DeveloperGuide.md

Large diffs are not rendered by default.

63 changes: 63 additions & 0 deletions docs/diagrams/CreateCommandLogic.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 ":LogicManager" as LogicManager LOGIC_COLOR
participant ":ImmuniMateParser" as ImmuniMateParser LOGIC_COLOR
participant ":CreateCommandParser" as CreateCommandParser LOGIC_COLOR
participant "c:CreateCommand" as CreateCommand LOGIC_COLOR
participant "r:CommandResult" as CommandResult LOGIC_COLOR
end box

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

[-> LogicManager : execute("create ...")
activate LogicManager
LogicManager -> ImmuniMateParser : parseCommand("create ...")
activate ImmuniMateParser

create CreateCommandParser
ImmuniMateParser -> CreateCommandParser
activate CreateCommandParser
CreateCommandParser --> ImmuniMateParser
deactivate CreateCommandParser
ImmuniMateParser -> CreateCommandParser : parse("...")
activate CreateCommandParser

create CreateCommand
CreateCommandParser -> CreateCommand
activate CreateCommand
CreateCommand --> CreateCommandParser
deactivate CreateCommand
CreateCommandParser --> ImmuniMateParser : c
deactivate CreateCommandParser
'Hidden arrow to position the destroy marker below the end of the activation bar.
CreateCommandParser -[hidden]-> ImmuniMateParser
destroy CreateCommandParser
ImmuniMateParser --> LogicManager : c
deactivate ImmuniMateParser
LogicManager -> CreateCommand : execute()
activate CreateCommand
CreateCommand -> Model : hasPerson(...)
activate Model
Model --> CreateCommand : false
deactivate Model
CreateCommand -> Model : addPerson(...)
activate Model
Model --> CreateCommand : add person in the model
deactivate Model

create CommandResult
CreateCommand -> CommandResult
activate CommandResult
CommandResult --> CreateCommand
deactivate
CreateCommand --> LogicManager : r
deactivate CreateCommand

[<--LogicManager : r
deactivate LogicManager
@enduml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
@startuml
!include style.puml
skinparam ArrowFontStyle plain
box Logic LOGIC_COLOR_T1
participant "l:Logic" as CreateCommand LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
participant ":CreateCommand" as CreateCommand MODEL_COLOR
participant ":ModelManager" as ModelManager MODEL_COLOR
participant ":ImmuniMate" as ImmuniMate MODEL_COLOR
participant ":UniquePersonList" as UniquePersonList MODEL_COLOR
Expand Down Expand Up @@ -44,6 +46,31 @@ deactivate ImmuniMate
ModelManager --> CreateCommand
deactivate ModelManager

CreateCommand -> ModelManager : addPerson(p)
activate ModelManager

ModelManager -> ImmuniMate: addPerson(p)
activate ImmuniMate

ImmuniMate -> UniquePersonList : add(p)
activate UniquePersonList

UniquePersonList -> internalList : add(p)
activate internalList

internalList --> UniquePersonList
deactivate internalList

UniquePersonList --> ImmuniMate
deactivate UniquePersonList

ImmuniMate --> ModelManager
deactivate ImmuniMate

ModelManager --> CreateCommand
deactivate ModelManager

[<--CreateCommand
deactivate CreateCommand

@enduml
76 changes: 76 additions & 0 deletions docs/diagrams/DeleteModelDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
@startuml
!include style.puml
skinparam ArrowFontStyle plain
box Logic LOGIC_COLOR_T1
participant "l:Logic" as Logic LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
participant ":ModelManager" as ModelManager MODEL_COLOR
participant ":ImmuniMate" as ImmuniMate MODEL_COLOR
participant ":UniquePersonList" as UniquePersonList MODEL_COLOR
participant "internalList: ObservableList<Person>" as internalList MODEL_COLOR
participant "p:Person" as p MODEL_COLOR
end box

[-> Logic : execute()
activate Logic

Logic -> ModelManager : hasPerson(p)
activate ModelManager

ModelManager -> ImmuniMate: hasPerson(p)
activate ImmuniMate

ImmuniMate --> UniquePersonList : contains(p)
activate UniquePersonList

UniquePersonList -> internalList : stream().anyMatch(p::isSamePerson)
activate internalList

internalList -> p : isSamePerson(p)
activate p

p --> internalList
deactivate p

internalList --> UniquePersonList
deactivate internalList

UniquePersonList --> ImmuniMate
deactivate UniquePersonList

ImmuniMate --> ModelManager
deactivate ImmuniMate

ModelManager --> Logic
deactivate ModelManager

Logic -> ModelManager : deletePerson(p)
activate ModelManager

ModelManager -> ImmuniMate: deletePerson(p)
activate ImmuniMate

ImmuniMate -> UniquePersonList : remove(p)
activate UniquePersonList

UniquePersonList -> internalList : remove(p)
activate internalList

internalList --> UniquePersonList
deactivate internalList

UniquePersonList --> ImmuniMate
deactivate UniquePersonList

ImmuniMate --> ModelManager
deactivate ImmuniMate

ModelManager --> Logic
deactivate ModelManager

[<--Logic
deactivate Logic

@enduml
31 changes: 17 additions & 14 deletions docs/diagrams/DeleteSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ skinparam ArrowFontStyle plain

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR
participant ":ImmuniMateParser" as ImmuniMateParser LOGIC_COLOR
participant ":DeleteCommandParser" as DeleteCommandParser LOGIC_COLOR
participant "d:DeleteCommand" as DeleteCommand LOGIC_COLOR
participant "r:CommandResult" as CommandResult LOGIC_COLOR
Expand All @@ -14,20 +14,20 @@ box Model MODEL_COLOR_T1
participant "m:Model" as Model MODEL_COLOR
end box

[-> LogicManager : execute("delete 1")
[-> LogicManager : execute("delete S1234567X")
activate LogicManager

LogicManager -> AddressBookParser : parseCommand("delete 1")
activate AddressBookParser
LogicManager -> ImmuniMateParser : parseCommand("delete S1234567X")
activate ImmuniMateParser

create DeleteCommandParser
AddressBookParser -> DeleteCommandParser
ImmuniMateParser -> DeleteCommandParser
activate DeleteCommandParser

DeleteCommandParser --> AddressBookParser
DeleteCommandParser --> ImmuniMateParser
deactivate DeleteCommandParser

AddressBookParser -> DeleteCommandParser : parse("1")
ImmuniMateParser -> DeleteCommandParser : parse("S1234567X")
activate DeleteCommandParser

create DeleteCommand
Expand All @@ -37,22 +37,25 @@ activate DeleteCommand
DeleteCommand --> DeleteCommandParser :
deactivate DeleteCommand

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

AddressBookParser --> LogicManager : d
deactivate AddressBookParser
ImmuniMateParser --> LogicManager : d
deactivate ImmuniMateParser

LogicManager -> DeleteCommand : execute(m)
activate DeleteCommand

DeleteCommand -> Model : deletePerson(1)
DeleteCommand -> Model : hasPerson(...)
activate Model

Model --> DeleteCommand
Model --> DeleteCommand : false
deactivate Model
DeleteCommand -> Model : deletePerson(...)
activate Model
Model --> DeleteCommand : delete specified person
deactivate Model

create CommandResult
Expand Down
Binary file added docs/images/CreateCommandLogic.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/CreateCommandModel.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/DeleteModelDiagram.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 modified docs/images/DeleteSequenceDiagram.png
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 @@ -30,7 +30,6 @@ public DeleteCommand(Nric targetNric) {
this.targetNric = targetNric;
}

//TODO test cases
@Override
public CommandResult execute(Model model) throws CommandException {
requireNonNull(model);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,4 @@ private boolean personsAreUnique(List<Person> persons) {
return true;
}
}

0 comments on commit 65cd725

Please sign in to comment.