forked from nus-cs2113-AY2425S1/tp
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #107 from TrungBui32/DeleteComponentCommandUML
Delete component command uml
- Loading branch information
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
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,46 @@ | ||
@startuml | ||
!include Style.puml | ||
group sd DeleteComponentCommand | ||
participant ":DeleteComponentCommand" as C LOGIC_COLOR_3 | ||
participant ":AppState" as A LOGIC_COLOR_2 | ||
participant ":HashMap<String, String>" as H LOGIC_COLOR_7 | ||
participant ":ComponentList" as CL LOGIC_COLOR_6 | ||
participant ":CommandResult" as R LOGIC_COLOR_8 | ||
|
||
[-> C | ||
|
||
C -> H : get("n/") | ||
activate H | ||
C <-- H : componentName | ||
deactivate H | ||
|
||
opt componentName is null | ||
[<-- C : throw IllegalValueException | ||
end | ||
|
||
C -> A : findComponent(componentName) | ||
activate A | ||
A --> C : componentsToDelete | ||
deactivate A | ||
|
||
alt componentsToDelete.size() == 0 | ||
<-- C : throw ComponentNotFoundException | ||
else componentsToDelete.size() > 1 | ||
<-- C : throw DuplicateComponentException | ||
end | ||
|
||
C -> A : deleteComponent(componentsToDelete.getComponentArrayList().get(0)) | ||
activate A | ||
C <-- A | ||
deactivate A | ||
|
||
create R | ||
C -> R : new CommandResult | ||
activate R | ||
C <-- R : CommandResult | ||
deactivate R | ||
|
||
|
||
[<-- C : CommandResult | ||
end | ||
@enduml |