Skip to content

Commit

Permalink
Merge pull request #102 from ReganChoy/branch-DG_v1.3
Browse files Browse the repository at this point in the history
Update DG for LastMet
  • Loading branch information
getsquared authored Mar 28, 2024
2 parents c12467f + c8bff32 commit e055696
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 0 deletions.
25 changes: 25 additions & 0 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,31 @@ Classes used by multiple components are in the `seedu.addressbook.commons` packa

This section describes some noteworthy details on how certain features are implemented.

### Updating last met feature
The last met feature allows users to keep track and update their last interaction with their clients.

#### Implementation

The updating of last met command is facilitated by the `LastMetCommandParser` class which is created by the `AddressBookParser`.

The `LastMetCommandParser#parse()` overrides `Parser#parse()` in the `Parser` interface.
- `LastMetCommandParser#parse()` - Parses the input arguments by storing the prefixes of it respective values in a `ArgumentMultimap` object.
- It will then convert the String input into a Date object before creating a new `LastMetCommand` object with the formatted date.

The `LastMetCommand` object is then executed by the `Logic` component.

The `LastMetCommand` object then communicates with the `Model` component to update the LastMet to the client. The `Model` component then updates the `Person` object with the new LastMet.
- `Model#setPerson(Person, Person)` - Sets the client in the existing client list to the new `Person` object which has been edited by the `LastMetCommand#execute()` which contains the new LastMet.
- `Model#setDisplayClient(Person)` - Updates the displayed client in the UI to the client that has been edited with the new LastMet.

The method `LastMetCommand#execute()` returns a CommandResult object which contains the success message to be displayed to the user.

The following object diagram illustrates the above:
<puml src="diagrams/LastMetObjectDiagram.puml" width="600" />

The following sequence diagram shows the lastmet operation:
<puml src="diagrams/LastMetSequenceDiagram.puml" width="900" />

### Add policy feature
The add policy feature allows users to add a policy to a client. The policy is stored in the `Policy` class, which contains the policy details such as policy name, policy id. The `Policy` class is then added to the `PolicyList` object stored within the `Person` object in the `Model` component.

Expand Down
26 changes: 26 additions & 0 deletions docs/diagrams/LastMetObjectDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@startuml
!include style.puml
skinparam objectFontColor white

object "<u>:LastMetCommand</u>" as LastMetCommand LOGIC_COLOR
object "<u>:LastMetCommandParser</u>" as LastMetCommandParser LOGIC_COLOR
object "<u>:AddressBookParser</u>" as AddressBookParser LOGIC_COLOR
object "<u>:Model</u>" as Model MODEL_COLOR
object "<u>:CommandResult</u>" as CommandResult LOGIC_COLOR
object "<u>metPerson:Person" as Person1 LOGIC_COLOR
object "<u>personToMeet:Person" as Person2 LOGIC_COLOR
object "<u>:ArgumentMultimap" as ArgumentMultimap LOGIC_COLOR
object "<u>:ParserUtil" as ParserUtil LOGIC_COLOR

AddressBookParser --> LastMetCommandParser : calls
AddressBookParser --> LastMetCommand
LastMetCommandParser -> LastMetCommand
LastMetCommandParser --> ArgumentMultimap : instantiates
ParserUtil --> ArgumentMultimap : parses
LastMetCommand --> Person1
LastMetCommand --> Person2
LastMetCommand --> Model
LastMetCommand -right-> CommandResult : outputs
Model --> Person2 : Removes
Model --> Person1 : Updates
@enduml
60 changes: 60 additions & 0 deletions docs/diagrams/LastMetSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
@startuml
!include style.puml
skinparam ArrowFontStyle plain

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR
participant "a:LastMetCommand" as LastMetCommand LOGIC_COLOR
participant ":CommandResult" as CommandResult LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
participant ":Model" as Model MODEL_COLOR
end box
[-> LogicManager : execute("met 1 d/2024-03-04")
activate LogicManager

LogicManager -> AddressBookParser : parseCommand("met 1 d/2024-03-04")
activate AddressBookParser

create LastMetCommand
AddressBookParser -> LastMetCommand : LastMetCommand(1, newLastMet)
activate LastMetCommand

LastMetCommand --> AddressBookParser
deactivate LastMetCommand

AddressBookParser --> LogicManager : a
deactivate AddressBookParser

LogicManager -> LastMetCommand : execute()
activate LastMetCommand

LastMetCommand -> Model : setPerson(personToMeet, metPerson)
activate Model

Model --> LastMetCommand
deactivate Model

LastMetCommand -> Model : setDisplayClient(metPerson)
activate Model

Model --> LastMetCommand
deactivate Model

create CommandResult
LastMetCommand --> CommandResult
activate CommandResult

CommandResult --> LastMetCommand
deactivate CommandResult

LastMetCommand --> LogicManager : result
deactivate LastMetCommand
LastMetCommand -[hidden]-> LogicManager : result
destroy LastMetCommand

[<--LogicManager
deactivate LogicManager
@enduml

0 comments on commit e055696

Please sign in to comment.