-
Notifications
You must be signed in to change notification settings - Fork 140
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-T10-1] EasInternship #12
base: master
Are you sure you want to change the base?
Changes from 235 commits
c857796
5d1ce3b
9ef44b8
76e2d70
7519ed2
2e352a4
a981c93
17c9e4f
a31f977
5e40e81
c3420a6
4ebe02c
aa50d7c
9057ad7
78674a5
75e6c48
e379b66
6e06461
a845e99
f6141c8
8d87fa8
745f6a7
5c77d44
4f2eb98
406db4b
e686898
fac6eaf
aed8575
3ca5b92
36d64fb
0b2105e
94552d9
b1b4d50
da82c2d
337ae2f
1f427e0
8eeeb80
3f1d3ed
8c376cc
822187a
b3c35fd
1b70ab5
f83c8da
fd5db62
e5f2ecb
42ac7e7
24d6040
1f12958
6ac0dc4
7cedb60
f471c32
d86dc15
db1ed27
b4684ee
9dd2671
760aa1e
1ecb997
4b78b3c
8f686a2
329937a
62bb1f2
9f47e01
c6129a5
d7bc315
39dcbc4
01a52f0
a661e3e
3613f47
db70294
bdb3d56
8cb8202
52211f6
033aeac
5720a65
a5a7bdb
a14d465
0791a24
450295b
31165a0
99b0121
eec6164
561358b
5d6d13a
2bf5b29
4fbf228
cd68425
912ac9c
b5c7b92
a613cc0
90fad1a
f90ddd2
39c217f
ba72ad7
57d79be
74b8f97
4d7be1f
75fd0f0
fca8661
c9c53ca
04bf534
7436645
93e100a
a3cd1bb
c5f19c7
99d511d
9da9dca
c6837d8
3892a26
7ae0f1d
b675f0b
20f73b8
cd43813
b8b2577
966e859
83fcff9
91dbfea
c086c29
f1945e9
da35bae
0b7ce86
0031253
f1975b5
6fb4fff
3d8351c
61a96b5
123701c
c122079
844902e
aa0dc28
087232d
45b41fd
493b221
f601f5b
c2737fa
6167ccb
a1f86b8
62b939b
0117cda
bba7503
be7c253
81c7d56
200f827
53758c8
1bd4013
0e5c359
6d89e4a
5a76180
199d731
b5b3555
f15f1b8
fb8a56a
f84f24a
815730b
db6bc6f
14b5b4d
123e42d
fb1c148
725a672
9832119
7c987b4
9a37430
b23a709
1218ecb
3e50a29
26714eb
a440ad3
8f53436
775e010
b46faa3
9de2494
3f9e20e
de09982
a5d270d
6f59eb6
6fafa8b
d921a10
b0caf45
50de97a
413b2f7
7bb8a30
f9071a5
b53cb8d
056b65c
05a86f0
ad68f38
22937d0
c3ac4e6
dcca787
f943baa
9b43380
a28583d
42c76a4
d0a4f42
b8a77b8
eb232b3
bf1597e
012c588
ed24c5a
da16a91
2ebc7e1
2832a01
fb011b5
09065d5
8a4477d
548e314
4f184f2
2c7ae2f
74b94c3
89c56bd
df3563c
0fd3e47
131559d
471f7a5
63b183c
8ce6a6c
4ab68b5
1008964
f865a50
15caea5
02d0018
7995984
45f6d18
1352441
b14e13d
d6e508c
dea315d
059a305
09bab19
297a94c
fd0d1e6
f9f5304
436d263
3af15e0
eb0bcfe
6822a85
eb0c341
9ae7b61
2ef4ae8
321db83
f498466
7939542
b67f3bc
9370144
09aceec
7075407
78e041b
43cb864
cdc92c4
578c13c
62c0084
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Manifest-Version: 1.0 | ||
Main-Class: seedu.duke.EasInternship | ||
|
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
1 | ABC | XYZ | 01/01 | 01/01 | | Application Pending | No Deadlines set. | ||
2 | software engineer | abs | 01/01 | 03/24 | python, c++, backend | Application Completed | No Deadlines set. | ||
3 | lawyer | lolo pte ltd | 04/23 | 01/01 | source, terry | Application Completed | Application deadline -date 03/12/04 | ||
4 | Technician | Nokia | 12/22 | 12/30 | java, c++ | Application Pending | interview round 1 -date 26/04/24 - interview round 2 -date 14/05/24 |
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 | ||
--------|:---------:|:---------------------------------------:|:---------: | ||
![](/images/jaden.png) | Jaden Lim | [Github](https://github.com/jadenlimjc) | [Portfolio](https://www.linkedin.com/in/jadenlimjc/) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Yu Man Kit | [Github](https://github.com/Toby-Yu) | [Portfolio](toby-yu) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Rahul | [Github](https://github.com/rahuljai-05) | [Portfolio](rahuljai-05) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Tan Ting Hui | [Github](https://github.com/Ridiculouswifi) | [Portfolio](ridiculouswifi) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,237 @@ | |
|
||
{Describe the design and implementation of the product. Use UML diagrams and short code snippets where applicable.} | ||
|
||
### EasInternship (main class) | ||
|
||
## Product scope | ||
1. [Design](#design) | ||
1. [Architecture](#architecture) | ||
2. [UI Component](#ui-component) | ||
3. [Logic Component](#logic-component) | ||
4. [Model Component](#model-component) | ||
5. [Storage Component](#storage-component) | ||
2. [Implementation](#implementation) | ||
1. [Parsing Input](#parsing-input) | ||
2. [Command Execution](#command-execution) | ||
3. [Task Management](#task-management) | ||
4. [AddCommand Implementation](#addcommand-implementation) | ||
5. [DeleteCommand Implementation](#deletecommand-implementation) | ||
6. [SortCommand Implementation](#sortcommand-implementation) | ||
7. [UpdateCommand Implementation](#updatecommand-implementation) | ||
|
||
--- | ||
|
||
## 1. Design | ||
|
||
### 1.1 Architecture | ||
The architecture of EasInternship is designed to follow the MVC (Model-View-Controller) pattern to facilitate separation of concerns, modularity, and maintainability. | ||
|
||
- **View (UI)**: Responsible for interacting with the user by displaying output and reading input. | ||
- **Controller (Command and Parser)**: Responsible for parsing user input and invoking the appropriate commands. | ||
- **Model (InternshipList)**: Manages the state of the application, including the list of internships and tasks. | ||
- **Storage**: Responsible for loading and saving data from and to the disk. | ||
|
||
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 feel that an architecture diagram help could be a very helpful diagram to add here to give a brief overview of how your different classes interact with each other |
||
--- | ||
|
||
### 1.2 UI Component | ||
|
||
The UI component is responsible for displaying information to the user and reading input. It interacts with the user by printing messages and prompts, and retrieves commands for the rest of the application to process. | ||
|
||
### 1.3 Logic Component | ||
|
||
The logic component is handled by the `Parser` and `Command` classes. The `Parser` interprets the user's input and returns a command object, which is then executed to perform the desired operation. | ||
|
||
### 1.4 Model Component | ||
|
||
The model component includes the `Internship`, `InternshipList`, `Deadline` and `DeadlineList` classes. | ||
|
||
`Internship`: Represents the individual internship entries. | ||
|
||
`InternshipList`: Manages a collection of Internship objects, providing methods for adding, retrieving, updating, sorting and removing internships. | ||
|
||
`Deadline`: Represents each individual deadline associated with an internship, holding data specific to that deadline (description, date). | ||
|
||
Each `Internship` object contains a `Deadline` list, and has methods to add, retrieve or remove deadlines associated with that internship. | ||
|
||
This is represented with the class diagram below: | ||
|
||
![](UML/Internship-Model_Component.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. I believe the visibility of the methods and attributes in this diagram should be signs like "-" and "+" instead of squares and circles. You can consider configuring your plantuml to reflect this. 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. iirc we are supposed to change the default style of the class diagram that is given by PlantUML? Ie use "+" and "-" instead of red squares and green circles. 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. also can consider only adding the important methods, instead of spamming all your methods to improve clarity |
||
|
||
### 1.5 Storage Component | ||
|
||
The storage component is responsible for saving the current state of the `InternshipList` to a file and loading it back when the application is restarted. This ensures that users' progress is preserved between sessions. | ||
The data from the internshipList is saved into a .txt file. | ||
|
||
There are two main functions, `loadFromFile` and `saveFromFile`. | ||
|
||
The following sequence diagrams depict how the Storage Functions work. | ||
![](UML/loadFromFile.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. |
||
![](UML/saveToFile.png) | ||
|
||
|
||
## 2. Implementation | ||
|
||
### 2.1 Parsing Input | ||
|
||
The `Parser` class is responsible for parsing the input strings provided by the user. It breaks down the input into individual components like the command and its accompanying arguments. After parsing, it returns a `Command` object. | ||
|
||
### 2.2 Command Execution | ||
|
||
The `Command` class and its subclasses handle the execution of specific commands. Once a command is parsed, it is executed with the required arguments, and the result is displayed to the user. | ||
|
||
### 2.3 Task Management | ||
|
||
The `InternshipList` class handles adding, removing, and retrieving internships from the list. It interacts with both the UI and the storage components to ensure that updates are reflected in the user interface and persisted to disk. | ||
|
||
--- | ||
|
||
### Overview | ||
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 structure feels abit weird to me. Might be better if you continued to follow the naming structure above? (ie 1.2, 1.3, 2.1, etc) |
||
|
||
The `EasInternship` class serves as the entry point of the application. It manages the application's main loop, where the user is continually prompted for input, and commands are processed in response. The class is responsible for initializing the UI, loading saved data, and handling user input until the user chooses to exit the program. | ||
|
||
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 feel that the overview would be more fitting being placed earlier in the documentation guide, perhaps you can give this some consideration? |
||
### Key Responsibilities | ||
|
||
- **Initialization**: Initializes the necessary components for the application, such as the `Ui`, `InternshipList`, and `Parser` classes. It also loads any saved data from the storage into the `InternshipList`. | ||
- **Main Loop**: Continuously prompts the user for input. The input is parsed by the `Parser`, and the corresponding `Command` is executed. If the user enters the exit command, the loop terminates. | ||
- **Command Processing**: After parsing the user input, the corresponding `Command` object is executed. The application catches and displays any errors that occur during command execution. | ||
- **Saving State**: Upon exiting, the current state of the `InternshipList` is saved to a file to ensure persistence across sessions. | ||
|
||
### Flow of Execution | ||
|
||
1. **Welcome Message**: The `Ui` class displays a welcome message to the user. | ||
2. **Load Data**: The `Storage` class loads any saved internships into the `InternshipList`. | ||
3. **Input Loop**: The application enters a loop, prompting the user for input. | ||
4. **Command Parsing**: The `Parser` interprets the input and returns the appropriate `Command`. | ||
5. **Command Execution**: The command is executed, and the `InternshipList` is updated accordingly. | ||
6. **Exit Flow**: If the user enters the exit command, the `InternshipList` is saved, and the application displays a goodbye message. | ||
|
||
### Methods | ||
|
||
- `public static void main(String[] args)`: The entry point of the application. It handles initialization, the main user input loop, and command execution. | ||
|
||
### Error Handling | ||
|
||
If the user inputs an unknown command or a command fails during execution, the `Ui` class displays an appropriate error message. This ensures that the application can continue running despite errors in user input. | ||
|
||
--- | ||
|
||
### AddCommand Implementation | ||
|
||
#### Overview: | ||
The `AddCommand` class is responsible for adding internship listings to the Internship List. It extends the `Command` class, providing the add functionality as part of the command execution framework. | ||
|
||
#### Design: | ||
- The `AddCommand` class processes user input to determine what fields to add to the new internship listing. | ||
- If no arguments or invalid arguments are given, it prompts the user with an error message indicating which fields are erroneous. | ||
|
||
#### Key Methods: | ||
- `execute(ArrayList<String> args)`: Handles addition logic based on the inputs provided. If the user provides an appropriate "role" and "company", the internship is added to the listing. Otherwise, the user is prompted with which fields are missing. The user also can input start and end dates of the internship during the addition. | ||
- **`getUsage()`**: Returns a string showing the correct usage of the `add` command and the expected input. | ||
|
||
#### Example Usage Scenario: | ||
- The user enters `add -role Software Engineer -company Google`, and the execute method adds the internship to the InternshipList The start and end dates are defaulted to 01/01. | ||
|
||
|
||
- The user enters `add -role Software Engineer -company Facebook -from 10/24 -to 06/25`, and the execute method adds the internship with the specified dates to the InternshipList. | ||
|
||
|
||
- The user enters `add -role Software Engineer`. The execute method detects that no company has been specified and adds `company` to the list of invalid flags. uiCommand is then called and prints an error statement of all invalid flags detected. | ||
|
||
#### Sequence Diagram: | ||
|
||
The following sequence diagram shows how the `AddCommand` is executed: | ||
![AddCommandSequenceDiagram](UML/AddCommand_Sequence_Diagram.png) | ||
|
||
### DeleteCommand Implementation | ||
|
||
#### Overview: | ||
The `DeleteCommand` class is responsible for deleting internship listings from the Internship List. It extends the `Command` class, providing the delete functionality as part of the command execution framework. | ||
|
||
#### Design: | ||
- The `DeleteCommand` class processes user input to determine which `Internship` to remove from the `InternshipList`. | ||
- If no arguments or invalid arguments are given, it prompts the user with an error message indicating which fields are erroneous. | ||
|
||
#### Key Methods: | ||
- `execute(ArrayList<String> args)` : Handles deletion logic based on the inputs provided. If the user provides an appropriate `internshipID`, the `Internship` is deleted from the `InternshipList`. Otherwise, if an inappropriate or no `internshipID` is specified, the user is prompted that the `internshipID` is invalid. | ||
|
||
|
||
- `getUsage()`: Returns a string showing the correct usage of the `delete` command and the expected input. | ||
|
||
#### Example Usage Scenario: | ||
- The user enters `delete 1`. The execute method removes the `Internship` from the `InternshipList` if the `internshipID` is valid. | ||
- The user enters `delete -1`. The execute method detects that the `internshipID` is invalid. uiCommand is called and prints an output `Invalid integer, please provide a valid internship ID`. | ||
|
||
#### Sequence Diagram | ||
The following sequence diagram shows how the `DeleteCommand` is executed: | ||
![DeleteCommandSequenceDiagram](UML/DeleteCommand_Sequence_Diagram.png) | ||
|
||
|
||
|
||
### SortCommand Implementation | ||
|
||
#### Overview: | ||
The `SortCommand` class is responsible for sorting the internship listings based on different criteria such as the internship role, skills and status (alphabetically) , the application deadline (by start and end dates). It extends the `Command` class, providing the sorting functionality as part of the command execution framework. | ||
|
||
#### Design: | ||
- The `SortCommand` class processes user input to determine which sorting method to apply (e.g., role or deadline). | ||
- If no arguments or invalid arguments are given, it defaults to listing internships by ID. | ||
|
||
#### Key Methods: | ||
- **`execute(ArrayList<String> args)`**: Handles sorting logic based on the first argument provided. The valid sort options include: | ||
- `"alphabet"`: Sorts internships by role alphabetically. | ||
- `"duration"`: Sorts internships by duration (start and end dates). | ||
- `"deadline"`: Sorts internships by deadline. | ||
- `"skills"`: Sorts internships by the first skill in the skills list alphabetically. | ||
- `"status"`: Sorts internships by status alphabetically. | ||
- If the user provides an invalid sort option, the command returns an error and defaults to listing internships by ID. | ||
- **`getUsage()`**: Returns a string showing the correct usage of the `sort` command, including valid options like "alphabet", "deadline", "duration", "skills", and "status". | ||
|
||
#### Example Usage Scenario: | ||
1. The user enters `sort alphabet`, and the `execute` method sorts the internships by role. | ||
2. The user enters `sort deadline`, and the internships are sorted by their start and end dates. | ||
3. The user enters `sort skills`, and the internships are sorted by the first skill alphabetically. | ||
4. The user enters `sort status`, and the internships are sorted by their status alphabetically. | ||
5. If the user enters an invalid sort option, the command returns an error and lists the internships by ID. | ||
|
||
#### Sequence Diagram: | ||
The following sequence diagram shows how the `SortCommand` is executed: | ||
![](UML/loadFromFile.png) | ||
|
||
|
||
### UpdateCommand Implementation | ||
|
||
#### Overview | ||
The `UpdateCommand` class is responsible for updating the fields of an internship. It extends the `Command` class, providing an updating functionality as part of the command execution framework. | ||
|
||
#### Design | ||
- The `UpdateCommand` class processes the user input to determine which internship and which field to update. | ||
- If the internship ID is not valid, it will print a message accordingly. | ||
- If the field is not valid, it will print a message indicating the erroneous field. | ||
- If the value provided with the field is not valid, it will also print a message indicating the erroneous value. | ||
|
||
#### Key Methods | ||
- `execute(ArrayList<String> args)`: Handles the logic to find the internship entry and determine which field to update. The valid fields include: | ||
- `status`: Updates the status of the internship. | ||
- `skills`: Adds skills to the relevant field of the internship | ||
- `role`: Updates the role of the internship | ||
- `company`: Updates the company of the internship | ||
- `from`: Updates the start date of the internship | ||
- `to`: Updates the end date of the internship | ||
- `deadlines`: Updates the deadlines of the internship | ||
- `isValidValue(String[] words)`: Checks if there was a new value provided for the selected field. | ||
- `updateOneField(String[] words, int internshipIndex)`: Called within `execute(args)` to invoke the appropriate method to update the field. | ||
- `getUsage()`: Returns a string showing the correct usage of the `update` command. | ||
|
||
#### Example Usage Scenario: | ||
- The user enters `update 2 -status Application Completed`, and the `execute` method finds the internship with ID `2` and updates its `status` to `Application Completed`. | ||
- The user enters `update 4 -status Application Completed`, if `4` is not a valid ID, the `execute` method will print a message to show the ID is out of bounds. | ||
- The user enters `update 2 -skills`, no value is given after the `-skills` flag, the `isValidValue` method returns false and prints a message to indicate the need for a value. | ||
- The user enters `update 2 -from Tomorrow`, `Tomorrow` is not a valid date, the `execute` method prints message to indicate it is an invalid value. | ||
|
||
#### Sequence Diagram | ||
The following sequence diagram shows how the `UpdateCommand` is executed: | ||
![](UML/UpdateCommand_Sequence_Diagram.png) | ||
|
||
### Product scope | ||
### Target user profile | ||
|
||
{Describe the target user profile} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
@startuml | ||
title AddCommand Sequence Diagram | ||
|
||
participant User | ||
participant AddCommand | ||
participant uiCommand | ||
participant Internship | ||
participant InternshipList | ||
|
||
|
||
User->AddCommand:execute(args) | ||
activate AddCommand #red | ||
AddCommand-->uiCommand:clearInvalidFlags() | ||
activate uiCommand #green | ||
AddCommand->AddCommand : Initialize variables | ||
|
||
loop for each arg in args | ||
AddCommand -> AddCommand : split arg into flag and data | ||
alt flag == "role" | ||
AddCommand -> AddCommand: hasRole = true | ||
alt data is present | ||
AddCommand-> AddCommand: set role | ||
else | ||
AddCommand -> uiCommand: addInvalidFlag("role") | ||
end | ||
else flag -- "company" | ||
AddCommand -> AddCommand: hasCompany = true | ||
alt data is present | ||
AddCommand->AddCommand: set company | ||
else | ||
AddCommand->uiCommand: addInvalidFlag("company") | ||
end | ||
else flag == "from" | ||
alt data is present | ||
AddCommand -> AddCommand: set startDate | ||
else | ||
AddCommand -> uiCommand: addInvalidFlag("from") | ||
end | ||
else flag == "to" | ||
alt data is present | ||
AddCommand -> AddCommand: set endDate | ||
else | ||
AddCommand -> uiCommand: addInvalidFlag("to") | ||
end | ||
else | ||
AddCommand -> uiCommand: addInvalidFlag(flag) | ||
end | ||
end | ||
|
||
alt invalid flags found | ||
AddCommand->uiCommand: printInvalidFlags() | ||
else all required flags present | ||
AddCommand -> Internship: new Internship(role, company, startDate, endDate) | ||
activate Internship #blue | ||
AddCommand-> InternshipList: addInternship(newInternship) | ||
activate InternshipList #aquamarine | ||
deactivate Internship | ||
deactivate InternshipList | ||
AddCommand -> uiCommand: showEditedInternship(newInternship, "add") | ||
deactivate uiCommand | ||
end | ||
|
||
@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.
Consider adding an architecture diagram