Skip to content

Commit

Permalink
Merge pull request #105 from TrungBui32/AddComponentCommandUML
Browse files Browse the repository at this point in the history
Add AddComponentCommand UML
  • Loading branch information
TrungBui32 authored Oct 29, 2024
2 parents 242fe91 + 283144d commit 568cb96
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
Binary file added docs/diagrams/AddComponentCommand.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions docs/diagrams/AddComponentCommand.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
@startuml
!include Style.puml
group sd AddComponentCommand
participant ":AddComponentCommand" as C LOGIC_COLOR_3
participant ":AppState" as A LOGIC_COLOR_2
participant ":HashMap<String, String>" as H LOGIC_COLOR_7
participant ":CommandResult" as R LOGIC_COLOR_8

[-> C
C -> H : get("c/")
activate H
C <-- H : componentName
deactivate H
C -> H : get("w/")
activate H
C <-- H : weightageNumber
deactivate H
C -> H : get("m/")
activate H
C <-- H : maxScoreNumber
deactivate H

opt componentName or weightageNumber or maxScoreNumber is null
[<-- C : throw IllegalValueException
end

C -> C : convertWeightageToValidDouble(weightageNumber)
activate C
C --> C : weightageNumber
deactivate C

C -> C : convertMaxScoreToValidDouble(maxScore)
activate C
C --> C : maxScore
deactivate C

C -> A : addComponent(new Component(componentName, maxScore, weightage))
activate A
C <-- A
deactivate A

create R
C -> R : new CommandResult
activate R
C <-- R : CommandResult
deactivate R

[<-- C : CommandResult
end
@enduml

0 comments on commit 568cb96

Please sign in to comment.