Skip to content

Commit

Permalink
Merge pull request #106 from KrashKart/branch-edit-uml
Browse files Browse the repository at this point in the history
Update UML diagrams in DG
  • Loading branch information
yooplo authored Oct 20, 2024
2 parents 204df07 + b4b70c3 commit 85cbcaf
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 18 deletions.
9 changes: 9 additions & 0 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,15 @@ How the parsing works:
* When called upon to parse a user command, the `CampusConnectParser` class creates an `XYZCommandParser` (`XYZ` is a placeholder for the specific command name e.g., `AddCommandParser`) which uses the other classes shown above to parse the user command and create a `XYZCommand` object (e.g., `AddCommand`) which the `CampusConnectParser` returns back as a `Command` object.
* All `XYZCommandParser` classes (e.g., `AddCommandParser`, `DeleteCommandParser`, ...) inherit from the `Parser` interface so that they can be treated similarly where possible e.g, during testing.

Finally, here are the command classes in `Logic` used to represent the different types of commands:

<puml src="diagrams/CommandClasses.puml" width="600"/>

A few notes here:
* Since there are many types of Find Command classes with similar functionality, they all extend an abstract parent class `AbstractFindCommand`, used to contain most of the common methods.
* Each `Command` class contains the respective `COMMAND_WORD` representing the name of the command and a `MESSAGE_USAGE` string to demonstrate how to use the respective command.
* Additionally, each Find Command class (`FindByNameCommand`, `FindByEmailCommand`, `FindByTagCommand` and `FindByPhoneCommand`) contains a respective `COMMAND_WORD` ("`n/`", "`e/`", "`t/`" and "`p/`" respectively) on top of the shared command word "`find`" to be used.

### Model component
**API** : [`Model.java`](https://github.com/se-edu/CampusConnect/tree/master/src/main/java/seedu/address/model/Model.java)

Expand Down
7 changes: 3 additions & 4 deletions docs/diagrams/BetterModelClassDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ UniquePersonList -right-> Person

Person -up-> "*" Tag

Person *--> Name
Person *--> Phone
Person *--> Email
Person *--> Address
Person *--> "1" Name
Person *--> "1" Phone
Person *--> "1" Email
@enduml
61 changes: 61 additions & 0 deletions docs/diagrams/CommandClasses.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
@startuml
!include style.puml
skinparam arrowThickness 1.1
skinparam arrowColor LOGIC_COLOR_T4
skinparam classBackgroundColor LOGIC_COLOR

Class "{abstract}\nCommand" as Command
Class HiddenOutside #FFFFFF

package "Command Classes" as CommandClasses {
together {
Class "{abstract}\nAbstractFindCommand" as AFC
Class "AddCommand" as AC
Class "ClearCommand" as CC
Class "DeleteCommand" as DC
Class "EditCommand" as EdC
Class "ExitCommand" as ExC
Class "FindByEmailCommand" as FEC
Class "FindByNameCommand" as FNC
Class "FindByTagCommand" as FTC
Class "FindByPhoneCommand" as FPC
Class "HelpCommand" as HC
Class "ListCommand" as LC
}
}
HiddenOutside ..> Command

AFC -u-|> Command
AFC -[hidden]right- AC
FEC -u-|> AFC
FNC -u-|> AFC
FTC -u-|> AFC
FPC -u-|> AFC

AC -u-|> Command
AC -[hidden]right- CC
FEC -[hidden]u- AC

CC -u-|> Command
CC -[hidden]right- DC
FEC -[hidden]u- CC

DC -u-|> Command
DC -[hidden]right- EdC
FEC -[hidden]u- DC

EdC -u-|> Command
EdC -[hidden]right- ExC
FEC -[hidden]u- EdC

ExC -u-|> Command
ExC -[hidden]right- HC
FEC -[hidden]u- ExC

HC -u-|> Command
HC -[hidden]right- LC
FEC -[hidden]u- HC

LC -u-|> Command
FEC -[hidden]u- LC
@enduml
8 changes: 4 additions & 4 deletions docs/diagrams/LogicClassDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ package Logic as LogicPackage {

package "Parser Classes" as ParserClasses{
}
Class XYZCommand
package "Command Classes" as CommandClasses{
}
Class CommandResult
Class "{abstract}\nCommand" as Command

Expand All @@ -29,17 +30,16 @@ HiddenOutside ..> Logic

LogicManager .right.|> Logic
LogicManager -right->"1" ParserClasses
ParserClasses ..> XYZCommand : <<create>>
ParserClasses ..> CommandClasses : <<create>>

XYZCommand -up-|> Command
CommandClasses -up-|> Command
LogicManager .left.> Command : <<call>>

LogicManager --> Model
LogicManager --> Storage
Storage --[hidden] Model
Command .[hidden]up.> Storage
Command .right.> Model
note right of XYZCommand: XYZCommand = AddCommand, \nFindCommand, etc

Logic ..> CommandResult
LogicManager .down.> CommandResult
Expand Down
11 changes: 4 additions & 7 deletions docs/diagrams/ModelClassDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ Class UserPrefs

Class UniquePersonList
Class Person
Class Address
Class Email
Class Name
Class Phone
Expand All @@ -37,18 +36,16 @@ UserPrefs .up.|> ReadOnlyUserPrefs

CampusConnect *--> "1" UniquePersonList
UniquePersonList --> "~* all" Person
Person *--> Name
Person *--> Phone
Person *--> Email
Person *--> Address
Person *--> "1" Name
Person *--> "1" Phone
Person *--> "1" Email
Person *--> "*" Tag

Person -[hidden]up--> I
UniquePersonList -[hidden]right-> I

Name -[hidden]right-> Phone
Phone -[hidden]right-> Address
Address -[hidden]right-> Email
Phone -[hidden]right-> Email

ModelManager --> "~* filtered" Person
@enduml
7 changes: 4 additions & 3 deletions docs/diagrams/ParserClasses.puml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ skinparam arrowColor LOGIC_COLOR_T4
skinparam classBackgroundColor LOGIC_COLOR

Class "{abstract}\nCommand" as Command
Class XYZCommand
package "Command Classes" as CommandClasses {
}

package "Parser classes"{
Class "<<interface>>\nParser" as Parser
Expand All @@ -23,7 +24,7 @@ HiddenOutside ..> CampusConnectParser

CampusConnectParser .down.> XYZCommandParser: <<create>>

XYZCommandParser ..> XYZCommand : <<create>>
XYZCommandParser ..> CommandClasses : <<create>>
CampusConnectParser ..> Command : <<use>>
XYZCommandParser .up.|> Parser
XYZCommandParser ..> ArgumentMultimap
Expand All @@ -34,5 +35,5 @@ CliSyntax ..> Prefix
XYZCommandParser ..> ParserUtil
ParserUtil .down.> Prefix
ArgumentTokenizer .down.> Prefix
XYZCommand -up-|> Command
CommandClasses -up-|> Command
@enduml

0 comments on commit 85cbcaf

Please sign in to comment.