Skip to content

Commit

Permalink
Merge pull request #50 from pjanthony2001/update-uml-undo
Browse files Browse the repository at this point in the history
Update UML
  • Loading branch information
Jolonauh authored Mar 22, 2024
2 parents 30e7ef4 + 64ba16c commit f1650dd
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 28 deletions.
7 changes: 4 additions & 3 deletions docs/diagrams/UndoRedoState0.puml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ skinparam ClassBackgroundColor #FFFFAA
title Initial state

package States {
class State1 as "<u>ab0:AddressBook</u>"
class State2 as "<u>ab1:AddressBook</u>"
class State3 as "<u>ab2:AddressBook</u>"
class State1 as "<u>state0:State</u>"
class State2 as "<u>state1:State</u>"
class State3 as "<u>state2:State</u>"
}

State1 -[hidden]right-> State2
State2 -[hidden]right-> State3
hide State2
Expand Down
8 changes: 4 additions & 4 deletions docs/diagrams/UndoRedoState1.puml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ skinparam ClassBackgroundColor #FFFFAA

title After command "delete 5"

package States <<rectangle>> {
class State1 as "<u>ab0:AddressBook</u>"
class State2 as "<u>ab1:AddressBook</u>"
class State3 as "<u>ab2:AddressBook</u>"
package States {
class State1 as "<u>state0:State</u>"
class State2 as "<u>state1:State</u>"
class State3 as "<u>state2:State</u>"
}

State1 -[hidden]right-> State2
Expand Down
8 changes: 4 additions & 4 deletions docs/diagrams/UndoRedoState2.puml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ skinparam ClassBackgroundColor #FFFFAA

title After command "add n/David"

package States <<rectangle>> {
class State1 as "<u>ab0:AddressBook</u>"
class State2 as "<u>ab1:AddressBook</u>"
class State3 as "<u>ab2:AddressBook</u>"
package States {
class State1 as "<u>state0:State</u>"
class State2 as "<u>state1:State</u>"
class State3 as "<u>state2:State</u>"
}

State1 -[hidden]right-> State2
Expand Down
8 changes: 4 additions & 4 deletions docs/diagrams/UndoRedoState3.puml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ skinparam ClassBackgroundColor #FFFFAA

title After command "undo"

package States <<rectangle>> {
class State1 as "<u>ab0:AddressBook</u>"
class State2 as "<u>ab1:AddressBook</u>"
class State3 as "<u>ab2:AddressBook</u>"
package States {
class State1 as "<u>state0:State</u>"
class State2 as "<u>state1:State</u>"
class State3 as "<u>state2:State</u>"
}

State1 -[hidden]right-> State2
Expand Down
8 changes: 4 additions & 4 deletions docs/diagrams/UndoRedoState4.puml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ skinparam ClassBackgroundColor #FFFFAA

title After command "list"

package States <<rectangle>> {
class State1 as "<u>ab0:AddressBook</u>"
class State2 as "<u>ab1:AddressBook</u>"
class State3 as "<u>ab2:AddressBook</u>"
package States {
class State1 as "<u>state0:State</u>"
class State2 as "<u>state1:State</u>"
class State3 as "<u>state2:State</u>"
}

State1 -[hidden]right-> State2
Expand Down
10 changes: 5 additions & 5 deletions docs/diagrams/UndoRedoState5.puml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ skinparam ClassBackgroundColor #FFFFAA

title After command "clear"

package States <<rectangle>> {
class State1 as "<u>ab0:AddressBook</u>"
class State2 as "<u>ab1:AddressBook</u>"
class State3 as "<u>ab3:AddressBook</u>"
package States {
class State1 as "<u>state0:State</u>"
class State2 as "<u>state1:State</u>"
class State3 as "<u>state3:State</u>"
}

State1 -[hidden]right-> State2
Expand All @@ -18,5 +18,5 @@ State2 -[hidden]right-> State3
class Pointer as "Current State" #FFFFFF

Pointer -up-> State3
note right on link: State ab2 deleted.
note right on link: State state2 deleted.
@end
12 changes: 11 additions & 1 deletion docs/diagrams/UndoSequenceDiagram-Logic.puml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,19 @@ deactivate AddressBookParser
LogicManager -> UndoCommand : execute()
activate UndoCommand

UndoCommand -> Model : undoAddressBook()
UndoCommand -> Model : rollBackHistory()
activate Model
Model --> UndoCommand
deactivate Model

UndoCommand -> Model : getCurrState()
activate Model
Model --> UndoCommand : state
deactivate Model


UndoCommand -> Model : restoreState(state)
activate Model
Model --> UndoCommand
deactivate Model

Expand Down
6 changes: 3 additions & 3 deletions docs/diagrams/UndoSequenceDiagram-Model.puml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ skinparam ArrowFontStyle plain

box Model MODEL_COLOR_T1
participant ":Model" as Model MODEL_COLOR
participant ":VersionedAddressBook" as VersionedAddressBook MODEL_COLOR
participant ":History" as VersionedAddressBook MODEL_COLOR
end box

[-> Model : undoAddressBook()
[-> Model : rollBackHistory()
activate Model

Model -> VersionedAddressBook : undo()
Model -> VersionedAddressBook : rollBack()
activate VersionedAddressBook

VersionedAddressBook -> VersionedAddressBook :resetData(ReadOnlyAddressBook)
Expand Down

0 comments on commit f1650dd

Please sign in to comment.