-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CS2113-F14-2] DinEZ #82
base: master
Are you sure you want to change the base?
Changes from 209 commits
75230bd
6ad59e5
b4e9002
6f5ba80
35938ea
d7e1a94
2062fec
e180aee
d2efbed
7927ae7
afbbea0
a61ab35
f8fc688
578139d
cc61ff8
8d19008
8fccca2
cd028a8
68f82b5
0002c1a
b86b4e9
963f596
2b2483f
b702920
89cc525
c9b895a
330f2ff
4dac5d6
38e2d20
3226c2c
8b4d56f
15d40b3
b8e7868
f10e9b0
b96a304
21210b2
01d1f4f
6db9cfb
9b52123
7917713
6de3c57
26b5a41
562abe8
dcd515b
089f700
b268e89
22de9f9
c55a9d8
f42c860
a0c2f92
295ede1
a7eb904
7e26c7b
7771425
993bccd
afe515e
f736c0b
e8f912b
8619b70
2f20fb6
8fadfb0
5ed6919
5552580
3b5c2b9
c0358f0
c689934
5719c83
7481671
1cd0dcd
b6e2a03
f52eb20
9c44592
e541fe4
d321248
c3458eb
206b967
650eeb0
e379d77
bb6c873
24d2895
d1322ca
9e7e047
e16017d
2fe5701
c3b2b95
4a74962
799c046
e76dbf1
03453cb
b083d47
d9656b7
49fe560
22994be
52f7b78
5ea215a
a44deb3
6e9bdbd
4bd5934
d0d6ca6
01a6bad
5c75c16
0ecbb0f
ee7b9ad
5f6ec56
9ae002a
1076188
13ecc7e
e8d4743
c711e1b
56c81b6
aa1b9da
4556fab
b1d8ddb
a2418d0
8d4f20b
5c03bf7
3cab29c
94d69f2
15ddafd
b56d014
9df185a
6018e06
5ebd513
33dbac9
a75873d
4a44662
f3bb9d8
27dd667
70c1df8
c6d6b95
f885462
e5da330
bc3c759
a991c9b
920a51d
6b1dba2
560939b
42e88ff
02b2017
efd5aa7
c1c9c23
69734c7
a5bdc7b
557c9a4
968035f
dc2f2bf
0097dc4
b36e00c
afac1cd
769cb26
735b3e7
d4b16e2
ad55995
53f4a36
3af6253
ccf94f3
448ca2f
009f88d
980ad0c
042bedf
cb8d6ed
621d53c
2cfa5d3
c1ee272
615e867
4183566
295f82c
c164186
5da9b43
4cc7aae
da7273e
d4a8825
08a9d03
474433b
2ab65c7
242c835
dd21e86
0de1dc9
df08cf4
161ba79
6017651
4c07e03
d6b3db4
b20db24
88196b8
fb93f95
82c8645
65ac285
2488114
0d7b1c4
1ed40af
5f10be8
9858c6b
12638b6
9f82218
5d23080
e773ac4
aad2c79
19ff911
d0803f7
70ba7ae
f07e44f
a3fed85
d3b07a7
9ce1d4e
0ecc1c9
45704bd
eab087e
a1312b9
2e98926
c8cce50
b6d945d
8622828
93a4af6
8df875c
e109a3a
7049190
95ed22a
7f84dc5
b745d12
e517e0b
75eace8
526f4e5
775c6d7
f239d0c
6a150cb
38c7123
88e1410
85196f7
a3de7ed
2aa9de7
56fcc62
4191744
e4e69e3
943aa10
e901e41
047c643
d359765
8ffa4aa
661bd43
930bfb2
573a685
b7ee53d
ba1b82a
1e5d4d2
9fe969c
74d5a8a
a1f2812
febade4
9b549e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,6 @@ bin/ | |
|
||
/text-ui-test/ACTUAL.TXT | ||
text-ui-test/EXPECTED-UNIX.TXT | ||
|
||
#log files | ||
*.log |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Manifest-Version: 1.0 | ||
Main-Class: logic.MainLogic | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="GBK" standalone="no"?> | ||
<!DOCTYPE log SYSTEM "logger.dtd"> | ||
<log> | ||
</log> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="GBK" standalone="no"?> | ||
<!DOCTYPE log SYSTEM "logger.dtd"> | ||
<log> | ||
<record> | ||
<date>2024-04-03T14:19:34.748138100Z</date> | ||
<millis>1712153974748</millis> | ||
<nanos>138100</nanos> | ||
<sequence>0</sequence> | ||
<logger>OrderAddCommandLogger</logger> | ||
<level>INFO</level> | ||
<class>command.order.OrderAddCommand</class> | ||
<method>execute</method> | ||
<thread>1</thread> | ||
<message>Adding new item to order</message> | ||
</record> | ||
<record> | ||
<date>2024-04-03T14:19:34.751139200Z</date> | ||
<millis>1712153974751</millis> | ||
<nanos>139200</nanos> | ||
<sequence>1</sequence> | ||
<logger>OrderAddCommandLogger</logger> | ||
<level>INFO</level> | ||
<class>command.order.OrderAddCommand</class> | ||
<method>execute</method> | ||
<thread>1</thread> | ||
<message>Item successfully added to order</message> | ||
</record> | ||
</log> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,4 +43,5 @@ checkstyle { | |
|
||
run{ | ||
standardInput = System.in | ||
enableAssertions = true | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
# About us | ||
|
||
Display | Name | Github Profile | Portfolio | ||
--------|:----:|:--------------:|:---------: | ||
![](https://via.placeholder.com/100.png?text=Photo) | John Doe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Don Joe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Ron John | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | John Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Don Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
Display | Name | Github Profile | Portfolio | ||
--------|:------------:|:--------------:|:---------: | ||
![](https://media.licdn.com/dms/image/D4D03AQHqwchTapLQSw/profile-displayphoto-shrink_800_800/0/1689641178627?e=1715817600&v=beta&t=0zJsfORUyukckyySHLfJWKJGEdSk6vE4IBQLC0tEiPo) | Zheng Wentao | [Github](https://github.com/Zhengwinter/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://media.licdn.com/dms/image/D5635AQF9CsBIurtIhQ/profile-framedphoto-shrink_400_400/0/1709822298987?e=1710486000&v=beta&t=ZFPmBTwS2j4itxdUfOToKvL_Wd55X4m0V1_SBnHl_Go) | Xiao Bo | [Github](https://github.com/Xb990219) | [Portfolio](docs/team/UserGuide.md) | ||
![](https://static.wikia.nocookie.net/pure-good-wiki/images/6/6e/Winnie_The_Pooh.png/revision/latest?cb=20210310185331) | Zeng Zheqi | [Github](https://github.com/adamzzq) | [Portfolio](youtube.com) | ||
![](https://media.licdn.com/dms/image/D5603AQFfWFYq1mqgcA/profile-displayphoto-shrink_400_400/0/1696897863941?e=1715212800&v=beta&t=TLopY2QuxEZz9oFQttl_5avFfWdGFdeMX25c60Tnvl8) | Webster Tan | [Github](https://github.com/webtjs) | [Portfolio](docs/team/UserGuide.md) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,10 +4,137 @@ | |
|
||
{list here sources of all reused/adapted ideas, code, documentation, and third-party libraries -- include links to the original source as well} | ||
|
||
## Design & implementation | ||
## Design | ||
|
||
{Describe the design and implementation of the product. Use UML diagrams and short code snippets where applicable.} | ||
### Architecture | ||
![Architecture](images\Architecture.png) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An excellent high-level class diagram! Simple, clear and straight to the point. Good for understanding. |
||
|
||
The **Architecture diagram** given above shows the high-level design of the application. | ||
|
||
Given below is a quick overview of main components and how they interact with each other. | ||
|
||
**`Main`** is in charge of the app launch, shut down, and taking user input. | ||
|
||
* At the app launch, it loads the data from the file system, and initializes other components. | ||
* At the app shut down, it saves the data to the file system, and shuts down other components. | ||
|
||
The app's work is done by the following components: | ||
|
||
* [**`MainLogic`**](#sublogic-component): The main logic command executor. | ||
* [**`SubLogic`**](#sublogic-component): The sub logics(i.e. **`MenuLogic`**, **`OrderLogic`**) command executor. | ||
* [**`Parser`**](#parser-component): The parser that parses user input to command. | ||
* [**`Model`**](#model-component): The data model that stores the data. | ||
* [**`Command`**](#command-component): Represents a command that the user can execute. | ||
* [**`Storage`**](#storage-component): Reads data from, and writes data. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i like the links provided here |
||
|
||
**How the architecture components interact with each other** | ||
|
||
The *Sequence Diagram* below shows how the components interact with each other for the scenario where the user issues | ||
the command `Create order -menu 01`, `add -item 001` and `complete`. | ||
|
||
![Sequence Diagram](images\ArchitectureSequanceDiagram.png) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It may be clearer if we can highlight the commands |
||
|
||
### UI Component | ||
The UI component is responsible for parsing user input into commands that can be executed by the logic component. | ||
There is a `analyzeInput` method in the `Parser` class that interprets the user input and classifies | ||
it into a `CommandType` enum.<br> | ||
The `splitInput` method is used to split the user input into an array of strings, according to the command type. | ||
It returns an array containing any arguments that are needed to execute the command. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: would the explanation be more readable if we follow the format of Logic Component where each method/class has its respective explanation in its respective paragraph? |
||
|
||
### Logic Component | ||
The logic component consists of classes that handle the logic of the application. The logic component is divided into | ||
`MainLogic` and `SubLogic` which consists of `OrderLogic` and `MenuLogic`. | ||
|
||
* [**`MainLogic`**](#model-component): A class to handle the first level commands, and pass the user input to corresponding | ||
classes for analysis and execution. | ||
* [**`OrderLogic`**](#model-component) and [**`MenuLogic`**](#model-component): A class to handle the second level commands, | ||
and pass the user input to corresponding classes for analysis and execution. | ||
|
||
### Command Component | ||
The command component consists of two different command interfaces: `MainCommand` and `OrderCommand`. The `MainCommand` | ||
interface is for the various command classes that are used in the `MainLogic`, while the `OrderCommand` interface is for | ||
command classes used in `OrderLogic`. | ||
|
||
A `Command` object will be created in either the `MainLogic` or `OrderLogic` | ||
based on what command the user has inputted(e.g., `MainHelpCommand` object is created when the user inputs the `help` | ||
command). The `execute()` method of the `Command` object is then called to execute the command, which may require | ||
certain arguments based on the type of command. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See nit above (similar to UI component). |
||
|
||
### Model Component | ||
The model consists of classes describing the objects used in this application. | ||
The general structure is that menu and order are separate, but they both work with `menuItem(s)`, which | ||
represent food items on the menu. | ||
|
||
* [**`ItemManager`**](#model-component): An interface containing methods representing operations common to **`Menu`** | ||
and **`Order`**. <br><br /> | ||
* [**`Item`**](#model-component): An abstract class representing a food item. It should be implemented by **`MenuItem`**. | ||
<br><br /> | ||
* [**`Menu`**](#model-component): A class representing the menu(s) of the restaurant, where each contains menuItem(s) | ||
that can be ordered. Multiple menus can exist and each has a unique ID. <br><br /> | ||
* [**`MenuItem`**](#model-component): A class inheriting item, and represents a food item on the menu. <br><br /> | ||
* [**`Order`**](#model-component): A class representing an order to be entered into the system to be kept track of. Each | ||
order has a unique ID generated from the time of order.<br><br /> | ||
* [**`SetMenu`**](#model-component): An enumeration representing the different types of set menus available, examples of | ||
which includes *breakfast*, *lunch*, *dinner*. | ||
|
||
The *Class Diagram* below shows how the model components interact with each other, including interactions such as | ||
dependencies, associations and inheritance. | ||
|
||
![Class Diagram](images/modelcomponent.png) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
## Implementation | ||
|
||
### `MainLogic` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like the consistent format in explaining the individual methods of MainLogic :) |
||
Generally, the main logic works as follows: | ||
1. User enters an input which is received in the *ui* and parsed by the `Parser`. | ||
2. The `Parser` classifies the command based on `CommandType`. | ||
3. If it is a first level command, `execute` is called on the corresponding class. | ||
4. If it is not a first level command, the command will be pass to `SubLogic` to handle. | ||
|
||
**Create Order** <br> | ||
`Mainlogic` takes user input and crate an `Order` class and pass it to `OrderLogic` to execute the command. | ||
|
||
**View Order by ID** <br> | ||
`Mainlogic` takes in the command and the order ID, execute the `view order` command by calling a static method<br> | ||
in `ViewOrderCommand` class. | ||
|
||
**View all orders** <br> | ||
`Mainlogic` takes in the command and calls the `ViewOrdersSummaryCommand` class to execute the command<br> | ||
by querying the orderList. | ||
|
||
**View Receipt** <br> | ||
`Mainlogic` takes in the command and calls the `ViewReceiptCommand` class to execute the command | ||
### `OrderLogic` | ||
Generally, the order logic works as follows: | ||
1. User enters an input which is received in the *ui* and parsed by the `Parser`. | ||
2. The `Parser` classifies the command based on `CommandType` | ||
3. Within `OrderLogic`, `execute` is called on the corresponding class | ||
4. Control is passed to other sections of the code | ||
|
||
**View Menu** <br> | ||
Within the construct of the order logic, the menu can be accessed for viewing in order to select items from | ||
available menus. This is carried out with the `view menu` command. | ||
|
||
**View Item** | ||
Within `OrderLogic`, a list containing all the items that have been added to the current active order can be viewed by executing | ||
the `view item` command. | ||
|
||
**Add** | ||
Inside `OrderLogic`, items from the menu can be added into the current active order. | ||
This is carried out using the `add -item <item_id> -quantity <quantity_of_item>` command, | ||
where `<item_id>` is an integer corresponding to the item's id in the menu, | ||
and `<quantity_of_item>` is an integer of the amount of that item to be added. | ||
|
||
**Delete** | ||
In `OrderLogic`, items from the current order can be removed via the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just a nit: to make it consistent, we may want to standardize using "Inside" or "in" |
||
`delete -item <item_id> -quantity <quantity_of_item>` command. `<item_id>` | ||
and `<quantity_of_item>` are the same type of parameters as the ones specified | ||
in the `Add` command class. | ||
|
||
**Complete** | ||
Inside `OrderLogic`, once the order is finished, it can be completed and closed | ||
by executing the `complete` command. This marks the current order as completed | ||
and the program returns back to `MainLogic` for subsequent command executions. | ||
|
||
## Product scope | ||
### Target user profile | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Duke | ||
# DINEZ | ||
|
||
{Give product intro here} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
@startuml | ||
!include <office/Concepts/globe_internet> | ||
!include <office/Concepts/documents> | ||
!include <office/Users/user> | ||
!include style.puml | ||
|
||
Class "<$user>" as User #red | ||
Class "<$documents>" as File #blue | ||
|
||
Package " "<<Rectangle>>{ | ||
Class Main #grey | ||
Class MainLogic MAIN_LOGIC_COLOR | ||
Class Command COMMAND_COLOR | ||
Class SubLogic SUB_LOGIC_COLOR | ||
Class Storage STORAGE_COLOR | ||
Class Model MODEL_COLOR | ||
Class Parser PARSER_COLOR | ||
} | ||
User .left.> Main : input | ||
Main .right.> User : output | ||
Main .left.> MainLogic | ||
MainLogic -down.> SubLogic #green | ||
MainLogic -left.> Parser #green | ||
Main -up-> Storage #green | ||
MainLogic -up> Model #green | ||
SubLogic -left.> Parser #red | ||
SubLogic -down-> Model #red | ||
Command -down-> Model #lightgreen | ||
Storage -right.> File #black | ||
Parser -down.> Command #orange | ||
|
||
@enduml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
@startuml | ||
!include style.puml | ||
|
||
Actor User as user USER_COLOR | ||
Participant ":MainLogic" as mainLogic MAIN_LOGIC_COLOR | ||
Participant ":SubLogic(OrderLogic)" as subLogic SUB_LOGIC_COLOR | ||
Participant ":Parser" as parser PARSER_COLOR | ||
Participant ":Command" as command COMMAND_COLOR | ||
Participant ":Model" as model MODEL_COLOR | ||
participant ":Storage" as storage STORAGE_COLOR | ||
|
||
|
||
user -> mainLogic : "Create order -menu 01" | ||
activate mainLogic MAIN_LOGIC_COLOR | ||
mainLogic -> parser : analyzeInput("Create order -menu 01") | ||
activate parser PARSER_COLOR | ||
parser --> mainLogic : return command | ||
deactivate parser | ||
mainLogic -> command : execute(command) | ||
activate command COMMAND_COLOR | ||
command -> model : get(menu01) | ||
activate model MODEL_COLOR | ||
model --> command : return menu01 | ||
deactivate model | ||
command -> model : createOrder(menu01) | ||
activate model MODEL_COLOR | ||
model --> command : return newOrder | ||
deactivate model | ||
command --> subLogic : return newOrder | ||
deactivate command | ||
activate subLogic SUB_LOGIC_COLOR | ||
user -> subLogic : "add -item 001" | ||
subLogic -> parser : analyzeInput("add -item 001") | ||
activate parser PARSER_COLOR | ||
parser --> subLogic : return command | ||
deactivate parser | ||
subLogic -> command : execute(command) | ||
activate command COMMAND_COLOR | ||
command -> model : get(item001) | ||
activate model MODEL_COLOR | ||
model --> command : return item001 | ||
deactivate model | ||
command -> model : addItem(newOrder, item001) | ||
activate model MODEL_COLOR | ||
model --> command : return newOrder | ||
deactivate model | ||
command --> subLogic : return newOrder | ||
deactivate command | ||
user -> subLogic : "complete" | ||
subLogic -> parser : analyzeInput("complete") | ||
activate parser PARSER_COLOR | ||
parser --> subLogic : return command | ||
deactivate parser | ||
subLogic -> command : execute(command) | ||
activate command COMMAND_COLOR | ||
deactivate subLogic | ||
command --> mainLogic : return newOrder | ||
deactivate command | ||
mainLogic -> storage : save(newOrder) | ||
activate storage STORAGE_COLOR | ||
storage --> mainLogic | ||
deactivate storage | ||
|
||
|
||
|
||
|
||
@enduml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
@startuml | ||
'https://plantuml.com/class-diagram | ||
|
||
skinparam dpi 600 | ||
|
||
abstract class Item { | ||
-id | ||
- name | ||
- unitPrice | ||
|
||
+ Item (id: String, name: String, unitPrice: double) | ||
+getID() : String | ||
+getName() : String | ||
+getPrice() : double | ||
|
||
} | ||
interface ItemManager { | ||
add(var1: MenuItem) : boolean | ||
remove(var1: String) : boolean | ||
getID() : String | ||
} | ||
class Menu { | ||
- logr | ||
- menuID | ||
- setupLogger() : void | ||
+ Menu(menuID: String) | ||
+ getItem(itemID: String) : Optional<MenuItem> | ||
+ getID() : String | ||
+ add(item: MenuItem) : boolean | ||
+ remove(itemID: String) : boolean | ||
+ toString() : String | ||
} | ||
class MenuItem { | ||
+ MenuItem(id: String, name: String, unitPrice: double) | ||
+ toString(): String | ||
+ compareTo(o: MenuItem) : int | ||
} | ||
class Order { | ||
- SERVICE_CHARGE | ||
- GST | ||
- orderID | ||
+ add(item: MenuItem) : boolean | ||
+ remove(itemID: String) : boolean | ||
+ remove(item: MenuItem) : boolean | ||
+ getItemCount(itemID String): int | ||
+ getID() : String | ||
+ getSize() : int | ||
+ getTotalPrice() : double | ||
+ getReceipt() : String | ||
+ getOrderSummary() : String | ||
+ toString() : String | ||
} | ||
enum SetMenu { | ||
Breakfast | ||
Lunch | ||
Dinner | ||
} | ||
|
||
Item <|-- MenuItem | ||
|
||
ItemManager <|.. Menu | ||
ItemManager <|.. Order | ||
|
||
MenuItem "1" <.. Order : order | ||
MenuItem "1" <.. Menu : menu | ||
|
||
SetMenu <.. Menu | ||
|
||
|
||
|
||
@enduml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good that the acknowledgment section is here. But will it be better to update the section?