diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index 14afada2618..7ff640c346a 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -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: + + + +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) diff --git a/docs/diagrams/BetterModelClassDiagram.puml b/docs/diagrams/BetterModelClassDiagram.puml index eb630665c94..7a3978c03d0 100644 --- a/docs/diagrams/BetterModelClassDiagram.puml +++ b/docs/diagrams/BetterModelClassDiagram.puml @@ -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 diff --git a/docs/diagrams/CommandClasses.puml b/docs/diagrams/CommandClasses.puml new file mode 100644 index 00000000000..eb4815c67e6 --- /dev/null +++ b/docs/diagrams/CommandClasses.puml @@ -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 diff --git a/docs/diagrams/LogicClassDiagram.puml b/docs/diagrams/LogicClassDiagram.puml index 58b4f602ce6..9700eab4506 100644 --- a/docs/diagrams/LogicClassDiagram.puml +++ b/docs/diagrams/LogicClassDiagram.puml @@ -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 @@ -29,9 +30,9 @@ HiddenOutside ..> Logic LogicManager .right.|> Logic LogicManager -right->"1" ParserClasses -ParserClasses ..> XYZCommand : <> +ParserClasses ..> CommandClasses : <> -XYZCommand -up-|> Command +CommandClasses -up-|> Command LogicManager .left.> Command : <> LogicManager --> Model @@ -39,7 +40,6 @@ 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 diff --git a/docs/diagrams/ModelClassDiagram.puml b/docs/diagrams/ModelClassDiagram.puml index 3f3bf579251..0de49091dbc 100644 --- a/docs/diagrams/ModelClassDiagram.puml +++ b/docs/diagrams/ModelClassDiagram.puml @@ -14,7 +14,6 @@ Class UserPrefs Class UniquePersonList Class Person -Class Address Class Email Class Name Class Phone @@ -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 diff --git a/docs/diagrams/ParserClasses.puml b/docs/diagrams/ParserClasses.puml index 4e756fe94c0..7ba2b420cfd 100644 --- a/docs/diagrams/ParserClasses.puml +++ b/docs/diagrams/ParserClasses.puml @@ -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 "<>\nParser" as Parser @@ -23,7 +24,7 @@ HiddenOutside ..> CampusConnectParser CampusConnectParser .down.> XYZCommandParser: <> -XYZCommandParser ..> XYZCommand : <> +XYZCommandParser ..> CommandClasses : <> CampusConnectParser ..> Command : <> XYZCommandParser .up.|> Parser XYZCommandParser ..> ArgumentMultimap @@ -34,5 +35,5 @@ CliSyntax ..> Prefix XYZCommandParser ..> ParserUtil ParserUtil .down.> Prefix ArgumentTokenizer .down.> Prefix -XYZCommand -up-|> Command +CommandClasses -up-|> Command @enduml