Skip to content

Commit

Permalink
Merge pull request #167 from lckjosh/master
Browse files Browse the repository at this point in the history
Add Command class diagram
  • Loading branch information
lckjosh authored Nov 13, 2023
2 parents 483da5c + a6aab74 commit c911d69
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 4 deletions.
17 changes: 16 additions & 1 deletion docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,28 @@ The bulk of the app's work is done by the following five components:
**UI Component**
The `ui` packages consists of the `Ui` class and the `Messages` class.
The UI component prompts and reads commands from the user and sends the command to `Parser` package to be executed.
The UI component is also responsible for printing output to the user.

**Data Component**

<img src="images/DataClassDiagram.png" width="500" />
The Data component stores the transaction data i.e., all `Transaction` objects in a `TransactionList` object.

The Data component stores the transaction data i.e., all `Transaction` objects in a `TransactionList` object.

Each `Transaction` object stores the information for an `Allowance` or an `Expense`.

**Command Component**

<img src="images/CommandClassDiagram.png" width="500" />

The Command component holds the different types of commands available. All the commands inherit from the abstract
`Command` class, which contains the `execute` method.

The `ListOfCommands` is used by `Parser` to determine if the entered command is a valid one or not.
If it is not valid, an object of class `InvalidCommand` will be constructed. The `execute` method of the
`InvalidCommand` class simply raises an exception that an invalid command has been entered, which will be shown
to the user.

## **Implementation**

### `add` Transaction Feature
Expand Down
75 changes: 75 additions & 0 deletions docs/diagrams/CommandClassDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
@startuml
!include style.puml
left to right direction
hide circle
skinparam classAttributeIconSize 0

Package Commands as CommandPackage <<Rectangle>>{
class HelpCommand {
+ void execute(TransactionList)
}
class AddCommand {
- Transaction transaction
+ void execute(TransactionList)
}
class ListOfCommands {
+ {static} String COMMAND_EXIT
+ {static} String COMMAND_LIST
+ {static} String COMMAND_ALLOWANCE
+ {static} String COMMAND_EXPENSE
+ {static} String COMMAND_DELETE
+ {static} String COMMAND_FIND
+ {static} String COMMAND_VIEW
+ {static} String COMMAND_FILTER
+ {static} String COMMAND_EDIT
+ {static} String COMMAND_BUDGET
+ {static} String COMMAND_HELP
}
class DeleteCommand {
- int taskIndex
+ void execute(TransactionList)
}
class InvalidCommand {
+ void execute(TransactionList)
}
class FilterCommand {
- TransactionCategory category
+ void execute(TransactionList)
}
class ExitCommand {
+ void execute(TransactionList)
+ {static} boolean isExit(Command)
}
class ViewCommand {
- int taskIndex
+ void execute(TransactionList)
}
class ListCommand {
+ void execute(TransactionList)
}
class EditCommand {
- int index
- Transaction transaction
+ void execute(TransactionList)
}
abstract class Command {
+ {abstract}void execute(TransactionList)
}
class BudgetCommand {
- float budget
+ void execute(TransactionList)
}


Command <|-u- HelpCommand
Command <|-u- AddCommand
Command <|-u- DeleteCommand
Command <|-u- InvalidCommand
Command <|-l- FilterCommand
Command <|-- ExitCommand
Command <|- ViewCommand
Command <|-- ListCommand
Command <|-- EditCommand
Command <|-- BudgetCommand
}
@enduml
8 changes: 5 additions & 3 deletions docs/diagrams/DataClassDiagram.puml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
@startuml
!include style.puml
hide circle
hide member
skinparam arrowThickness 1.1

Package Data as DataPackage <<Rectangle>>{
Package Transaction as TransactionPackage <<Rectangle>>{
Class Transaction
Class Allowance
Class Expense
Interface TransactionCategory
Enum ExpenseCategory
Enum AllowanceCategory
Interface TransactionCategory <<interface>>
Enum ExpenseCategory <<enumeration>>
Enum AllowanceCategory <<enumeration>>
}
Class TransactionList
}
Expand Down
Binary file added docs/images/CommandClassDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c911d69

Please sign in to comment.