Skip to content

Commit

Permalink
Merge pull request #337 from Bandov/DG-V2.0
Browse files Browse the repository at this point in the history
Dg v2.0
  • Loading branch information
Bandov authored Apr 14, 2024
2 parents a11ff7e + ad99b44 commit e96a08f
Show file tree
Hide file tree
Showing 22 changed files with 97 additions and 7 deletions.
12 changes: 7 additions & 5 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ The *Sequence Diagram* below shows how the components interact with each other f
Each of the four main components (also shown in the diagram above),

* defines its *API* in an `interface` with the same name as the Component.
* implements its functionality using a concrete `{Component Name}Manager` class (which follows the corresponding API `interface` mentioned in the previous point.
* implements its functionality using a concrete `{Component Name}Manager` class which follows the corresponding API `interface` mentioned in the previous point.

For example, the `Logic` component defines its API in the `Logic.java` interface and implements its functionality using the `LogicManager.java` class which follows the `Logic` interface. Other components interact with a given component through its interface rather than the concrete class (reason: to prevent outside component's being coupled to the implementation of a component), as illustrated in the (partial) class diagram below.

Expand Down Expand Up @@ -197,7 +197,7 @@ The `Person` component,
* The `Person` component,
* stores the Unique User ID or UUID of the person
* stores any number of `Attribute` objects in the `Person` object in the hash map
* does not require to have any `Attribute` objects
* is not required to have any `Attribute` objects
* The `Unique User ID` component,
* acts as the unique identifier for a person
* the UUID is generated by the system and is unique for each person
Expand All @@ -208,19 +208,21 @@ The `Person` component,

<img src="images/AttributeClassDiagram.png" width="550" />

**Attribute** is an abstract class that represents a detail about a `Person`. All other attribute classes extend from this class.

* The `Attribute` component,
* is used to store details about a `Person`
* each attribute has a `name` and a `value`
* stored `Attribute` objects in the `Person` object in the hash map
* stores `Attribute` objects in the `Person` object in the hash map
* Has general types of attributes (`StringAttribute`, `IntegerAttribute`, `DateAttribute`)
* `StringAttribute` - stores a string value
* `IntegerAttribute` - stores an integer value
* `DateAttribute` - stores a date value
* Users are able to create their own attributes using the `StringAttribute` class
* They will have their own `String` name and `String` value
* Has specific types of attributes (e.g. `NameAttribute`, `PhoneNumberAttribute`) with unique constraints relevant to their validity
* `NameAttribute` - stores the name of the person
* `PhoneNumberAttribute` - stores the phone number of the person and must be an integer of less than 10 digits
* `NameAttribute` extends the `StringAttribute`- stores the name of the person
* `PhoneNumberAttribute` extends the `IntegerAttribute` - stores the phone number of the person and must be an integer of less than 10 digits
* `GenderAttribute` - stores the gender of the person and must be either `Male` or `Female`
* does not depend on the other components (as the `Attribute` are standalone stores of details about the `Person`)
#### Model component - Relationship
Expand Down
8 changes: 8 additions & 0 deletions docs/diagrams/AddPersonSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@
!include style.puml
skinparam ArrowFontStyle plain

box Logic LOGIC_COLOR_T1
Actor User as user USER_COLOR
Participant ":UI" as ui UI_COLOR
Participant ":Logic" as logic LOGIC_COLOR
end box

box model MODEL_COLOR_T1
Participant ":Model" as model MODEL_COLOR
Participant ":Person" as person PERSON_COLOR
Participant ":Attribute" as attribute ATTRIBUTE_COLOR
Participant ":Storage" as storage STORAGE_COLOR
end box

user -[USER_COLOR]> ui : "add /Name Bob"
activate ui UI_COLOR
Expand All @@ -29,6 +34,7 @@ activate person PERSON_COLOR

person --[PERSON_COLOR]> logic : return new Person
deactivate person
person --[Hidden]> person : model
destroy person

logic -[LOGIC_COLOR]> model : addPerson(personToAdd)
Expand All @@ -47,8 +53,10 @@ deactivate storage STORAGE_COLOR_T1

storage --[STORAGE_COLOR]> logic : save complete
deactivate storage
storage --[Hidden]> storage : model
destroy storage


logic --[LOGIC_COLOR]> ui : CommandResult("New person added. Details: Name: Bob")
deactivate logic

Expand Down
8 changes: 8 additions & 0 deletions docs/diagrams/ArchitectureSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,19 @@
!include style.puml
skinparam ArrowFontStyle plain

box Logic LOGIC_COLOR_T1
Actor User as user USER_COLOR
Participant ":UI" as ui UI_COLOR
Participant ":Logic" as logic LOGIC_COLOR
end box

box model MODEL_COLOR_T1
Participant ":Model" as model MODEL_COLOR
end box

box storage STORAGE_COLOR_T1
Participant ":Storage" as storage STORAGE_COLOR
end box

user -[USER_COLOR]> ui : "delete 0000"
activate ui UI_COLOR
Expand Down
10 changes: 10 additions & 0 deletions docs/diagrams/AttributeAdditionSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@
!include style.puml
skinparam ArrowFontStyle plain

box Logic LOGIC_COLOR_T1
Actor User as user USER_COLOR
Participant ":UI" as ui UI_COLOR
Participant ":Logic" as logic LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
Participant ":Model" as model MODEL_COLOR
Participant ":Attribute" as attribute ATTRIBUTE_COLOR
end box

box Storage STORAGE_COLOR_T1
Participant ":Storage" as storage STORAGE_COLOR
end box

user -[USER_COLOR]> ui : "addAttribute /1234 /name value"
activate ui UI_COLOR
Expand All @@ -26,6 +34,7 @@ activate attribute ATTRIBUTE_COLOR

attribute --[ATTRIBUTE_COLOR]> logic : return attribute
deactivate attribute
attribute --[HIDDEN]> attribute : model
destroy attribute

logic -[LOGIC_COLOR]> model : person.addAttribute(attribute)
Expand All @@ -44,6 +53,7 @@ deactivate storage STORAGE_COLOR_T1

storage --[STORAGE_COLOR]> logic : save complete
deactivate storage
storage --[HIDDEN]> storage : model
destroy storage

logic --[LOGIC_COLOR]> ui : CommandResult("Attribute added successfully.")
Expand Down
8 changes: 8 additions & 0 deletions docs/diagrams/AttributeDeletionSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,19 @@
!include style.puml
skinparam ArrowFontStyle plain

box Logic LOGIC_COLOR_T1
Actor User as user USER_COLOR
Participant ":UI" as ui UI_COLOR
Participant ":Logic" as logic LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
Participant ":Model" as model MODEL_COLOR
end box

box Storage STORAGE_COLOR_T1
Participant ":Storage" as storage STORAGE_COLOR
end box

user -[USER_COLOR]> ui : "deleteAttribute \uuid 1234 \\name"
activate ui UI_COLOR
Expand Down
10 changes: 10 additions & 0 deletions docs/diagrams/AttributeEditSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@
!include style.puml
skinparam ArrowFontStyle plain

box Logic LOGIC_COLOR_T1
Actor User as user USER_COLOR
Participant ":UI" as ui UI_COLOR
Participant ":Logic" as logic LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
Participant ":Model" as model MODEL_COLOR
Participant ":Attribute" as attribute ATTRIBUTE_COLOR
end box

box Storage STORAGE_COLOR_T1
Participant ":Storage" as storage STORAGE_COLOR
end box

user -[USER_COLOR]> ui : "editAttribute /uuid 1234 /name newValue"
activate ui UI_COLOR
Expand All @@ -32,6 +40,7 @@ activate attribute ATTRIBUTE_COLOR

attribute --[ATTRIBUTE_COLOR]> logic : return edited attribute
deactivate attribute
attribute --[HIDDEN]> attribute : model
destroy attribute

logic -[LOGIC_COLOR]> model : person.updateAttribute(editedAttribute)
Expand All @@ -50,6 +59,7 @@ deactivate storage STORAGE_COLOR_T1

storage --[STORAGE_COLOR]> logic : save complete
deactivate storage
storage --[HIDDEN]> storage : model
destroy storage

logic --[LOGIC_COLOR]> ui : CommandResult("Attribute edited successfully.")
Expand Down
8 changes: 8 additions & 0 deletions docs/diagrams/ClearSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@
skinparam ArrowFontStyle plain
!define CLEARCOMMAND_COLOR #FF7700

box Logic LOGIC_COLOR_T1
actor User as user USER_COLOR
participant ":UI" as ui UI_COLOR
participant ":LogicManager" as logic LOGIC_COLOR
participant ":ClearCommand" as clearCommand CLEARCOMMAND_COLOR
end box

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

user -> ui : deleteallpersons
activate ui
Expand All @@ -27,14 +32,17 @@ clearCommand -> model : resetRelationshipDescriptors()
activate model
model --> clearCommand : relationships reset
deactivate model
model --[HIDDEN]> clearCommand
destroy model

clearCommand --> logic : CommandResult("Address book has been cleared!")
deactivate clearCommand
clearCommand --[hidden]> logic
destroy clearCommand

logic --> ui : display "Address book has been cleared!"
deactivate logic
logic --[hidden]> ui
destroy logic

ui --> user : show "Address book has been cleared!"
Expand Down
8 changes: 7 additions & 1 deletion docs/diagrams/ClearTerminalSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ skinparam ArrowFontStyle plain
!define DIALOG_CONTAINER_COLOR #FF8F00
!define IMAGE_CONTAINER_COLOR #F57F17
!define SCROLLPANE_COLOR #E65100
!define CLIINPUT_COLOR #BF360C
!define CLIINPUT_COLOR #FF6F00

box ui GUI_CONTROLLER_COLOR
actor User as user USER_COLOR
participant "GUI Controller" as controller GUI_CONTROLLER_COLOR
participant "CommandSectionDialogContainer" as dialogContainer DIALOG_CONTAINER_COLOR
participant "CommandBoxImageContainer" as imageContainer IMAGE_CONTAINER_COLOR
participant "CommandSectionDialogScrollPane" as scrollPane SCROLLPANE_COLOR
participant "CLIInput" as cliInput CLIINPUT_COLOR
end box

user -> controller : input("c" or "clear")
activate controller
Expand All @@ -21,6 +23,7 @@ controller -> dialogContainer : getChildren().clear()
activate dialogContainer
dialogContainer --> controller
deactivate dialogContainer
dialogContainer --[hidden]> controller :
destroy dialogContainer

controller -> imageContainer : setVisible(false)
Expand All @@ -32,12 +35,14 @@ controller -> imageContainer : setManaged(false)
activate imageContainer
imageContainer --> controller
deactivate imageContainer
imageContainer --[hidden]> controller :
destroy imageContainer

controller -> scrollPane : getHeight()
activate scrollPane
scrollPane --> controller : return height
deactivate scrollPane
scrollPane --[hidden]> controller :
destroy scrollPane

alt if height <= 150
Expand All @@ -50,6 +55,7 @@ controller -> cliInput : setText("")
activate cliInput
cliInput --> controller : input cleared
deactivate cliInput
cliInput --[hidden]> controller :
destroy cliInput

controller --> user : clear complete
Expand Down
10 changes: 10 additions & 0 deletions docs/diagrams/DeleteAttributeSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@
!include style.puml
skinparam ArrowFontStyle plain

box logic LOGIC_COLOR_T1
Actor User as user USER_COLOR
Participant ":UI" as ui UI_COLOR
Participant ":Logic" as logic LOGIC_COLOR
end box

box model MODEL_COLOR_T1
Participant ":Model" as model MODEL_COLOR
Participant ":Person" as person PERSON_COLOR
end box

box storage STORAGE_COLOR_T1
Participant ":Storage" as storage STORAGE_COLOR
end box

user -[USER_COLOR]> ui : "deleteattribute /uuid 1234 /name1 /name2"
activate ui UI_COLOR
Expand All @@ -33,6 +41,7 @@ loop for each attribute
person --[PERSON_COLOR]> logic : attribute deleted
deactivate person
end
destroy person

logic -[LOGIC_COLOR]> storage : saveAddressBook(addressBook)
activate storage STORAGE_COLOR
Expand All @@ -44,6 +53,7 @@ deactivate storage STORAGE_COLOR_T1

storage --[STORAGE_COLOR]> logic : save complete
deactivate storage
storage --[HIDDEN]> storage :
destroy storage

logic --[LOGIC_COLOR]> ui : CommandResult("Attributes deleted successfully.")
Expand Down
14 changes: 14 additions & 0 deletions docs/diagrams/DeletePersonSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,19 @@
!include style.puml
skinparam ArrowFontStyle plain

box logic LOGIC_COLOR_T1
Actor User as user USER_COLOR
Participant ":UI" as ui UI_COLOR
Participant ":Logic" as logic LOGIC_COLOR
end box

box model MODEL_COLOR_T1
Participant ":Model" as model MODEL_COLOR
end box

box storage STORAGE_COLOR_T1
Participant ":Storage" as storage STORAGE_COLOR
end box

user -[USER_COLOR]> ui : "delete /0001"
activate ui UI_COLOR
Expand All @@ -27,7 +35,13 @@ model --[MODEL_COLOR]> logic : return matching Person
deactivate model

logic -[LOGIC_COLOR]> model : deletePerson(personToDelete)
activate model MODEL_COLOR
model --[MODEL_COLOR]> logic :
deactivate model
logic -[LOGIC_COLOR]> model : deleteRelationshipsOfPerson(targetUuid)
activate model MODEL_COLOR
model --[MODEL_COLOR]> logic :
deactivate model

logic -[LOGIC_COLOR]> storage : saveAddressBook(addressBook)
activate storage STORAGE_COLOR
Expand Down
8 changes: 7 additions & 1 deletion docs/diagrams/FindSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,18 @@ skinparam ArrowFontStyle plain
!define ABPARSER_COLOR #A9DCDF
!define PREDICATE_COLOR #FAA1A1

box Logic LOGIC_COLOR_T1
Actor User as user USER_COLOR
Participant ":UI" as ui UI_COLOR
Participant ":LogicManager" as logic LOGIC_COLOR
Participant ":AddressBookParser" as parser ABPARSER_COLOR
Participant ":FindCommand" as findCommand FINDCOMMAND_COLOR
end box

box Model MODEL_COLOR_T1
Participant ":NameContainsKeywordsPredicate" as predicate PREDICATE_COLOR
Participant ":Model" as model MODEL_COLOR
end box

user -[USER_COLOR]> ui : enter "find /alice /bob"
activate ui UI_COLOR
Expand All @@ -31,13 +36,13 @@ activate parser ABPARSER_COLOR
parser -[ABPARSER_COLOR]> findCommand : new FindCommand(keywords)
activate findCommand FINDCOMMAND_COLOR
deactivate parser
destroy parser

findCommand -[FINDCOMMAND_COLOR]> predicate : new NameContainsKeywordsPredicate(keywords)
activate predicate PREDICATE_COLOR

predicate -[PREDICATE_COLOR]> findCommand : predicate
deactivate predicate
predicate --[HIDDEN]> findCommand :
destroy predicate

findCommand -[FINDCOMMAND_COLOR]> model : updateFilteredPersonList(predicate)
Expand All @@ -48,6 +53,7 @@ deactivate model

findCommand -[FINDCOMMAND_COLOR]> logic : CommandResult("X persons found")
deactivate findCommand
findCommand --[HIDDEN]> :
destroy findCommand

logic -[LOGIC_COLOR]> ui : display "X persons found"
Expand Down
Binary file removed docs/diagrams/PersonClassDiagram.png
Binary file not shown.
Binary file modified docs/images/AddPersonSequenceDiagram.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/ArchitectureSequenceDiagram.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/AttributeAdditionSequenceDiagram.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/AttributeDeletionSequenceDiagram.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/AttributeEditSequenceDiagram.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/ClearSequenceDiagram.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/ClearTerminalSequenceDiagram.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/DeleteAttributeSequenceDiagram.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/DeletePersonSequenceDiagram.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/FindSequenceDiagram.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 e96a08f

Please sign in to comment.