-
Notifications
You must be signed in to change notification settings - Fork 89
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
[CS2113T-W11-1] SysLib CLI #6
base: master
Are you sure you want to change the base?
Changes from 232 commits
6854f6d
3312f69
53e1fe9
0bbbeee
78762a9
dc4513d
9b6f673
e926aa0
f3fddd7
35e3122
95d285d
77b5dac
a3be979
c34bd03
9b7653c
13206cc
d2f49f3
5e47042
a61dcbe
997c42c
9469554
513a68d
7c7c016
410b8fa
46b91c4
0b178f7
cc3796b
3c8bcdd
9f0ebc0
18d8187
6874057
89024db
e1b1f53
a9a6549
2a0f589
1d2a9e0
1684dab
2ba206b
b777a5f
d4ae0ca
5a78c6f
2f3e44f
97cad21
2554009
14a3627
63453fe
d764d5c
3e76276
c1f2eb6
2ef1716
6ccd9e1
06ea763
c0d5e3c
c821d30
e867c3e
c1e9cca
9875519
deabce1
72f7a03
5bb5e16
7bc6433
d4409d5
4a35813
aac1c2a
f5f1ca5
fb6d50b
2e08a1f
22db27b
5f9c628
160f331
b61d8ab
cf5d146
cd921d2
302c6e2
4b94d65
f0d0091
49ed028
45e9008
3e0964d
70aa604
05b1ae1
745cfe6
dab0180
606150e
dbd0f6b
05ac015
dcd821b
59fcfee
dbe1892
e4d5070
bbda864
1536674
ce5bf36
3c17566
dfe146d
1415bea
9fd3fb8
6b7d533
8a87a8b
73d678f
1b05620
d3a4711
b8ff03f
aaf7280
5f259df
1b5f917
d72a691
88f6029
d93abf1
051ebb5
099c89b
f337022
d33bd3c
2d1b653
f21df65
5a92bc9
fc5e677
f868706
eb1a72f
fa79b5c
32a38eb
f7bcd7b
b98c3e8
d0cec53
dcba2c9
7e51f89
a9232da
c1eb25b
6f0bf8c
f528d3e
35ee966
0e3e670
7a4c870
31fd45a
ba1bb43
2013d2e
8024f9e
0e54f86
aca3072
655d82f
88e67cf
e04e2ca
39da842
fb94951
251ac54
72a62b3
a5ea0fc
9dbf4d6
edd09a7
a0556d0
c3afc84
26b9de7
eaef395
b9dcbf8
d455596
27c9ea4
24fc641
d14f07e
f8c8186
ffc6804
ba1ea27
49ef561
092b0ca
075e9f4
d4cb6c7
0c39ee6
5438f79
af58f83
51726b5
87a07c4
fcca109
623f10e
650cd5a
3f39dcc
5d61831
e21e8a3
8910c81
8fc8096
0d83344
1252521
0e43394
0049433
c1c2232
b8cc87c
79bf79f
bc69c45
702c212
0def53b
72712af
ffca526
6a555b5
437bed7
72f4e36
a47792c
45297fb
4527aff
25ff4b5
b244bef
311896a
ee9f27c
c97e9f2
54e3255
37ec9c2
082aabf
89ccff1
1eb1d61
0497539
e613681
146d2fd
5ac83f1
a6be805
8011bfe
428e73c
90e2b71
1446e27
8943405
2afc778
fbf63c6
8cb7119
3958f80
447388e
8a682db
2ce2014
21003a1
d2c5ffa
d0c820d
a8b589e
1bec5c7
2e1ae79
e1d3486
274a634
0d39e40
de188eb
3fcb1d6
3e4b854
4457e1b
7cfd867
026b4b9
09d40b6
f77ddfb
d09005f
b9677d3
c886ae1
657f857
0f84321
d857fbe
3d0f6b3
e2992e2
4169708
697c7ee
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 |
---|---|---|
@@ -1,9 +1,8 @@ | ||
# About us | ||
|
||
Display | Name | Github Profile | Portfolio | ||
--------|:----:|:--------------:|:---------: | ||
 | John Doe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
 | Don Joe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
 | Ron John | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
 | John Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
 | Don Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
| Display | Name | Github Profile | Portfolio | | ||
|-------------------------------------------------------------------------|:-------------:|:-----------------------------------------:|:--------------------------------:| | ||
|  | Loke Ying Xia | [Github](https://github.com/yingx9) | [Portfolio](team/YingXia.md) | | ||
|  | Benjamin Ng | [Github](https://github.com/bnjm2000) | [Portfolio](team/BenjaminNg.md) | | ||
|  | Joanne Ang | [Github](https://github.com/JoanneJo) | [Portfolio](team/JoanneAng.md) | | ||
|  | Ashok Balaji | [Github](https://github.com/000verflow) | [Portfolio](team/ashokbalaji.md) | | ||
|  | Wu Xingyu | [Github](https://github.com/DavinciDelta) | [Portfolio](team/WuXingyu.md) | |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,26 +4,231 @@ | |
|
||
{list here sources of all reused/adapted ideas, code, documentation, and third-party libraries -- include links to the original source as well} | ||
|
||
## Design & implementation | ||
## Setting Up & Getting Started | ||
|
||
1. Fork the repo at https://github.com/AY2324S1-CS2113T-W11-1/tp. | ||
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. Would it be better to use hyperlinks? |
||
2. Clone the fork into your computer. | ||
|
||
## Design & Implementation | ||
|
||
{Describe the design and implementation of the product. Use UML diagrams and short code snippets where applicable.} | ||
|
||
### Architecture | ||
|
||
<img src="images/ArchitectureDiagram.png" /> | ||
|
||
|
||
**Main components of SysLib Architecture** | ||
|
||
SysLib currently consists of four main components: | ||
|
||
- `UI`: User Interaction | ||
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. UI should be User Interface? |
||
- `Parser`: Parsing User Response | ||
- `Command`: Command Executor | ||
- `Data`: Holds the data of SysLib | ||
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. Would it be better to indicate where other packages (e.g., |
||
|
||
|
||
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. Consider adding class diagrams to show how the different classes are related to each other. |
||
|
||
### UI Component | ||
|
||
### Parser Component | ||
|
||
### Command Component | ||
|
||
|
||
### Data Component | ||
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. Maybe can add some content after each title 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 think they just have not started to write them… 😂 |
||
|
||
## Implementation | ||
This section provides details on how certain features are implemented. | ||
|
||
### Find Resource Feature | ||
|
||
The `find` command allows users to search for resources based on specified filters such as author (`/a`), ISBN (`/i`), ID (`/id`), and title (`/t`). The results will show all resources that match any of the given filters. | ||
|
||
`find` has the following options: | ||
- `find /id [ID]` | ||
- `find /t [TITLE]` | ||
- `find /a [AUTHOR]` | ||
- `find /i [ISBN]` | ||
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. According to the textbook, we are suggested to use |
||
|
||
Multiple filters can also be combined: | ||
|
||
- `find /t [TITLE] /a [AUTHOR]` | ||
|
||
#### Implementation | ||
|
||
Upon receiving the `find` command, the system will: | ||
|
||
1. Parse the filters and their associated values. | ||
2. Filter the resources based on the given filters. | ||
3. Display the matching resources. | ||
Comment on lines
+418
to
+420
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. According to the textbook, we are suggested to use generic numbering for ordered lists, but it is optional to follow it. |
||
|
||
#### Example Usage Scenario | ||
|
||
**Step 1.** The user inputs the command: `find /a "F. Scott Fitzgerald"` | ||
|
||
**Step 2.** The `UI` component forwards the input to `SYSLIB`, which then sends it to the `PARSER`. | ||
|
||
**Step 3.** The `PARSER` processes the command, extracts the `author` filter, and retrieves all resources written by "F. Scott Fitzgerald". | ||
|
||
**Step 4.** The matching resources are displayed to the user. | ||
|
||
#### Sequence Diagram | ||
|
||
<img src="images/FindSequenceDiagram.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. Should add a conditional block for returning legalArgumentException? Since it's try catch block so not necessary to throw exception 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. This sequence diagram is quite verbose. All return values and method calls are written with sample arguments provided, which is not necessary for a high-level diagram. 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. if you are calling a function resourceList should be like resourceList() in the sequence diagram |
||
|
||
### Examples for Testing | ||
|
||
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. Good use of examples! |
||
1. **Find by Author** | ||
- Test case: `find /a "F. Scott Fitzgerald"` | ||
|
||
Expected: All resources written by F. Scott Fitzgerald are displayed. | ||
|
||
2. **Find by ISBN** | ||
- Test case: `find /i "9780061120084"` | ||
|
||
Expected: The resource with ISBN "9780061120084" is displayed, which should be "To Kill a Mockingbird" by Harper Lee. | ||
|
||
3. **Find by ID** | ||
- Test case: `find /id 2` | ||
|
||
Expected: The resource with ID "2" is displayed, which should be "To Kill a Mockingbird" by Harper Lee. | ||
|
||
4. **Find by Title** | ||
- Test case: `find /t "The Great Gatsby"` | ||
|
||
Expected: The resource titled "The Great Gatsby" is displayed. | ||
|
||
5. **Combining Filters** | ||
- Test case: `find /a "F. Scott Fitzgerald" /t "The Great Gatsby"` | ||
|
||
Expected: Resources that match either the title "The Great Gatsby" or the author "F. Scott Fitzgerald" are displayed. | ||
|
||
|
||
### Add Resource Feature | ||
|
||
The `add` feature is responsible for processing user commands to add a new book to SysLib. It is facilitated by | ||
the `AddCommand` component. It works with `Parser` and `Command` components to parse and validate the user input. | ||
The new book is stored internally in `resourceList` as a `Book`. | ||
|
||
`add` has seven options: | ||
- add /id [id] /t [title] /a [author] /tag [tag] /i [isbn] | ||
- add /id [id] /t [title] /a [author] /tag [tag] /i [isbn] _/g [genre] /s [status]_ | ||
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. What does the italics represent? Perhaps more explaination can be added to the DG to explain it. I am not sure if it is there to highlight the difference or to indicate that they are optional tags. 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. Can consider putting these commands in a code block for readability. |
||
|
||
#### Implementation | ||
|
||
It implements the following operations: | ||
|
||
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. Is |
||
- `ADDCOMMAND#parseArgument(statement: String)` -- Parses the input command to extract relevant information. | ||
- `ADDCOMMAND#validate(statement: String, values: String[])` -- Validates the input statement to ensure that it is valid. | ||
- `ADDCOMMAND#createBook(values: String[])` -- Creates a new book based on the parsed and validated values. | ||
|
||
#### Example Usage Scenario | ||
|
||
Step 1. The user inputs the command: `add /id 0005 /t Frankenstein /a Mary Shelley /i FKS0001 /tag B /g Gothic, Fiction` | ||
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. Why is "Step 1." in bold above but not here? Is it better to have a unified style? |
||
|
||
Step 2. The `UI` component forwards the input to `SYSLIB`, which in turn passes it to the `PARSER`. | ||
|
||
Step 3. The `PARSER` processes the command and determines that it contains a valid key (`add`). It then calls | ||
`ADDCOMMAND#execute(statement: String, this: Parser)` with the input command. | ||
|
||
Step 4. The `ADDCOMMMAND` component receives the command and performs the following operations: | ||
- Calls `ADDCOMMAND#parseArgument(statement: String)` to extract values for ID, title, author, ISBN, tag, and genres. | ||
- Calls `ADDCOMMAND#validate(statement: String, values: String[])` to ensure the validity of the input command. | ||
|
||
Step 5. The `COMMAND` component processes the input command to ensure that it meets the required format and constraints. | ||
It prepares the argument values for further processing. | ||
|
||
Step 6. Since the `tag` argument in the input command indicates that it is a book, the `ADDCOMMAND` determines that the | ||
key is equal to `b` (ignoring case). It then creates a new `Book` object using the parsed values (title, ISBN, author, | ||
genres, ID). | ||
|
||
Step 7. The newly created book is forwarded to the `PARSER` to be added to the `resourceList`. | ||
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. A well-written, detailed explanation of the process. Great for a future developer! |
||
|
||
#### Sequence Diagram | ||
The following sequence diagram shows how the add function works: | ||
<img src="images/AddSequenceDiagram.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. It's a good diagram in many ways, however the size could be much more compact without low-level details such as exactly what method is called or what text is passed into each argument. |
||
|
||
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. This diagram contains a repeated input string which is very long. Can consider mentioning the input outside of the diagram to make the diagram more compact and readable |
||
### Listing Resources Feature | ||
|
||
The `list` command works with the `Parser` and `Command` component to execute the correct action. | ||
|
||
`list` has four options: | ||
- list | ||
- list _/tag [tag]_ | ||
- list _/g [genre]_ | ||
- list _/tag [tag]_ _/g [genre]_ | ||
|
||
When `list` is specified with both `tag` and `genre` filters, it is `AND` inclusive, listing only | ||
Resources with the same tag and genre. | ||
|
||
Sequence Diagram: | ||
|
||
<img src="images/ListSequenceDiagram.png" /> | ||
|
||
When a user enters `list /tag B`, the Parser retrieves the parameters from the input and | ||
calls the `execute` function of ListCommand. | ||
|
||
ListCommand then calls `parseArg` and `validate` from `Command`, which checks if the parameters are valid. If it passes | ||
the checks, `filterResources` is called to begin the filtering process. First it calls `hasFilters()` check if the user | ||
selected any filters `[tag/genre/both]` or none. | ||
|
||
If hasFilters returns `true`, it filters the `resourceList` with the given keywords and display the details | ||
of the resources. | ||
|
||
If hasFilters returns `false`, it skips the filtering process and displays the details of all the resources. | ||
|
||
## Product scope | ||
|
||
### Target user profile | ||
|
||
{Describe the target user profile} | ||
All librarians, not just system librarian! | ||
|
||
### Value proposition | ||
- Needs to manage inventory with significant number of resources e.g. books | ||
- Is a fast typist | ||
|
||
{Describe the value proposition: what problem does it solve?} | ||
### Value Proposition | ||
|
||
To provide a platform to help librarians to quickly find the information they need to assist patrons. | ||
|
||
## User Stories | ||
|
||
|Version| As a ... | I want to ... | So that I can ...| | ||
|--------|----------|---------------|------------------| | ||
|v1.0|new user|see usage instructions|refer to them when I forget how to use the application| | ||
|v2.0|user|find a to-do item by name|locate a to-do without having to go through the entire list| | ||
| Version | As a ... | I want to ... | So that I can ... | | ||
|---------|-----------|--------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------| | ||
| v1.0 | librarian | view a list of books that the library has | have an overview of all the books | | ||
| v1.0 | librarian | add new books to our inventory by entering their title, author, ISBN, and publication year | keep our collection up-to-date | | ||
| v1.0 | librarian | delete books from the database | let the patrons know our library no longer carries it | | ||
| v1.0 | librarian | tag a book as physical medium like newspapers, audio cds, books or online like eJournals | patrons can know what type are available | | ||
| v1.0 | librarian | have a help function | know the commands of this programme | | ||
| v1.0 | librarian | quickly find out how many books we have of a particular author and the names of the books | know how many books are related to the author | | ||
| v2.0 | librarian | import/export our library's inventory data to a file format | easily share with other libraries to be used for backup and archival purposes. | | ||
| v2.0 | librarian | find a to-do item by name | locate a to-do without having to go through the entire list | | ||
| v2.0 | librarian | get the status of an item | know if it is available | | ||
| v2.0 | librarian | update the details of a resource | fix any mistakes and maintain consistency | | ||
| v2.0 | librarian | add in different types of resources | differentiate between resources such as magazines, cds... | | ||
|
||
## Use Cases | ||
|
||
(For all use cases below, the System is the SysLib and the Actor is the user, unless specified otherwise) | ||
|
||
### Use case: Add a book | ||
|
||
#### MSS | ||
1. User requests to add a book | ||
2. AddressBook adds the book | ||
|
||
Use case ends. | ||
|
||
#### Extensions | ||
- 1a. The given ID is invalid. | ||
- 1a1. SysLib shows an error message. | ||
|
||
Use case ends. | ||
|
||
- 1b. Insufficient data given. | ||
- 1b1. SysLib shows an error message. | ||
|
||
Use case ends. | ||
|
||
## Non-Functional Requirements | ||
|
||
|
@@ -33,6 +238,104 @@ | |
|
||
* *glossary item* - Definition | ||
|
||
## Instructions for manual testing | ||
## Instructions for Manual Testing | ||
Example input: | ||
``` | ||
help | ||
``` | ||
Example response: | ||
``` | ||
Commands available: | ||
add: adds a new resource to the library inventory.(e.g. add /id ID /t TITLE /a AUTHOR /tag TAG /i ISBN [/g GENRE]) | ||
delete: deletes the resource with the specified ID from the library inventory. (e.g. delete /id 123456789) | ||
list: list all resources OR filter by certain tags or genre.(e.g. list /tag B /g Fiction | ||
find: find a resource by title, author, ISBN or given id. (e.g. find /i 9780763630188) | ||
edit: Edit a listing by entering its isbn to update its details. (e.g. edit /i 123 /t NEW_TITLE /a NEW_AUTHOR) | ||
exit: displays a farewell message and exits the program (e.g. exit) | ||
For more information, please refer to our user guide at:https://ay2324s1-cs2113t-w11-1.github.io/tp/UserGuide.html | ||
____________________________________________________________ | ||
``` | ||
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. A bit hard to read |
||
Example input: | ||
|
||
``` | ||
add /id 1 /t The Great Gatsby /a F. Scott Fitzgerald /tag B /i 9780023381201 /g Novel, Fiction, Tragedy /s lost | ||
``` | ||
Example response: | ||
``` | ||
This book is added: The Great Gatsby | ||
____________________________________________________________ | ||
``` | ||
Example input: | ||
``` | ||
add /id 2 /t To Kill a Mockingbird /a Harper Lee /tag B /i 9780061120084 /g Novel, Bildungsroman, Southern Gothic, Domestic Fiction, Thriller, Legal Story | ||
``` | ||
Example response: | ||
``` | ||
This book is added: To Kill a Mockingbird | ||
____________________________________________________________ | ||
``` | ||
Example input: | ||
``` | ||
list | ||
``` | ||
Example response: | ||
``` | ||
Listing all resources in the Library: | ||
|
||
1. [B] ID: 1 Title: The Great Gatsby ISBN: 9780023381201 Author: F. Scott Fitzgerald Genre: Novel, Fiction, Tragedy Status: LOST | ||
2. [B] ID: 2 Title: To Kill a Mockingbird ISBN: 9780061120084 Author: Harper Lee Genre: Novel, Bildungsroman, Southern Gothic Status: AVAILABLE | ||
|
||
There are currently 2 resource(s). | ||
____________________________________________________________ | ||
``` | ||
Example input: | ||
``` | ||
delete /id 1 | ||
``` | ||
Example response: | ||
``` | ||
Looking for ID: 1... | ||
This resource is removed: | ||
[B] ID: 1 Title: The Great Gatsby ISBN: 9780023381201 Author: F. Scott Fitzgerald Genre: Novel, Fiction, Tragedy Status: LOST | ||
____________________________________________________________ | ||
``` | ||
Example input: | ||
``` | ||
exit | ||
``` | ||
Example response: | ||
``` | ||
Bye, hope to see you again soon! | ||
____________________________________________________________ | ||
``` | ||
### Launch and Shutdown | ||
|
||
1. Initial launch | ||
1. Download the jar file and copy it into an empty folder. | ||
2. Open the command prompt and run `java -jar SysLib.jar`. | ||
|
||
|
||
### Adding a Book | ||
1. Add a book | ||
1. Test case: `add /id 0005 /t Frankenstein /a Mary Shelley /i FKS0001 /tag B` | ||
|
||
Expected: A book with ID: 0005, Title: Frankenstein, Author: Mary Shelley, and ISBN: FKS0001 is created and added | ||
into the list. A message is shown to acknowledge that the book has been added successfully. | ||
|
||
2. Test case: `add /id 0005 /t Frankenstein /a Mary Shelley /i FKS0001 /tag B /g Gothic, Fiction` | ||
|
||
Expected: A book with ID: 0005, Title: Frankenstein, Author: Mary Shelley, ISBN: FKS0001, and | ||
Genres: Gothic, Fiction is created and added into the list. A message is shown to acknowledge that the book | ||
has been added successfully. | ||
|
||
3. Test case: `add /id abcd /t Frankenstein /a Mary Shelley /i FKS0001 /tag B /g Gothic, Fiction` | ||
|
||
Expected: No book is added. An error message is shown to indicate that the id is invalid. | ||
|
||
4. Test case: `add /id 0005 /t Frankenstein /a Mary Shelley /i FKS0001 /tag A /g Gothic, Fiction` | ||
|
||
Expected: No book is added. An error message is shown to indicate that the tag is invalid. | ||
|
||
{Give instructions on how to do a manual product testing e.g., how to load sample data to be used for testing} | ||
5. Test case: `add /id 0005 /t Frankenstein` | ||
|
||
Expected: No book is added. An error message is shown to indicate that the input is incomplete. |
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.
The table is not displayed properly. Please try to add an empty line between the table and the
# About us
.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.
The avatars are too big! Maybe making the picture smaller will look better!