Skip to content

Commit

Permalink
Merge pull request #168 from emilysim00/dg-for-schedule-features
Browse files Browse the repository at this point in the history
Update DG for schedule features documentation
  • Loading branch information
emilysim00 authored Mar 30, 2022
2 parents 91c7f9d + 6f142e1 commit 9c5bd3b
Show file tree
Hide file tree
Showing 11 changed files with 603 additions and 13 deletions.
324 changes: 311 additions & 13 deletions docs/DeveloperGuide.md

Large diffs are not rendered by default.

53 changes: 53 additions & 0 deletions docs/uml/sequenceDiagrams/clearAllSchedule.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
@startuml
'https://plantuml.com/sequence-diagram
!include ../Style.puml

autonumber

title Sequence Diagram of `schedule /clear` Command

actor User
participant "werkIt:WerkIt" AS WerkIt
participant "ui:UI" AS UI
participant "parser:Parser" AS Parser
participant "newCommand\n:ScheduleCommand" AS newCommand
participant "dayList\n:DayList" AS DayList


activate WerkIt
WerkIt -> UI : getUserInput()
activate UI
User -> UI : `schedule /clear` command
WerkIt <-- UI : userInputTrimmed:String
deactivate UI

WerkIt -> Parser : parseUserInput(userInput)
activate Parser
WerkIt <-- Parser : :Command
deactivate Parser

WerkIt -> newCommand : execute()
activate newCommand

newCommand -> DayList : clearAllSchedule()
activate DayList
deactivate DayList

newCommand -> UI : printClearedScheduleMessage();
activate UI
UI --> User: Display a message to indicate the process is completed
deactivate UI

participant "fileManager:FileManager" as FileManager
newCommand -> FileManager : rewriteAllDaysScheduleToFile(newDay)
activate FileManager
ref over FileManager
Write the plans scheduled
for the week into 'schedule.txt'
file on user's system.
end
newCommand <-- FileManager
deactivate FileManager

destroy newCommand
@enduml
63 changes: 63 additions & 0 deletions docs/uml/sequenceDiagrams/clearSchedule.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
@startuml
'https://plantuml.com/sequence-diagram
!include ../Style.puml

autonumber

title Sequence Diagram of `schedule /clear` Command

actor User
participant "werkIt:WerkIt" AS WerkIt
participant "ui:UI" AS UI1
participant "parser:Parser" AS Parser
participant "newCommand\n:ScheduleCommand" AS newCommand
participant "dayList\n:DayList" AS DayList


activate WerkIt
WerkIt -> UI1 : getUserInput()
activate UI1
User -> UI1 : `schedule /clear` command
WerkIt <-- UI1 : userInputTrimmed:String
deactivate UI1

WerkIt -> Parser : parseUserInput(userInput)
activate Parser
WerkIt <-- Parser : :Command
deactivate Parser

WerkIt -> newCommand : execute()
activate newCommand

newCommand -> DayList : clearDayPlan(userArgument)
activate DayList
create "Integer" AS int
DayList -> int: parseInt(userArgument)
DayList <-- int : dayNumber:Integer

create InvalidScheduleException AS ise
opt !isDayValid
DayList -> ise : throw new InvalidScheduleException
activate ise
return
deactivate ise
end
DayList -> DayList : covertDayNumberToDay(dayNumber)
activate DayList
return day:String
DayList --> User : Display plan clear success message
deactivate DayList

participant "fileManager:FileManager" as FileManager
newCommand -> FileManager : rewriteAllDaysScheduleToFile(newDay)
activate FileManager
ref over FileManager
Write the plans scheduled
for the week into 'schedule.txt'
file on user's system.
end
newCommand <-- FileManager
deactivate FileManager

destroy newCommand
@enduml
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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/uml/sequenceDiagrams/images/listSchedule.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 60 additions & 0 deletions docs/uml/sequenceDiagrams/updateSchedule.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
@startuml
'https://plantuml.com/sequence-diagram
!include ../Style.puml

autonumber

title Sequence Diagram of `schedule /update` Command

actor User
participant "werkIt:WerkIt" AS WerkIt
participant "ui:UI" AS UI1
participant "parser:Parser" AS Parser
participant "newCommand\n:ScheduleCommand" AS newCommand
participant "dayList\n:DayList" AS DayList
participant "ui:UI" AS UI2
participant "fileManager:FileManager" as FileManager

activate WerkIt
WerkIt -> UI1 : getUserInput()
activate UI1
User -> UI1 : `schedule /update` command
WerkIt <-- UI1 : userInputTrimmed:String
deactivate UI1

WerkIt -> Parser : parseUserInput(userInput)
activate Parser
WerkIt <-- Parser : :Command
deactivate Parser

WerkIt -> newCommand : execute()
activate newCommand
newCommand -> DayList : updateDay(userArgument)
activate DayList
ref over DayList
Add/update a
plan for a Day.
end
newCommand <-- DayList : "newDay:Day"
deactivate DayList

newCommand -> UI2 : printNewScheduleCreatedMessage(newDay)
activate UI2
User <-- UI2 : Plan successfully added/updated message
deactivate UI2

newCommand -> FileManager : rewriteAllDaysScheduleToFile(newDay)
activate FileManager
ref over FileManager
Write the plans scheduled
for the week into 'schedule.txt'
file on user's system.
end
newCommand <-- FileManager
deactivate FileManager

WerkIt <-- newCommand
deactivate newCommand

destroy newCommand
@enduml
72 changes: 72 additions & 0 deletions docs/uml/sequenceDiagrams/updateScheduleDetails.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
@startuml
'https://plantuml.com/sequence-diagram
!include ../Style.puml

autonumber 7.1

participant "dayList\n:DayList" AS DayList
participant ":String" AS string


activate DayList

group sd Add/update a plan for a Day.


DayList -> string : userArgument.split(" ")
activate string
return userArgumentArray:String[]


opt userArgumentArray. length > 2
create ":ArrayOutOfBoundException" AS iee
DayList -> iee : throw new ArrayOutOfBoundException
activate iee
return
deactivate iee
end
create "Integer" AS int
DayList -> int: parseInt(userArgument[0])
return dayNumber:Int
DayList -> int: parseInt(userArgument[1])
return planNumber:Int

opt !isDayValid
create ":InvalidScheduleException" AS ise
DayList -> ise : throw new InvalidScheduleException
activate ise
return
deactivate ise
end

opt !isPlanValid
DayList -> ise : throw new InvalidScheduleException
activate ise
return
deactivate ise
end

participant "planList\n:PlanList" AS PlanList
DayList -> PlanList : getPlanDisplayList().get(planNumber - 1)
activate PlanList
return planToAddKey:String

DayList -> PlanList : getPlanFromKey(planToAddKey)
activate PlanList
return planToAdd:Plan

create "Day" AS newDay
alt scheduleList[dayNumber - 1] == null
DayList -> newDay : new Day(dayNumber, planToAdd)
activate newDay
return newDay:Day
else
DayList -> newDay :setNewPlanForThisDay(newDay, planToAdd)
activate newDay
return
deactivate newDay
end
end


@enduml
44 changes: 44 additions & 0 deletions docs/uml/sequenceDiagrams/viewSchedule.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
@startuml
'https://plantuml.com/sequence-diagram
!include ../Style.puml

autonumber

title Sequence Diagram of `schedule /list` Command

actor User
participant "werkIt:WerkIt" AS WerkIt
participant "ui:UI" AS UI1
participant "parser:Parser" AS Parser
participant "newCommand\n:ScheduleCommand" AS newCommand
participant "dayList\n:DayList" AS DayList


activate WerkIt
WerkIt -> UI1 : getUserInput()
activate UI1
User -> UI1 : `schedule /list` command
WerkIt <-- UI1 : userInputTrimmed:String
deactivate UI1

WerkIt -> Parser : parseUserInput(userInput)
activate Parser
WerkIt <-- Parser : :Command
deactivate Parser

WerkIt -> newCommand : execute()
activate newCommand

newCommand -> DayList : printSchedule()
activate DayList
loop 7 times

DayList -> DayList : padWithSpaces(planForDay)
activate DayList
return planForDayWithPadding:string

end
User <-- DayList : Display plans scheduled for the week
return
destroy newCommand
@enduml

0 comments on commit 9c5bd3b

Please sign in to comment.