Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Documentation for Schedule and Complete feature in DG #209

Merged
merged 2 commits into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ After the `AddressBookParser` identifies that the user's input has a schedule co

<img src="images/ScheduleClassDiagram.png" width="400"/>

The following activity diagram summarises what happens the user executes a schedule command.

<img src="images/ScheduleActivityDiagram.png" width="400"/>

**Design Considerations**

**Aspect: How to implement Appointments for Person**
Expand Down Expand Up @@ -204,7 +208,19 @@ Alternative 2: Create a hashset of Appointments for each Person.
* Harder to implement operations such as editing of an appointment for a client. An additional step of finding the specified appointment within the hashset is required, which may potentially introduce more bugs.
* Harder to implement default behaviours for when person has no appointment.

### Complete Feature

The **Complete** feature is facilitated by the `CompleteCommand` and `CompleteCommandParser`. The `CompleteCommandParser` creates a `CompleteCommand` associated with a `CompleteCommandDescriptor` which contains information on how the appointments should be completed.

The following sequence diagram illustrates how the complete operation is executed when date given.

<img src="images/CompleteSequenceDiagram.png" width="800"/>

> :warn: The lifeline of the diagram should end at the destroyer mark (X) but reaches end of diagram due to limitation of plantUML

The following activity diagram illustrates how the complete operation is executed.

<img src="images/CompleteActivityDiagram.png" width="800"/>

### Gather Emails Feature

Expand Down
40 changes: 40 additions & 0 deletions docs/diagrams/CompleteActivityDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
@startuml
skin rose
skinparam ActivityFontSize 15
skinparam ArrowFontSize 12
start
:User enters a complete command;

:CompleteCommandParser parses the user input and checks validity;


'Since the beta syntax does not support placing the condition outside the
'diamond we place it as the true branch instead.

switch ()
case([the complete command is valid])
: Creates a CompleteCommand which is executed by LogicManager;
switch ()
case ([index input by user])
: Checks for appointment of given person in FilterPersonList;
switch ()
case([if have appointment])
: Clears appointment for the Person;
case([if no appointment])
: Throws an error;
endswitch
case ([date input by user])
: Checks for persons in FilterPersonList who appointment date matches input;
switch()
case([have at least one appointment with date matching input in list])
: Clears all appointments with matching dates;
case([no appointment date matches input])
: Throws an error;
endswitch
endswitch
case([else])
: Throws an error;
endswitch
stop
@enduml

97 changes: 97 additions & 0 deletions docs/diagrams/CompleteSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
@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 ":CompleteCommandParser" as CompleteCommandParser LOGIC_COLOR
participant ":CompleteCommandDescriptor" as CompleteCommandDescriptor LOGIC_COLOR
participant "c:CompleteCommand" as CompleteCommand 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("complete d/01-01-2023")
activate LogicManager

LogicManager -> AddressBookParser : parseCommand("complete d/01-01-2023")")
activate AddressBookParser

create CompleteCommandParser
AddressBookParser -> CompleteCommandParser
activate CompleteCommandParser

CompleteCommandParser --> AddressBookParser
deactivate CompleteCommandParser

AddressBookParser -> CompleteCommandParser : parse("d/01-01-2023")
activate CompleteCommandParser

create CompleteCommandDescriptor
CompleteCommandParser -> CompleteCommandDescriptor
activate CompleteCommandDescriptor

CompleteCommandDescriptor --> CompleteCommandParser
deactivate CompleteCommandDescriptor

CompleteCommandParser -> CompleteCommandDescriptor
activate CompleteCommandDescriptor
CompleteCommandDescriptor -> CompleteCommandDescriptor : sets Date to LocalDate parsed by parser
activate CompleteCommandDescriptor
CompleteCommandDescriptor --> CompleteCommandDescriptor :
deactivate CompleteCommandDescriptor
CompleteCommandDescriptor --> CompleteCommandParser
deactivate


create CompleteCommand
CompleteCommandParser -> CompleteCommand
activate CompleteCommand

CompleteCommand --> CompleteCommandParser : c
deactivate CompleteCommand

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

AddressBookParser --> LogicManager : c
deactivate AddressBookParser

LogicManager -> CompleteCommand : execute()
activate CompleteCommand

CompleteCommand -> CompleteCommandDescriptor : getDate()
activate CompleteCommandDescriptor
CompleteCommandDescriptor --> CompleteCommand
deactivate CompleteCommandDescriptor

CompleteCommand -> Model : clear appointments by date
activate Model

Model --> CompleteCommand
deactivate Model

create CommandResult
CompleteCommand -> CommandResult
activate CommandResult

CommandResult --> CompleteCommand
deactivate CommandResult

CompleteCommand --> LogicManager : result
deactivate CompleteCommand

CompleteCommand -[hidden]-> CompleteCommandParser
destroy CompleteCommand
destroy CompleteCommandParser

[<--LogicManager
deactivate LogicManager
@enduml
22 changes: 22 additions & 0 deletions docs/diagrams/ScheduleActivityDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@startuml
skin rose
skinparam ActivityFontSize 15
skinparam ArrowFontSize 12
start
:User enters a schedule command;

:ScheduleCommandParser parses the user input and checks validity;


'Since the beta syntax does not support placing the condition outside the
'diamond we place it as the true branch instead.

switch ()
case([the schedule command is valid])
: Creates a ScheduleCommand which is executed by Logic Manager;
: Updates Person in FilterPersonList to have the scheduled appointment;
case([else])
: Throws an error;
endswitch
stop
@enduml
Binary file added docs/images/CompleteActivityDiagram.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/CompleteSequenceDiagram.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/ScheduleActivityDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.