Skip to content

Commit

Permalink
Merge pull request #224
Browse files Browse the repository at this point in the history
Change command classes in DG
  • Loading branch information
KrashKart authored Nov 5, 2024
2 parents 75a5ab1 + 9715b63 commit 2ef047f
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 53 deletions.
10 changes: 6 additions & 4 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,16 @@ 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:
Finally, the `Logic` contains the important `Command` classes. Some command classes from AB3 have been retained:
<puml src="diagrams/CommandClassesOriginal.puml" width="600"/>

However, there are new classes implemented for CampusConnect as well:
<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.
The structure is simple:
* Each `Command` class (old and new) extends from the abstract `Command` class, which enforces the implementation of the `execute()` method.
* 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.
* They also contain their own respective error messages.

### Model component
**API** : [`Model.java`](https://github.com/se-edu/CampusConnect/tree/master/src/main/java/seedu/address/model/Model.java)
Expand Down
66 changes: 17 additions & 49 deletions docs/diagrams/CommandClasses.puml
Original file line number Diff line number Diff line change
Expand Up @@ -8,68 +8,36 @@ Class "{abstract}\nCommand" as Command
Class HiddenOutside #FFFFFF

package "Command Classes" as CommandClasses {
together {
Class "SuperFindCommand" as AFC
Class "AddCommand" as AC
Class "ClearCommand" as CC
Class "DeleteCommand" as DC
package "Original AB3 Classes" as OAC {
}

package "CampusConnect Classes" {
Class "AddTagCommand" as ATC
Class "CategorizeTagCommand" as CTC
Class "DeleteTagCommand" as DTC
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
Class "UndoCommand" as UC
Class "RedoCommand" as RC
Class "SuperFindCommand" as SFC
}
}
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
ATC -u-|> Command
ATC -[hidden]right CTC

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

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

DTC -u-|> Command
FEC -[hidden]u- DTC

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
LC -[hidden]right UC
FEC -[hidden]u- LC
DTC -[hidden]right UC

UC -u-|> Command
UC -[hidden]right RC
FEC -[hidden]u- UC

RC -u-|> Command
FEC -[hidden]u- RC
RC -[hidden]right SFC

SFC -u-|> Command

OAC -u|> Command
@enduml
43 changes: 43 additions & 0 deletions docs/diagrams/CommandClassesOriginal.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
@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 "Original AB3 Classes" {
Class "AddCommand" as AC
Class "ClearCommand" as CC
Class "DeleteCommand" as DC
Class "EditCommand" as EdC
Class "ExitCommand" as ExC
Class "HelpCommand" as HC
Class "ListCommand" as LC
}

HiddenOutside ..> Command

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

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

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

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

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

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

LC -u-|> Command
@enduml

0 comments on commit 2ef047f

Please sign in to comment.