diff --git a/build.gradle b/build.gradle index 4a321a95139..359649c38dc 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ plugins { id 'jacoco' } -mainClassName = 'seedu.address.Main' +mainClassName = 'housekeeping.hub.Main' sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 @@ -74,8 +74,8 @@ run { } shadowJar { - archiveBaseName = "HouseKeepingHub" - archiveVersion = "v1.3.0" + archiveBaseName = "HousekeepingHub" + archiveVersion = "v1.3.1" archiveClassifier = null } diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index f0669e93265..aa19182a14f 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -9,7 +9,8 @@ title: Developer Guide ## **Acknowledgements** -* {list here sources of all reused/adapted ideas, code, documentation, and third-party libraries -- include links to the original source as well} +* Our project is forked from [AddressBook-Level3](https://github.com/nus-cs2103-AY2324S2/tp) +* Libraries used: [JavaFX](https://openjfx.io/), [Jackson](https://github.com/FasterXML/jackson), [JUnit5](https://github.com/junit-team/junit5) -------------------------------------------------------------------------------------------------------------------- @@ -36,7 +37,7 @@ Given below is a quick overview of main components and how they interact with ea **Main components of the architecture** -**`Main`** (consisting of classes [`Main`](https://github.com/se-edu/addressbook-level3/tree/master/src/main/java/seedu/address/Main.java) and [`MainApp`](https://github.com/se-edu/addressbook-level3/tree/master/src/main/java/seedu/address/MainApp.java)) is in charge of the app launch and shut down. +**`Main`** (consisting of classes [`Main`](https://github.com/AY2324S2-CS2103T-W09-1/tp/blob/master/src/main/java/housekeeping/hub/Main.java) and [`MainApp`](https://github.com/AY2324S2-CS2103T-W09-1/tp/blob/master/src/main/java/housekeeping/hub/MainApp.java)) is in charge of the app launch and shut down. * At app launch, it initializes the other components in the correct sequence, and connects them up with each other. * At shut down, it shuts down the other components and invokes cleanup methods where necessary. @@ -68,13 +69,13 @@ The sections below give more details of each component. ### UI component -The **API** of this component is specified in [`Ui.java`](https://github.com/se-edu/addressbook-level3/tree/master/src/main/java/seedu/address/ui/Ui.java) +The **API** of this component is specified in [`Ui.java`](https://github.com/AY2324S2-CS2103T-W09-1/tp/blob/master/src/main/java/housekeeping/hub/ui/Ui.java) ![Structure of the UI Component](images/UiClassDiagram.png) The UI consists of a `MainWindow` that is made up of parts e.g.`CommandBox`, `ResultDisplay`, `PersonListPanel`, `StatusBarFooter` etc. All these, including the `MainWindow`, inherit from the abstract `UiPart` class which captures the commonalities between classes that represent parts of the visible GUI. -The `UI` component uses the JavaFx UI framework. The layout of these UI parts are defined in matching `.fxml` files that are in the `src/main/resources/view` folder. For example, the layout of the [`MainWindow`](https://github.com/se-edu/addressbook-level3/tree/master/src/main/java/seedu/address/ui/MainWindow.java) is specified in [`MainWindow.fxml`](https://github.com/se-edu/addressbook-level3/tree/master/src/main/resources/view/MainWindow.fxml) +The `UI` component uses the JavaFx UI framework. The layout of these UI parts are defined in matching `.fxml` files that are in the `src/main/resources/view` folder. For example, the layout of the [`MainWindow`](https://github.com/AY2324S2-CS2103T-W09-1/tp/blob/master/src/main/java/housekeeping/hub/ui/MainWindow.java) is specified in [`MainWindow.fxml`](https://github.com/AY2324S2-CS2103T-W09-1/tp/blob/master/src/main/resources/view/MainWindow.fxml) The `UI` component, @@ -85,7 +86,7 @@ The `UI` component, ### Logic component -**API** : [`Logic.java`](https://github.com/se-edu/addressbook-level3/tree/master/src/main/java/seedu/address/logic/Logic.java) +**API** : [`Logic.java`](https://github.com/AY2324S2-CS2103T-W09-1/tp/blob/master/src/main/java/housekeeping/hub/logic/Logic.java) Here's a (partial) class diagram of the `Logic` component: @@ -120,7 +121,7 @@ How the parsing works: * 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. ### Model component -**API** : [`Model.java`](https://github.com/se-edu/addressbook-level3/tree/master/src/main/java/seedu/address/model/Model.java) +**API** : [`Model.java`](https://github.com/AY2324S2-CS2103T-W09-1/tp/blob/master/src/main/java/housekeeping/hub/model/Model.java) @@ -141,7 +142,7 @@ The `Model` component, ### Storage component -**API** : [`Storage.java`](https://github.com/se-edu/addressbook-level3/tree/master/src/main/java/seedu/address/storage/Storage.java) +**API** : [`Storage.java`](https://github.com/AY2324S2-CS2103T-W09-1/tp/blob/master/src/main/java/housekeeping/hub/storage/Storage.java) @@ -152,7 +153,7 @@ The `Storage` component, ### Common classes -Classes used by multiple components are in the `seedu.addressbook.commons` package. +Classes used by multiple components are in the `housekeeping.hub.commons` package. -------------------------------------------------------------------------------------------------------------------- @@ -160,101 +161,67 @@ Classes used by multiple components are in the `seedu.addressbook.commons` packa This section describes some noteworthy details on how certain features are implemented. -### \[Proposed\] Undo/redo feature - -#### Proposed Implementation - -The proposed undo/redo mechanism is facilitated by `VersionedAddressBook`. It extends `AddressBook` with an undo/redo history, stored internally as an `addressBookStateList` and `currentStatePointer`. Additionally, it implements the following operations: - -* `VersionedAddressBook#commit()` — Saves the current address book state in its history. -* `VersionedAddressBook#undo()` — Restores the previous address book state from its history. -* `VersionedAddressBook#redo()` — Restores a previously undone address book state from its history. - -These operations are exposed in the `Model` interface as `Model#commitAddressBook()`, `Model#undoAddressBook()` and `Model#redoAddressBook()` respectively. - -Given below is an example usage scenario and how the undo/redo mechanism behaves at each step. - -Step 1. The user launches the application for the first time. The `VersionedAddressBook` will be initialized with the initial address book state, and the `currentStatePointer` pointing to that single address book state. - -![UndoRedoState0](images/UndoRedoState0.png) - -Step 2. The user executes `delete 5` command to delete the 5th person in the address book. The `delete` command calls `Model#commitAddressBook()`, causing the modified state of the address book after the `delete 5` command executes to be saved in the `addressBookStateList`, and the `currentStatePointer` is shifted to the newly inserted address book state. - -![UndoRedoState1](images/UndoRedoState1.png) - -Step 3. The user executes `add n/David …​` to add a new person. The `add` command also calls `Model#commitAddressBook()`, causing another modified address book state to be saved into the `addressBookStateList`. - -![UndoRedoState2](images/UndoRedoState2.png) - -
:information_source: **Note:** If a command fails its execution, it will not call `Model#commitAddressBook()`, so the address book state will not be saved into the `addressBookStateList`. - -
- -Step 4. The user now decides that adding the person was a mistake, and decides to undo that action by executing the `undo` command. The `undo` command will call `Model#undoAddressBook()`, which will shift the `currentStatePointer` once to the left, pointing it to the previous address book state, and restores the address book to that state. - -![UndoRedoState3](images/UndoRedoState3.png) - -
:information_source: **Note:** If the `currentStatePointer` is at index 0, pointing to the initial AddressBook state, then there are no previous AddressBook states to restore. The `undo` command uses `Model#canUndoAddressBook()` to check if this is the case. If so, it will return an error to the user rather -than attempting to perform the undo. - -
- -The following sequence diagram shows how an undo operation goes through the `Logic` component: +### \[Completed\] Generating leads for housekeeping services -![UndoSequenceDiagram](images/UndoSequenceDiagram-Logic.png) - -
:information_source: **Note:** The lifeline for `UndoCommand` should end at the destroy marker (X) but due to a limitation of PlantUML, the lifeline reaches the end of diagram. - -
- -Similarly, how an undo operation goes through the `Model` component is shown below: - -![UndoSequenceDiagram](images/UndoSequenceDiagram-Model.png) - -The `redo` command does the opposite — it calls `Model#redoAddressBook()`, which shifts the `currentStatePointer` once to the right, pointing to the previously undone state, and restores the address book to that state. +In an admin operator's job there is a use case where they need to sort the clients by the predicted next cleaning date. +This is useful for the operator to remind the clients to book their next service soon. We have stored this housekeeping information +in `HousekeepingDetails` which also supports some other use cases such as the client does not want to be called or would +prefer to be called on a later date. -
:information_source: **Note:** If the `currentStatePointer` is at index `addressBookStateList.size() - 1`, pointing to the latest address book state, then there are no undone AddressBook states to restore. The `redo` command uses `Model#canRedoAddressBook()` to check if this is the case. If so, it will return an error to the user rather than attempting to perform the redo. +#### How it is implemented +We assume clients who do not have `HousekeepingDetails` do not want to be disturbed by the housekeeping company. +Therefore, the client list should be first filtered by `Client.hasHousekeepingDetais()` then sorted by `HousekeepingDetails`. +We will also not show clients who have their predicted next housekeeping date that is after the current date. -
+To do the sorting, the `Client` class now implements `Comparable` interface, and the `compareTo()` method is +overridden to compare the `HousekeepingDetails` of two clients. +The `compareTo()` method calls the `HousekeepingDetails`'s `compareTo()` method to if both clients have `HousekeepingDetails`. +The `compareTo()` method in `HousekeepingDetails` uses the `getNextHousekeepingDate()` method which is calculated by +`lastHousekeepingDate.plus(preferredInterval)`. -Step 5. The user then decides to execute the command `list`. Commands that do not modify the address book, such as `list`, will usually not call `Model#commitAddressBook()`, `Model#undoAddressBook()` or `Model#redoAddressBook()`. Thus, the `addressBookStateList` remains unchanged. +`ClientComprator` is then used by `FXCollections.sort()` to sort the list of clients. `ClientComparator` compares `Client`s +using their `compareTo()` method. -![UndoRedoState4](images/UndoRedoState4.png) +We will also store `bookingDate` if the `Client` already made a booking. This is convenient for the admin to know and prevent +calling the client when it is not needed. Furthermore, `deferment` is also stored to know if the client wants to defer the +reminder to a later date. -Step 6. The user executes `clear`, which calls `Model#commitAddressBook()`. Since the `currentStatePointer` is not pointing at the end of the `addressBookStateList`, all address book states after the `currentStatePointer` will be purged. Reason: It no longer makes sense to redo the `add n/David …​` command. This is the behavior that most modern desktop applications follow. +Here is how `HousekeepingDetails` class looks like:

+![HousekeepingDetailsClassDiagram](images/HousekeepingDetailsClassDiagram.png) -![UndoRedoState5](images/UndoRedoState5.png) +#### Why is it implemented this way +There are many considerations in the workflow of generating leads for housekeeping services. The proposed implementation +is chosen because it is able to handle a wide range of scenarios that we have considered. For example, `lastHousekeepingDate` +and `preferredInterval` are used to calculate the `nextHousekeepingDate`. This is for the convenience of the client as they +will only need to state their preference only once (when booking their first service). +`preferredInterval` is a natural aspect of housekeeping services and the client should know this at the top of their head +instead of concrete dates. -The following activity diagram summarizes what happens when a user executes a new command: +Having a `deferment` attribute is also important as it allows the client to defer the reminder to a later date. This is for +client satisfaction as it might not be a good time for housekeeping services when we call to remind them. - +#### Alternatives considered -#### Design considerations: +##### Alternative 1 +Only store `nexthousekeepingDate` and only call to ask the client on the housekeeping date. `nextHousekeepingDate` is maintained by asking the client everytime they have done a housekeeping service. -**Aspect: How undo & redo executes:** +Pros: Very simple to implement. -* **Alternative 1 (current choice):** Saves the entire address book. - * Pros: Easy to implement. - * Cons: May have performance issues in terms of memory usage. +Cons: [1] It adds more work for the admin but more importantly the client. This is because an additional call is required after every service. +[2] The client may not know an exact date far into the future. If the client is unsure and provide a general period, then we can save the work +of calling everytime by using `preferredInterval` as in our proposed implementation. [3] If the admin is sick or busy on `nextHousekeepingDate`, +then the call will be missed altogether. -* **Alternative 2:** Individual command knows how to undo/redo by - itself. - * Pros: Will use less memory (e.g. for `delete`, just save the person being deleted). - * Cons: We must ensure that the implementation of each individual command are correct. +##### Alternative 2 +Same as our original implementation but without `deferment`. -_{more aspects and alternatives to be added}_ +Pros: Simpler implementation, less commands for admin to learn. -### \[Proposed\] Sorting cleints by predicted next cleaning date +Cons: [1] Less flexible for the client. The client may not be ready for housekeeping services when we call to remind them. +[2] It is possible to deal with this as an admin, but it would be "hacky" as the admin would have to edit the `lastHousekeepingDate`. -#### Proposed Implementation -We assume clients who do not have `HousekeepingDetails` do not want to be disturbed by the housekeeping company. -Therefore, the client list should be first filtered by `Client.hasHousekeepingDetais()` then sorted by `HousekeepingDetails`. -To do the sorting, the `Client` class now implements `Comparable` interface, and the `compareTo()` method is -overridden to compare the `HousekeepingDetails` of two clients. -The `compareTo()` method calls the `HousekeepingDetails`'s `compareTo()` method to if both clients have `HousekeepingDetails`. -The `compareTo()` method in `HousekeepingDetails` uses the `getNextHousekeepingDate()` method which is calculated by -`lastHousekeepingDate.plus(preferredInterval)`. +A `ClientComparator` is made using the `compareTo()` is then used by `FXCollections.sort()` to sort the list of clients. ### \[Completed\] Find using multiple attributes @@ -278,6 +245,7 @@ Here is how the activity diagram looks like: #### Why is it implemented this way + The current implementation was chosen because it can handle multiple attributes at the same time. The other alternatives we considered can only handle one attribute at the same time or ineffective to makes it able to handle multiple attributes at the same time (needs multiple predicate and if-else statement consist of 9 conditions). Therefore, we @@ -351,6 +319,89 @@ Introducing a new attribute, "Type", within the `DeleteCommand` class may effect however, it also brings the drawback of potentially increasing the number of conditional statements, which could degrade readability and maintainability. Moreover, the internal nature of the "Type" attribute might obscure its purpose to developers, leading to confusion. + +### \[Proposed\] Undo/redo feature + +#### Proposed Implementation + +The proposed undo/redo mechanism is facilitated by `VersionedAddressBook`. It extends `AddressBook` with an undo/redo history, stored internally as an `addressBookStateList` and `currentStatePointer`. Additionally, it implements the following operations: + +* `VersionedAddressBook#commit()` — Saves the current address book state in its history. +* `VersionedAddressBook#undo()` — Restores the previous address book state from its history. +* `VersionedAddressBook#redo()` — Restores a previously undone address book state from its history. + +These operations are exposed in the `Model` interface as `Model#commitAddressBook()`, `Model#undoAddressBook()` and `Model#redoAddressBook()` respectively. + +Given below is an example usage scenario and how the undo/redo mechanism behaves at each step. + +Step 1. The user launches the application for the first time. The `VersionedAddressBook` will be initialized with the initial address book state, and the `currentStatePointer` pointing to that single address book state. + +![UndoRedoState0](images/UndoRedoState0.png) + +Step 2. The user executes `delete 5` command to delete the 5th person in the address book. The `delete` command calls `Model#commitAddressBook()`, causing the modified state of the address book after the `delete 5` command executes to be saved in the `addressBookStateList`, and the `currentStatePointer` is shifted to the newly inserted address book state. + +![UndoRedoState1](images/UndoRedoState1.png) + +Step 3. The user executes `add n/David …​` to add a new person. The `add` command also calls `Model#commitAddressBook()`, causing another modified address book state to be saved into the `addressBookStateList`. + +![UndoRedoState2](images/UndoRedoState2.png) + +
:information_source: **Note:** If a command fails its execution, it will not call `Model#commitAddressBook()`, so the address book state will not be saved into the `addressBookStateList`. + +
+ +Step 4. The user now decides that adding the person was a mistake, and decides to undo that action by executing the `undo` command. The `undo` command will call `Model#undoAddressBook()`, which will shift the `currentStatePointer` once to the left, pointing it to the previous address book state, and restores the address book to that state. + +![UndoRedoState3](images/UndoRedoState3.png) + +
:information_source: **Note:** If the `currentStatePointer` is at index 0, pointing to the initial AddressBook state, then there are no previous AddressBook states to restore. The `undo` command uses `Model#canUndoAddressBook()` to check if this is the case. If so, it will return an error to the user rather +than attempting to perform the undo. + +
+ +The following sequence diagram shows how an undo operation goes through the `Logic` component: + +![UndoSequenceDiagram](images/UndoSequenceDiagram-Logic.png) + +
:information_source: **Note:** The lifeline for `UndoCommand` should end at the destroy marker (X) but due to a limitation of PlantUML, the lifeline reaches the end of diagram. + +
+ +Similarly, how an undo operation goes through the `Model` component is shown below: + +![UndoSequenceDiagram](images/UndoSequenceDiagram-Model.png) + +The `redo` command does the opposite — it calls `Model#redoAddressBook()`, which shifts the `currentStatePointer` once to the right, pointing to the previously undone state, and restores the address book to that state. + +
:information_source: **Note:** If the `currentStatePointer` is at index `addressBookStateList.size() - 1`, pointing to the latest address book state, then there are no undone AddressBook states to restore. The `redo` command uses `Model#canRedoAddressBook()` to check if this is the case. If so, it will return an error to the user rather than attempting to perform the redo. + +
+ +Step 5. The user then decides to execute the command `list`. Commands that do not modify the address book, such as `list`, will usually not call `Model#commitAddressBook()`, `Model#undoAddressBook()` or `Model#redoAddressBook()`. Thus, the `addressBookStateList` remains unchanged. + +![UndoRedoState4](images/UndoRedoState4.png) + +Step 6. The user executes `clear`, which calls `Model#commitAddressBook()`. Since the `currentStatePointer` is not pointing at the end of the `addressBookStateList`, all address book states after the `currentStatePointer` will be purged. Reason: It no longer makes sense to redo the `add n/David …​` command. This is the behavior that most modern desktop applications follow. + +![UndoRedoState5](images/UndoRedoState5.png) + +The following activity diagram summarizes what happens when a user executes a new command: + + + +#### Design considerations: + +**Aspect: How undo & redo executes:** + +* **Alternative 1 (current choice):** Saves the entire address book. + * Pros: Easy to implement. + * Cons: May have performance issues in terms of memory usage. + +* **Alternative 2:** Individual command knows how to undo/redo by + itself. + * Pros: Will use less memory (e.g. for `delete`, just save the person being deleted). + * Cons: We must ensure that the implementation of each individual command are correct. + -------------------------------------------------------------------------------------------------------------------- ## **Documentation, logging, testing, configuration, dev-ops** @@ -566,7 +617,6 @@ Preconditions: Operator is logged in. 7. Will not use a DataBase Management System e.g., MySQL, and PostgreSQL to store data. And hence, will use flat file as a storage. 8. Should be portable (able to work without requiring an installer). 9. Should not use or depend on a remote server. -*{More to be added}* ### Glossary @@ -600,29 +650,28 @@ testers are expected to do more *exploratory* testing. 1. Re-launch the app by double-clicking the jar file.
Expected: The most recent window size and location is retained. -1. _{ more test cases …​ }_ ### Deleting a person -1. Deleting a person while all persons are being shown +1. Deleting a person while all clients/housekeepers are being shown - 1. Prerequisites: List all persons using the `list` command. Multiple persons in the list. + 1. Prerequisites: List all persons using the `list client` or `list housekeeper` command. Multiple persons in the list. - 1. Test case: `delete 1`
+ 1. Test case: `delete client 1` or `delete housekeeper 1`
Expected: First contact is deleted from the list. Details of the deleted contact shown in the status message. Timestamp in the status bar is updated. - 1. Test case: `delete 0`
+ 1. Test case: `delete client 0` or `delete housekeeper 0`
Expected: No person is deleted. Error details shown in the status message. Status bar remains the same. - 1. Other incorrect delete commands to try: `delete`, `delete x`, `...` (where x is larger than the list size)
+ 1. Other incorrect delete commands to try: `delete`, `delete x`, `delete housekeeper y`, `...` (where x is not a valid type and y is larger than the list size)
Expected: Similar to previous. -1. _{ more test cases …​ }_ ### Saving data 1. Dealing with missing/corrupted data files - 1. _{explain how to simulate a missing/corrupted file, and the expected behavior}_ + 1. To simulate this, delete the data file `addressbook.json` or make it unreadable. + 2. If you want to refresh the data file, you can delete `addressbook.json` and restart the app. + 3. If you want to recover the data, study the `addressbook.json` file format and manually edit it. -1. _{ more test cases …​ }_ diff --git a/docs/SettingUp.md b/docs/SettingUp.md index 275445bd551..82ce1170a82 100644 --- a/docs/SettingUp.md +++ b/docs/SettingUp.md @@ -23,7 +23,7 @@ If you plan to use Intellij IDEA (highly recommended): 1. **Import the project as a Gradle project**: Follow the guide [_[se-edu/guides] IDEA: Importing a Gradle project_](https://se-education.org/guides/tutorials/intellijImportGradleProject.html) to import the project into IDEA.
:exclamation: Note: Importing a Gradle project is slightly different from importing a normal Java project. 1. **Verify the setup**: - 1. Run the `seedu.address.Main` and try a few commands. + 1. Run the `housekeeping.hub.Main` and try a few commands. 1. [Run the tests](Testing.md) to ensure they all pass. -------------------------------------------------------------------------------------------------------------------- diff --git a/docs/Testing.md b/docs/Testing.md index 8a99e82438a..15ef9a3df16 100644 --- a/docs/Testing.md +++ b/docs/Testing.md @@ -29,8 +29,8 @@ There are two ways to run tests. This project has three types of tests: 1. *Unit tests* targeting the lowest level methods/classes.
- e.g. `seedu.address.commons.StringUtilTest` + e.g. `housekeeping.hub.commons.StringUtilTest` 1. *Integration tests* that are checking the integration of multiple code units (those code units are assumed to be working).
- e.g. `seedu.address.storage.StorageManagerTest` + e.g. `housekeeping.hub.storage.StorageManagerTest` 1. Hybrids of unit and integration tests. These test are checking multiple code units as well as how the are connected together.
- e.g. `seedu.address.logic.LogicManagerTest` + e.g. `housekeeping.hub.logic.LogicManagerTest` diff --git a/docs/UserGuide.md b/docs/UserGuide.md index eba56df3673..83e053a8a56 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -3,11 +3,11 @@ layout: page title: Housekeeping Hub User Guide --- -Welcome to HouseKeeping Hub, the premier **desktop solution for managing client and housekeeper contacts**. +Welcome to Housekeeping Hub, the premier **desktop solution for managing client and housekeeper contacts**. Combining the **efficiency of a Command Line Interface ([CLI](#cli)) with the convenience of a Graphical User Interface ([GUI](#gui))**, -HouseKeeping Hub offers unparalleled speed and ease of use. Whether you're a typist or a clicker, -HouseKeeping Hub ensures swift completion of all your contact management tasks. -Bid farewell to the sluggishness of traditional GUI apps - with HouseKeeping Hub, managing your contacts has never been faster or simpler. +Housekeeping Hub offers unparalleled speed and ease of use for housekeeping admin. Whether you're a typist or a clicker, +Housekeeping Hub ensures swift completion of all your contact management tasks. +Bid farewell to the sluggishness of traditional GUI apps - with Housekeeping Hub, managing your contacts has never been faster or simpler. ## Table of Contents * Table of Contents @@ -65,13 +65,13 @@ There will be [:arrow_up_small:](#table-of-contents) links, which you can click 1. Ensure you have Java `11` or above installed in your Computer. -1. Download the latest `HousekeepingHub-v1.2.0.jar` from [here](https://github.com/AY2324S2-CS2103T-W09-1/tp/releases). +1. Download the latest `HousekeepingHub-v1.3.1.jar` from [here](https://github.com/AY2324S2-CS2103T-W09-1/tp/releases). -1. Copy the file to the folder you want to use as the _home folder_ for your HouseKeeping Hub. +1. Copy the file to the folder you want to use as the _home folder_ for your Housekeeping Hub. 1. Open a [command terminal](#terminal), and type in `cd` to navigate into the folder you placed the [jar](#jar) file in. -1. Type in `java -jar HousekeepingHub-v1.2.0.jar` to run the application.
+1. Type in `java -jar HousekeepingHub-v1.3.1.jar` to run the application.
A GUI similar to the below should appear in a few seconds. Note how the app contains some sample data.
![Ui](./images/Ui.png) @@ -88,9 +88,9 @@ There will be [:arrow_up_small:](#table-of-contents) links, which you can click * `list client` : Lists all client contacts. - * `add housekeeper n/John Doe p/98765432 e/johnd@example.com a/John street, block 123, #01-01` : Adds a housekeeper named `John Doe`. + * `add housekeeper n/John Doe p/98765432 e/johnd@example.com a/John street, block 123, #01-01 ar/west` : Adds a housekeeper named `John Doe`. - * `delete 3` : Deletes the 3rd contact shown in the last shown list. + * `delete client 3` : Deletes the 3rd contact shown in the last shown list. * `clear` : Deletes all contacts. @@ -112,6 +112,9 @@ There will be [:arrow_up_small:](#table-of-contents) links, which you can click * Words in `UPPER_CASE` are the parameters to be supplied by the user.
e.g. in `add n/NAME`, `NAME` is a parameter which can be used as `add n/John Doe`. +* `NAME` is case-sensitive and character-sensitive.
+ e.g. `John Doe` and `john doe` is different person (not considered as duplicate). + * Items in square brackets are optional.
e.g `n/NAME [t/TAG]` can be used as `n/John Doe t/friend` or as `n/John Doe`. @@ -147,7 +150,7 @@ Format: `help` Adds a client or housekeeper to Housekeeping Hub. -Format: `add TYPE n/NAME e/EMAIL p/PHONE_NUMBER a/ADDRESS [d/DETAILS] [ar/AREA] [t/TAG]…​` +Format: `add TYPE n/NAME e/EMAIL p/PHONE_NUMBER a/ADDRESS ar/AREA [d/DETAILS] [t/TAG]…​` Notes: * `TYPE` can be either 'client' or 'housekeeper'. @@ -193,7 +196,7 @@ Example: ### Deleting a person : `delete` -Deletes the specified client or housekeeper from the address book. +Deletes the specified client or housekeeper from Housekeeping Hub. Format: `delete TYPE INDEX` @@ -218,14 +221,11 @@ Examples: Edits an existing person in the address book. -Format: `edit TYPE INDEX [n/NAME] [p/PHONE] [e/EMAIL] [a/ADDRESS] [d/DETAILS] [ar/AREA] [t/TAG]…​` +Format: `edit TYPE INDEX [n/NAME] [p/PHONE] [e/EMAIL] [a/ADDRESS] [ar/AREA] [t/TAG]…​` Notes: * `TYPE` can be either 'client' or 'housekeeper'. * `AREA` can be either 'east', 'southeast', 'south', 'southwest', 'west', 'northwest', 'north', or 'northeast'. -* `DETAILS` is optional and refers to the housekeeping details for CLIENT ONLY. It is not applicable for housekeepers. - The format for `DETAILS` is `d/yyyy-MM-dd NUMBER INTERVAL` where `yyyy-MM-dd` is the date of the last - housekeeping, `NUMBER` is the quantity of `INTERVAL`(s) which can be ***'days', 'weeks', 'months' or 'years'.*** * Edits the person at the specified `INDEX`. The index refers to the index number shown in the displayed person list. The index **must be a positive integer** 1, 2, 3, …​ * At least one of the optional fields must be provided. * Existing values will be updated to the input values. @@ -265,7 +265,8 @@ Examples: ### Getting client call list: `leads` -Sorts the clients based on the predicted next time of housekeeping. +Generates a list of leads by sorting the clients based on the predicted next time of housekeeping. +Clients with predicted next housekeeping date which is in the future will not be included. Format: `leads` @@ -299,15 +300,59 @@ If clients do not have housekeeping details, they are assumed to not want notifi *** [1] and [2] are mandatory while [3] and [4] are optional. ([4] deferment will be set to 0 by default) -We have 7 commands for updating client's housekeeping details. `last`, `interval`, `defer`, `add`, `delete`, `set`, and `remove`. -Without a housekeeping detail, `last`, `interval`, `defer`, `add`, `delete` will not work. To set housekeeping detail after initiation, use `set`. +We have 6 commands for updating client's housekeeping details. `edit`, `defer`, `add`, `delete`, `set`, and `remove`. +Without a housekeeping detail, `edit`, `defer`, `add`, `delete` will not work. To set housekeeping detail after initiation, use `set`. +`edit` has prefixes `lhd/`, `pi/`, `bd/` and `d/` to edit last housekeeping date, preferred interval, booking date and deferment respectively. +More than one prefix can be used in a single `edit` command. + +-------------------------------------------------------------------------------------------------------------------- + +###### Deleting booking date: `booking client delete` + +Deletes the specified client's booking date from Housekeeping Hub. + +Format: `booking client delete INDEX` + +
:bulb: **Tip:** +The index to delete will work for any displayed list. i.e. What you see is what you get. +
+ +Examples: +* `booking client delete 3` deletes the client number 3 booking date +* `booking client delete 1` deletes the client number 1 booking date
+ +[:arrow_up_small:](#table-of-contents) + +-------------------------------------------------------------------------------------------------------------------- + + +###### Removing housekeeping details: `booking client remove` + +Removes/deletes the specified client's housekeeping details (including 'last housekeeping date', 'preferred interval', +'booking date', and 'deferment') from Housekeeping Hub. + +Format: `booking client remove INDEX` + +
:bulb: **Tip:** +The index to delete will work for any displayed list. i.e. What you see is what you get. +
+ +Examples: +* `booking client remove 3` removes the client number 3 housekeeping details +* `booking client remove 1` removes the client number 1 housekeeping details
+ +[:arrow_up_small:](#table-of-contents) + +-------------------------------------------------------------------------------------------------------------------- + + Action | Format, Explainations, Examples --------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- `edit lhd/` | Edit client's last housekeeping date with `edit lhd/`
Format: `booking client edit INDEX lhd/yyyy-MM-dd`
Example: `booking client edit 2 lhd/2024-04-01` `edit pi/` | Edit client's preferred interval with `edit pi/`
Format: `booking client edit INDEX pi/NUMBER INTERVAL`
Example: `booking client edit 2 pi/2 weeks` `edit bd/` | Edit client's booking date with `edit bd/`
Format: `booking client edit INDEX bd/BOOKING DATE`
Example: `booking client edit 2 bd/2024-04-02 am` -`edit d/` | Edit client's preferred interval with `edit pi/`
Format: `booking client edit INDEX d/NUMBER INTERVAL`
Example: `booking client edit 2 d/2 months` +`edit d/` | Edit deferment with `edit d/`
Format: `booking client edit INDEX d/NUMBER INTERVAL`
Example: `booking client edit 2 d/2 months` `defer` | Add period to delay calling clients with `defer`
Format: `booking client defer INDEX NUMBER INTERVAL`
Example: `booking client defer 2 1 months` `add` | Add client's booking date with `add`
Format: `booking client add INDEX yyyy-MM-dd (am|pm)`
Example: `booking client add 2 2024-04-01 am` `delete` | Delete client's booking date with `delete`
Format: `booking client delete INDEX`
Example: `booking client delete 2` @@ -346,15 +391,19 @@ Format: `exit` ### Saving the data -HouseKeeping Hub data are saved in the hard disk automatically after any command that changes the data. There is no need to save manually. +Housekeeping Hub data are saved in the hard disk automatically after any command that changes the data. There is no need to save manually. ### Editing the data file -HouseKeeping Hub data are saved automatically as a JSON file `[JAR file location]/data/addressbook.json`. Advanced users are welcome to update data directly by editing that data file. +Housekeeping Hub data are saved automatically as a JSON file `[JAR file location]/data/addressbook.json`. Advanced users are welcome to update data directly by editing that data file. + +
:bulb: **Tip:** +If you wish to load our sample data, you must delete the existing `addressbook.json` from the stated location and restart the app. +
:exclamation: **Caution:** -If your changes to the data file makes its format invalid, HouseKeeping Hub will discard all data and start with an empty data file at the next run. Hence, it is recommended to take a backup of the file before editing it.
-Furthermore, certain edits can cause the HouseKeeping Hub to behave in unexpected ways (e.g., if a value entered is outside of the acceptable range). Therefore, edit the data file only if you are confident that you can update it correctly. +If your changes to the data file makes its format invalid, Housekeeping Hub will discard all data and start with an empty data file at the next run. Hence, it is recommended to take a backup of the file before editing it.
+Furthermore, certain edits can cause the Housekeeping Hub to behave in unexpected ways (e.g., if a value entered is outside of the acceptable range). Therefore, edit the data file only if you are confident that you can update it correctly.
[:arrow_up_small:](#table-of-contents) @@ -365,7 +414,7 @@ Furthermore, certain edits can cause the HouseKeeping Hub to behave in unexpecte **Q**: How do I transfer my data to another Computer?
-**A**: Install the app in the other computer and overwrite the empty data file it creates with the file that contains the data of your previous HouseKeeping Hub home folder. +**A**: Install the app in the other computer and overwrite the empty data file it creates with the file that contains the data of your previous Housekeeping Hub home folder. [:arrow_up_small:](#table-of-contents) @@ -379,8 +428,8 @@ Action | Format, Examples [**Add**](#adding-a-person-add) | `add TYPE n/NAME e/EMAIL p/PHONE_NUMBER a/ADDRESS [d/DETAILS] [ar/AREA] [t/TAG]…​`
e.g., `add client n/Elon e/elon@gmail.com p/088888888 a/Elon Street, Block 123, 101010 Singapore ar/west` [**Delete**](#deleting-a-person--delete) | `delete TYPE INDEX`
e.g., `delete housekeeper 3` [**List**](#listing-all-persons--list) | `list TYPE`
e.g., `list client` -[**EDIT**](#editing-a-person--edit) | `edit TYPE INDEX [n/NAME] [p/PHONE] [e/EMAIL] [a/ADDRESS] [d/DETAILS] [ar/AREA] [t/TAG]…​`
e.g., `edit client 1 p/91234567 e/johndoe@example.com` -[**FIND**](#locating-persons-by-keywords--find) | `find TYPE n/KEYWORD [MORE_KEYWORDS] ar/KEYWORD [MORE_KEYWORDS] a/KEYWORD [MORE_KEYWORDS]`
e.g., `find client n/John` +[**Edit**](#editing-a-person--edit) | `edit TYPE INDEX [n/NAME] [p/PHONE] [e/EMAIL] [a/ADDRESS] [d/DETAILS] [ar/AREA] [t/TAG]…​`
e.g., `edit client 1 p/91234567 e/johndoe@example.com` +[**Find**](#locating-persons-by-keywords--find) | `find TYPE n/KEYWORD [MORE_KEYWORDS] ar/KEYWORD [MORE_KEYWORDS] a/KEYWORD [MORE_KEYWORDS]`
e.g., `find client n/John` [**Leads**](#getting-client-call-list-leads) | `leads` [**Booking**](#booking-commands-booking) | `booking TYPE ACTION INDEX [PARAMETERS]`
e.g., `booking client last 2 2024-04-01`
* This has many commands and it is recommended to refer to the [Booking commands](#booking-commands-booking) section for more details. [**Clear**](#clearing-all-entries--clear) | `clear` @@ -395,27 +444,35 @@ Action | Format, Examples **JAR** -: JAR stands for Java Archive. It is based on the ZIP file format that is commonly used to store java programs. +: JAR stands for Java Archive. It is based on the ZIP file format that is commonly used to store java programs.
+ +
**CLI** : CLI stands for Command Line Interface. It refers to programs that are primarily **text-based** where users interact with the program by typing **commands**. -As such, users will use their keyboards more, in contrast to a Graphical User Interface (GUI) where users will use their mouse to interact with the graphical elements. +As such, users will use their keyboards more, in contrast to a Graphical User Interface (GUI) where users will use their mouse to interact with the graphical elements.
+ +
**GUI** -: GUI stands for Graphical User Interface. It refers to programs that are primarily **graphical** where users interact with the program by clicking on **buttons** and **menus**. +: GUI stands for Graphical User Interface. It refers to programs that are primarily **graphical** where users interact with the program by clicking on **buttons** and **menus**.
+ +
**Terminal** : A terminal is a Command Line Interface (CLI) that allows users to interact with computers by executing commands and viewing the results. Popular terminals in mainstream operating systems include command prompt (CMD) for windows and Terminal in macOS and Linux.
-**CMD**
+
+ +**CMD**

drawing -
**Terminal (macOS)**
+

**Terminal (macOS)**

drawing -
**Terminal (Linux)**
+

**Terminal (Linux)**

drawing -[:arrow_up_small:](#table-of-contents) \ No newline at end of file +[:arrow_up_small:](#table-of-contents) diff --git a/docs/diagrams/HousekeepingDetailsClassDiagram.puml b/docs/diagrams/HousekeepingDetailsClassDiagram.puml new file mode 100644 index 00000000000..96de6892f8b --- /dev/null +++ b/docs/diagrams/HousekeepingDetailsClassDiagram.puml @@ -0,0 +1,25 @@ +@startuml +!include style.puml +skinparam arrowThickness 1.1 +skinparam arrowColor MODEL_COLOR +skinparam classBackgroundColor MODEL_COLOR + +package "Details" { +Class HousekeepingDetails +Class Period +Class LocalDate +Class Booking +} + +Client *--> HousekeepingDetails + +HousekeepingDetails *---> "preferredInterval" Period +HousekeepingDetails *---> "deferment" Period +HousekeepingDetails *---> "lastHousekeepingDate" LocalDate +HousekeepingDetails *---> "booking" Booking + +Period .[hidden].. HousekeepingDetails +LocalDate .[hidden]. HousekeepingDetails +Period .[hidden]. LocalDate + +@enduml diff --git a/docs/images/HousekeepingDetailsClassDiagram.png b/docs/images/HousekeepingDetailsClassDiagram.png new file mode 100644 index 00000000000..ea6f6a34106 Binary files /dev/null and b/docs/images/HousekeepingDetailsClassDiagram.png differ diff --git a/docs/images/Ui.png b/docs/images/Ui.png index 76334ef09e8..ab0e443add8 100644 Binary files a/docs/images/Ui.png and b/docs/images/Ui.png differ diff --git a/docs/tutorials/AddRemark.md b/docs/tutorials/AddRemark.md index d98f38982e7..8738ba3e715 100644 --- a/docs/tutorials/AddRemark.md +++ b/docs/tutorials/AddRemark.md @@ -16,16 +16,16 @@ We’ll assume that you have already set up the development environment as outli Looking in the `logic.command` package, you will notice that each existing command have their own class. All the commands inherit from the abstract class `Command` which means that they must override `execute()`. Each `Command` returns an instance of `CommandResult` upon success and `CommandResult#feedbackToUser` is printed to the `ResultDisplay`. -Let’s start by creating a new `RemarkCommand` class in the `src/main/java/seedu/address/logic/command` directory. +Let’s start by creating a new `RemarkCommand` class in the `src/main/java/housekeeping/address/logic/command` directory. For now, let’s keep `RemarkCommand` as simple as possible and print some output. We accomplish that by returning a `CommandResult` with an accompanying message. **`RemarkCommand.java`:** ``` java -package seedu.address.logic.commands; +package housekeeping.hub.logic.commands; -import seedu.address.model.Model; +import housekeeping.hub.model.Model; /** * Changes the remark of an existing person in the address book. @@ -91,7 +91,7 @@ Let’s change `RemarkCommand` to parse input from the user. We start by modifying the constructor of `RemarkCommand` to accept an `Index` and a `String`. While we are at it, let’s change the error message to echo the values. While this is not a replacement for tests, it is an obvious way to tell if our code is functioning as intended. ``` java -import static seedu.address.commons.util.CollectionUtil.requireAllNonNull; +import static housekeeping.hub.commons.util.CollectionUtil.requireAllNonNull; //... public class RemarkCommand extends Command { //... @@ -140,7 +140,7 @@ Your code should look something like [this](https://github.com/se-edu/addressboo Now let’s move on to writing a parser that will extract the index and remark from the input provided by the user. -Create a `RemarkCommandParser` class in the `seedu.address.logic.parser` package. The class must extend the `Parser` interface. +Create a `RemarkCommandParser` class in the `housekeeping.hub.logic.parser` package. The class must extend the `Parser` interface. ![The relationship between Parser and RemarkCommandParser](../images/add-remark/RemarkCommandParserClass.png) @@ -227,7 +227,7 @@ Now that we have all the information that we need, let’s lay the groundwork fo ### Add a new `Remark` class -Create a new `Remark` in `seedu.address.model.person`. Since a `Remark` is a field that is similar to `Address`, we can reuse a significant bit of code. +Create a new `Remark` in `housekeeping.hub.model.person`. Since a `Remark` is a field that is similar to `Address`, we can reuse a significant bit of code. A copy-paste and search-replace later, you should have something like [this](https://github.com/se-edu/addressbook-level3/commit/4516e099699baa9e2d51801bd26f016d812dedcc#diff-41bb13c581e280c686198251ad6cc337cd5e27032772f06ed9bf7f1440995ece). Note how `Remark` has no constrains and thus does not require input validation. @@ -240,7 +240,7 @@ Let’s change `RemarkCommand` and `RemarkCommandParser` to use the new `Remark` Without getting too deep into `fxml`, let’s go on a 5 minute adventure to get some placeholder text to show up for each person. -Simply add the following to [`seedu.address.ui.PersonCard`](https://github.com/se-edu/addressbook-level3/commit/850b78879582f38accb05dd20c245963c65ea599#diff-639834f1e05afe2276a86372adf0fe5f69314642c2d93cfa543d614ce5a76688). +Simply add the following to [`housekeeping.hub.ui.PersonCard`](https://github.com/se-edu/addressbook-level3/commit/850b78879582f38accb05dd20c245963c65ea599#diff-639834f1e05afe2276a86372adf0fe5f69314642c2d93cfa543d614ce5a76688). **`PersonCard.java`:** diff --git a/docs/tutorials/RemovingFields.md b/docs/tutorials/RemovingFields.md index f29169bc924..0c4c661b9ca 100644 --- a/docs/tutorials/RemovingFields.md +++ b/docs/tutorials/RemovingFields.md @@ -28,7 +28,7 @@ IntelliJ IDEA provides a refactoring tool that can identify *most* parts of a re ### Assisted refactoring -The `address` field in `Person` is actually an instance of the `seedu.address.model.person.Address` class. Since removing the `Address` class will break the application, we start by identifying `Address`'s usages. This allows us to see code that depends on `Address` to function properly and edit them on a case-by-case basis. Right-click the `Address` class and select `Refactor` \> `Safe Delete` through the menu. +The `address` field in `Person` is actually an instance of the `housekeeping.hub.model.person.Address` class. Since removing the `Address` class will break the application, we start by identifying `Address`'s usages. This allows us to see code that depends on `Address` to function properly and edit them on a case-by-case basis. Right-click the `Address` class and select `Refactor` \> `Safe Delete` through the menu. * :bulb: To make things simpler, you can unselect the options `Search in comments and strings` and `Search for text occurrences` ![Usages detected](../images/remove/UnsafeDelete.png) diff --git a/docs/tutorials/TracingCode.md b/docs/tutorials/TracingCode.md index 4fb62a83ef6..00e4bb22ba0 100644 --- a/docs/tutorials/TracingCode.md +++ b/docs/tutorials/TracingCode.md @@ -39,7 +39,7 @@ In our case, we would want to begin the tracing at the very point where the App -According to the sequence diagram you saw earlier (and repeated above for reference), the `UI` component yields control to the `Logic` component through a method named `execute`. Searching through the code base for an `execute()` method that belongs to the `Logic` component yields a promising candidate in `seedu.address.logic.Logic`. +According to the sequence diagram you saw earlier (and repeated above for reference), the `UI` component yields control to the `Logic` component through a method named `execute`. Searching through the code base for an `execute()` method that belongs to the `Logic` component yields a promising candidate in `housekeeping.hub.logic.Logic`. @@ -48,7 +48,7 @@ According to the sequence diagram you saw earlier (and repeated above for refere :bulb: **Intellij Tip:** The ['**Search Everywhere**' feature](https://www.jetbrains.com/help/idea/searching-everywhere.html) can be used here. In particular, the '**Find Symbol**' ('Symbol' here refers to methods, variables, classes etc.) variant of that feature is quite useful here as we are looking for a _method_ named `execute`, not simply the text `execute`. -A quick look at the `seedu.address.logic.Logic` (an extract given below) confirms that this indeed might be what we’re looking for. +A quick look at the `housekeeping.hub.logic.Logic` (an extract given below) confirms that this indeed might be what we’re looking for. ```java public interface Logic { diff --git a/src/main/java/seedu/address/AppParameters.java b/src/main/java/housekeeping/hub/AppParameters.java similarity index 91% rename from src/main/java/seedu/address/AppParameters.java rename to src/main/java/housekeeping/hub/AppParameters.java index 3d603622d4e..165d1baec12 100644 --- a/src/main/java/seedu/address/AppParameters.java +++ b/src/main/java/housekeeping/hub/AppParameters.java @@ -1,4 +1,4 @@ -package seedu.address; +package housekeeping.hub; import java.nio.file.Path; import java.nio.file.Paths; @@ -6,10 +6,10 @@ import java.util.Objects; import java.util.logging.Logger; +import housekeeping.hub.commons.core.LogsCenter; +import housekeeping.hub.commons.util.FileUtil; +import housekeeping.hub.commons.util.ToStringBuilder; import javafx.application.Application; -import seedu.address.commons.core.LogsCenter; -import seedu.address.commons.util.FileUtil; -import seedu.address.commons.util.ToStringBuilder; /** * Represents the parsed command-line parameters given to the application. diff --git a/src/main/java/seedu/address/Main.java b/src/main/java/housekeeping/hub/Main.java similarity index 95% rename from src/main/java/seedu/address/Main.java rename to src/main/java/housekeeping/hub/Main.java index ec1b7958746..63a0e25df5c 100644 --- a/src/main/java/seedu/address/Main.java +++ b/src/main/java/housekeeping/hub/Main.java @@ -1,9 +1,9 @@ -package seedu.address; +package housekeeping.hub; import java.util.logging.Logger; +import housekeeping.hub.commons.core.LogsCenter; import javafx.application.Application; -import seedu.address.commons.core.LogsCenter; /** * The main entry point to the application. diff --git a/src/main/java/seedu/address/MainApp.java b/src/main/java/housekeeping/hub/MainApp.java similarity index 81% rename from src/main/java/seedu/address/MainApp.java rename to src/main/java/housekeeping/hub/MainApp.java index 4b8262981ca..8835d6e61c7 100644 --- a/src/main/java/seedu/address/MainApp.java +++ b/src/main/java/housekeeping/hub/MainApp.java @@ -1,35 +1,35 @@ -package seedu.address; +package housekeeping.hub; import java.io.IOException; import java.nio.file.Path; import java.util.Optional; import java.util.logging.Logger; +import housekeeping.hub.commons.core.Config; +import housekeeping.hub.commons.core.LogsCenter; +import housekeeping.hub.commons.core.Version; +import housekeeping.hub.commons.exceptions.DataLoadingException; +import housekeeping.hub.commons.util.ConfigUtil; +import housekeeping.hub.commons.util.StringUtil; +import housekeeping.hub.logic.Logic; +import housekeeping.hub.logic.LogicManager; +import housekeeping.hub.model.AddressBook; +import housekeeping.hub.model.Model; +import housekeeping.hub.model.ModelManager; +import housekeeping.hub.model.ReadOnlyAddressBook; +import housekeeping.hub.model.ReadOnlyUserPrefs; +import housekeeping.hub.model.UserPrefs; +import housekeeping.hub.model.util.SampleDataUtil; +import housekeeping.hub.storage.AddressBookStorage; +import housekeeping.hub.storage.JsonAddressBookStorage; +import housekeeping.hub.storage.JsonUserPrefsStorage; +import housekeeping.hub.storage.Storage; +import housekeeping.hub.storage.StorageManager; +import housekeeping.hub.storage.UserPrefsStorage; +import housekeeping.hub.ui.Ui; +import housekeeping.hub.ui.UiManager; import javafx.application.Application; import javafx.stage.Stage; -import seedu.address.commons.core.Config; -import seedu.address.commons.core.LogsCenter; -import seedu.address.commons.core.Version; -import seedu.address.commons.exceptions.DataLoadingException; -import seedu.address.commons.util.ConfigUtil; -import seedu.address.commons.util.StringUtil; -import seedu.address.logic.Logic; -import seedu.address.logic.LogicManager; -import seedu.address.model.AddressBook; -import seedu.address.model.Model; -import seedu.address.model.ModelManager; -import seedu.address.model.ReadOnlyAddressBook; -import seedu.address.model.ReadOnlyUserPrefs; -import seedu.address.model.UserPrefs; -import seedu.address.model.util.SampleDataUtil; -import seedu.address.storage.AddressBookStorage; -import seedu.address.storage.JsonAddressBookStorage; -import seedu.address.storage.JsonUserPrefsStorage; -import seedu.address.storage.Storage; -import seedu.address.storage.StorageManager; -import seedu.address.storage.UserPrefsStorage; -import seedu.address.ui.Ui; -import seedu.address.ui.UiManager; /** * Runs the application. @@ -68,9 +68,9 @@ public void init() throws Exception { } /** - * Returns a {@code ModelManager} with the data from {@code storage}'s address book and {@code userPrefs}.
- * The data from the sample address book will be used instead if {@code storage}'s address book is not found, - * or an empty address book will be used instead if errors occur when reading {@code storage}'s address book. + * Returns a {@code ModelManager} with the data from {@code storage}'s hub book and {@code userPrefs}.
+ * The data from the sample hub book will be used instead if {@code storage}'s hub book is not found, + * or an empty hub book will be used instead if errors occur when reading {@code storage}'s hub book. */ private Model initModelManager(Storage storage, ReadOnlyUserPrefs userPrefs) { logger.info("Using data file : " + storage.getAddressBookFilePath()); diff --git a/src/main/java/seedu/address/commons/core/Config.java b/src/main/java/housekeeping/hub/commons/core/Config.java similarity index 94% rename from src/main/java/seedu/address/commons/core/Config.java rename to src/main/java/housekeeping/hub/commons/core/Config.java index 485f85a5e05..a2e96586b98 100644 --- a/src/main/java/seedu/address/commons/core/Config.java +++ b/src/main/java/housekeeping/hub/commons/core/Config.java @@ -1,11 +1,11 @@ -package seedu.address.commons.core; +package housekeeping.hub.commons.core; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Objects; import java.util.logging.Level; -import seedu.address.commons.util.ToStringBuilder; +import housekeeping.hub.commons.util.ToStringBuilder; /** * Config values used by the app diff --git a/src/main/java/seedu/address/commons/core/GuiSettings.java b/src/main/java/housekeeping/hub/commons/core/GuiSettings.java similarity index 96% rename from src/main/java/seedu/address/commons/core/GuiSettings.java rename to src/main/java/housekeeping/hub/commons/core/GuiSettings.java index a97a86ee8d7..75af07c5148 100644 --- a/src/main/java/seedu/address/commons/core/GuiSettings.java +++ b/src/main/java/housekeeping/hub/commons/core/GuiSettings.java @@ -1,10 +1,10 @@ -package seedu.address.commons.core; +package housekeeping.hub.commons.core; import java.awt.Point; import java.io.Serializable; import java.util.Objects; -import seedu.address.commons.util.ToStringBuilder; +import housekeeping.hub.commons.util.ToStringBuilder; /** * A Serializable class that contains the GUI settings. diff --git a/src/main/java/seedu/address/commons/core/LogsCenter.java b/src/main/java/housekeeping/hub/commons/core/LogsCenter.java similarity index 99% rename from src/main/java/seedu/address/commons/core/LogsCenter.java rename to src/main/java/housekeeping/hub/commons/core/LogsCenter.java index 8cf8e15a0f0..aaad14a6a6e 100644 --- a/src/main/java/seedu/address/commons/core/LogsCenter.java +++ b/src/main/java/housekeeping/hub/commons/core/LogsCenter.java @@ -1,4 +1,4 @@ -package seedu.address.commons.core; +package housekeeping.hub.commons.core; import static java.util.Objects.requireNonNull; diff --git a/src/main/java/seedu/address/commons/core/Version.java b/src/main/java/housekeeping/hub/commons/core/Version.java similarity index 98% rename from src/main/java/seedu/address/commons/core/Version.java rename to src/main/java/housekeeping/hub/commons/core/Version.java index 491d24559b4..deb8f886d06 100644 --- a/src/main/java/seedu/address/commons/core/Version.java +++ b/src/main/java/housekeeping/hub/commons/core/Version.java @@ -1,4 +1,4 @@ -package seedu.address.commons.core; +package housekeeping.hub.commons.core; import java.util.regex.Matcher; import java.util.regex.Pattern; diff --git a/src/main/java/seedu/address/commons/core/index/Index.java b/src/main/java/housekeeping/hub/commons/core/index/Index.java similarity index 94% rename from src/main/java/seedu/address/commons/core/index/Index.java rename to src/main/java/housekeeping/hub/commons/core/index/Index.java index dd170d8b68d..4c7003135d0 100644 --- a/src/main/java/seedu/address/commons/core/index/Index.java +++ b/src/main/java/housekeeping/hub/commons/core/index/Index.java @@ -1,6 +1,6 @@ -package seedu.address.commons.core.index; +package housekeeping.hub.commons.core.index; -import seedu.address.commons.util.ToStringBuilder; +import housekeeping.hub.commons.util.ToStringBuilder; /** * Represents a zero-based or one-based index. diff --git a/src/main/java/seedu/address/commons/exceptions/DataLoadingException.java b/src/main/java/housekeeping/hub/commons/exceptions/DataLoadingException.java similarity index 81% rename from src/main/java/seedu/address/commons/exceptions/DataLoadingException.java rename to src/main/java/housekeeping/hub/commons/exceptions/DataLoadingException.java index 9904ba47afe..9b99276dceb 100644 --- a/src/main/java/seedu/address/commons/exceptions/DataLoadingException.java +++ b/src/main/java/housekeeping/hub/commons/exceptions/DataLoadingException.java @@ -1,4 +1,4 @@ -package seedu.address.commons.exceptions; +package housekeeping.hub.commons.exceptions; /** * Represents an error during loading of data from a file. diff --git a/src/main/java/seedu/address/commons/exceptions/IllegalValueException.java b/src/main/java/housekeeping/hub/commons/exceptions/IllegalValueException.java similarity index 92% rename from src/main/java/seedu/address/commons/exceptions/IllegalValueException.java rename to src/main/java/housekeeping/hub/commons/exceptions/IllegalValueException.java index 19124db485c..3127183bb2b 100644 --- a/src/main/java/seedu/address/commons/exceptions/IllegalValueException.java +++ b/src/main/java/housekeeping/hub/commons/exceptions/IllegalValueException.java @@ -1,4 +1,4 @@ -package seedu.address.commons.exceptions; +package housekeeping.hub.commons.exceptions; /** * Signals that some given data does not fulfill some constraints. diff --git a/src/main/java/seedu/address/commons/util/AppUtil.java b/src/main/java/housekeeping/hub/commons/util/AppUtil.java similarity index 94% rename from src/main/java/seedu/address/commons/util/AppUtil.java rename to src/main/java/housekeeping/hub/commons/util/AppUtil.java index 87aa89c0326..ffb1cf4c71f 100644 --- a/src/main/java/seedu/address/commons/util/AppUtil.java +++ b/src/main/java/housekeeping/hub/commons/util/AppUtil.java @@ -1,9 +1,9 @@ -package seedu.address.commons.util; +package housekeeping.hub.commons.util; import static java.util.Objects.requireNonNull; +import housekeeping.hub.MainApp; import javafx.scene.image.Image; -import seedu.address.MainApp; /** * A container for App specific utility functions diff --git a/src/main/java/seedu/address/commons/util/CollectionUtil.java b/src/main/java/housekeeping/hub/commons/util/CollectionUtil.java similarity index 96% rename from src/main/java/seedu/address/commons/util/CollectionUtil.java rename to src/main/java/housekeeping/hub/commons/util/CollectionUtil.java index eafe4dfd681..7e96110d21a 100644 --- a/src/main/java/seedu/address/commons/util/CollectionUtil.java +++ b/src/main/java/housekeeping/hub/commons/util/CollectionUtil.java @@ -1,4 +1,4 @@ -package seedu.address.commons.util; +package housekeeping.hub.commons.util; import static java.util.Objects.requireNonNull; diff --git a/src/main/java/seedu/address/commons/util/ConfigUtil.java b/src/main/java/housekeeping/hub/commons/util/ConfigUtil.java similarity index 76% rename from src/main/java/seedu/address/commons/util/ConfigUtil.java rename to src/main/java/housekeeping/hub/commons/util/ConfigUtil.java index 7b829c3c4cc..b424ded2ebf 100644 --- a/src/main/java/seedu/address/commons/util/ConfigUtil.java +++ b/src/main/java/housekeeping/hub/commons/util/ConfigUtil.java @@ -1,11 +1,11 @@ -package seedu.address.commons.util; +package housekeeping.hub.commons.util; import java.io.IOException; import java.nio.file.Path; import java.util.Optional; -import seedu.address.commons.core.Config; -import seedu.address.commons.exceptions.DataLoadingException; +import housekeeping.hub.commons.core.Config; +import housekeeping.hub.commons.exceptions.DataLoadingException; /** * A class for accessing the Config File. diff --git a/src/main/java/seedu/address/commons/util/FileUtil.java b/src/main/java/housekeeping/hub/commons/util/FileUtil.java similarity index 98% rename from src/main/java/seedu/address/commons/util/FileUtil.java rename to src/main/java/housekeeping/hub/commons/util/FileUtil.java index b1e2767cdd9..d615a40b437 100644 --- a/src/main/java/seedu/address/commons/util/FileUtil.java +++ b/src/main/java/housekeeping/hub/commons/util/FileUtil.java @@ -1,4 +1,4 @@ -package seedu.address.commons.util; +package housekeeping.hub.commons.util; import java.io.IOException; import java.nio.file.Files; diff --git a/src/main/java/seedu/address/commons/util/JsonUtil.java b/src/main/java/housekeeping/hub/commons/util/JsonUtil.java similarity index 97% rename from src/main/java/seedu/address/commons/util/JsonUtil.java rename to src/main/java/housekeeping/hub/commons/util/JsonUtil.java index 100cb16c395..ef4e2d68058 100644 --- a/src/main/java/seedu/address/commons/util/JsonUtil.java +++ b/src/main/java/housekeeping/hub/commons/util/JsonUtil.java @@ -1,4 +1,4 @@ -package seedu.address.commons.util; +package housekeeping.hub.commons.util; import static java.util.Objects.requireNonNull; @@ -20,8 +20,8 @@ import com.fasterxml.jackson.databind.module.SimpleModule; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; -import seedu.address.commons.core.LogsCenter; -import seedu.address.commons.exceptions.DataLoadingException; +import housekeeping.hub.commons.core.LogsCenter; +import housekeeping.hub.commons.exceptions.DataLoadingException; /** * Converts a Java object instance to JSON and vice versa diff --git a/src/main/java/seedu/address/commons/util/StringUtil.java b/src/main/java/housekeeping/hub/commons/util/StringUtil.java similarity index 95% rename from src/main/java/seedu/address/commons/util/StringUtil.java rename to src/main/java/housekeeping/hub/commons/util/StringUtil.java index 61cc8c9a1cb..e84a70b8c11 100644 --- a/src/main/java/seedu/address/commons/util/StringUtil.java +++ b/src/main/java/housekeeping/hub/commons/util/StringUtil.java @@ -1,7 +1,7 @@ -package seedu.address.commons.util; +package housekeeping.hub.commons.util; +import static housekeeping.hub.commons.util.AppUtil.checkArgument; import static java.util.Objects.requireNonNull; -import static seedu.address.commons.util.AppUtil.checkArgument; import java.io.PrintWriter; import java.io.StringWriter; diff --git a/src/main/java/seedu/address/commons/util/ToStringBuilder.java b/src/main/java/housekeeping/hub/commons/util/ToStringBuilder.java similarity index 97% rename from src/main/java/seedu/address/commons/util/ToStringBuilder.java rename to src/main/java/housekeeping/hub/commons/util/ToStringBuilder.java index d979b926734..08a41cf0912 100644 --- a/src/main/java/seedu/address/commons/util/ToStringBuilder.java +++ b/src/main/java/housekeeping/hub/commons/util/ToStringBuilder.java @@ -1,4 +1,4 @@ -package seedu.address.commons.util; +package housekeeping.hub.commons.util; /** * Builds a string representation of an object that is suitable as the return value of {@link Object#toString()}. diff --git a/src/main/java/seedu/address/logic/Logic.java b/src/main/java/housekeeping/hub/logic/Logic.java similarity index 63% rename from src/main/java/seedu/address/logic/Logic.java rename to src/main/java/housekeeping/hub/logic/Logic.java index be36e245bac..30ea530dfee 100644 --- a/src/main/java/seedu/address/logic/Logic.java +++ b/src/main/java/housekeeping/hub/logic/Logic.java @@ -1,16 +1,15 @@ -package seedu.address.logic; +package housekeeping.hub.logic; import java.nio.file.Path; +import housekeeping.hub.commons.core.GuiSettings; +import housekeeping.hub.logic.commands.CommandResult; +import housekeeping.hub.logic.commands.exceptions.CommandException; +import housekeeping.hub.logic.parser.exceptions.ParseException; +import housekeeping.hub.model.ReadOnlyAddressBook; +import housekeeping.hub.model.person.Client; +import housekeeping.hub.model.person.Housekeeper; import javafx.collections.ObservableList; -import seedu.address.commons.core.GuiSettings; -import seedu.address.logic.commands.CommandResult; -import seedu.address.logic.commands.exceptions.CommandException; -import seedu.address.logic.parser.exceptions.ParseException; -import seedu.address.model.ReadOnlyAddressBook; -import seedu.address.model.person.Client; -import seedu.address.model.person.Housekeeper; -import seedu.address.model.person.Person; /** * API of the Logic component @@ -28,13 +27,10 @@ public interface Logic { /** * Returns the AddressBook. * - * @see seedu.address.model.Model#getAddressBook() + * @see housekeeping.hub.model.Model#getAddressBook() */ ReadOnlyAddressBook getAddressBook(); - /** Returns an unmodifiable view of the filtered list of persons */ - //ObservableList getFilteredPersonList(); - /** Returns an unmodifiable view of the filtered list of clients */ ObservableList getFilteredClientList(); @@ -42,7 +38,7 @@ public interface Logic { ObservableList getFilteredHousekeeperList(); /** - * Returns the user prefs' address book file path. + * Returns the user prefs' hub book file path. */ Path getAddressBookFilePath(); diff --git a/src/main/java/seedu/address/logic/LogicManager.java b/src/main/java/housekeeping/hub/logic/LogicManager.java similarity index 79% rename from src/main/java/seedu/address/logic/LogicManager.java rename to src/main/java/housekeeping/hub/logic/LogicManager.java index a13fc5e4a3d..49ce9a437d3 100644 --- a/src/main/java/seedu/address/logic/LogicManager.java +++ b/src/main/java/housekeeping/hub/logic/LogicManager.java @@ -1,24 +1,23 @@ -package seedu.address.logic; +package housekeeping.hub.logic; import java.io.IOException; import java.nio.file.AccessDeniedException; import java.nio.file.Path; import java.util.logging.Logger; +import housekeeping.hub.commons.core.GuiSettings; +import housekeeping.hub.commons.core.LogsCenter; +import housekeeping.hub.logic.commands.Command; +import housekeeping.hub.logic.commands.CommandResult; +import housekeeping.hub.logic.commands.exceptions.CommandException; +import housekeeping.hub.logic.parser.AddressBookParser; +import housekeeping.hub.logic.parser.exceptions.ParseException; +import housekeeping.hub.model.Model; +import housekeeping.hub.model.ReadOnlyAddressBook; +import housekeeping.hub.model.person.Client; +import housekeeping.hub.model.person.Housekeeper; +import housekeeping.hub.storage.Storage; import javafx.collections.ObservableList; -import seedu.address.commons.core.GuiSettings; -import seedu.address.commons.core.LogsCenter; -import seedu.address.logic.commands.Command; -import seedu.address.logic.commands.CommandResult; -import seedu.address.logic.commands.exceptions.CommandException; -import seedu.address.logic.parser.AddressBookParser; -import seedu.address.logic.parser.exceptions.ParseException; -import seedu.address.model.Model; -import seedu.address.model.ReadOnlyAddressBook; -import seedu.address.model.person.Client; -import seedu.address.model.person.Housekeeper; -import seedu.address.model.person.Person; -import seedu.address.storage.Storage; /** * The main LogicManager of the app. diff --git a/src/main/java/seedu/address/logic/Messages.java b/src/main/java/housekeeping/hub/logic/Messages.java similarity index 93% rename from src/main/java/seedu/address/logic/Messages.java rename to src/main/java/housekeeping/hub/logic/Messages.java index a10300a3da2..6e94f6901dd 100644 --- a/src/main/java/seedu/address/logic/Messages.java +++ b/src/main/java/housekeeping/hub/logic/Messages.java @@ -1,15 +1,14 @@ -package seedu.address.logic; +package housekeeping.hub.logic; import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; -import seedu.address.logic.parser.Prefix; -import seedu.address.model.person.Client; -import seedu.address.model.person.Housekeeper; -import seedu.address.model.person.HousekeepingDetails; -import seedu.address.model.person.Person; -import seedu.address.model.tag.Tag; +import housekeeping.hub.logic.parser.Prefix; +import housekeeping.hub.model.person.Client; +import housekeeping.hub.model.person.Housekeeper; +import housekeeping.hub.model.person.HousekeepingDetails; +import housekeeping.hub.model.tag.Tag; /** * Container for user visible messages. diff --git a/src/main/java/seedu/address/logic/commands/AddClientCommand.java b/src/main/java/housekeeping/hub/logic/commands/AddClientCommand.java similarity index 69% rename from src/main/java/seedu/address/logic/commands/AddClientCommand.java rename to src/main/java/housekeeping/hub/logic/commands/AddClientCommand.java index d4f8de2a2a1..c51fa585327 100644 --- a/src/main/java/seedu/address/logic/commands/AddClientCommand.java +++ b/src/main/java/housekeeping/hub/logic/commands/AddClientCommand.java @@ -1,16 +1,19 @@ -package seedu.address.logic.commands; +package housekeeping.hub.logic.commands; import static java.util.Objects.requireNonNull; -import seedu.address.logic.Messages; -import seedu.address.logic.commands.exceptions.CommandException; -import seedu.address.model.Model; -import seedu.address.model.person.Client; +import housekeeping.hub.logic.Messages; +import housekeeping.hub.logic.commands.exceptions.CommandException; +import housekeeping.hub.model.Model; +import housekeeping.hub.model.person.Client; +/** + * Adds a client to the address book. + */ public class AddClientCommand extends AddCommand { public static final String MESSAGE_SUCCESS = "New client added: %1$s"; - public static final String MESSAGE_DUPLICATE_CLIENT = "This client already exists in the address book"; + public static final String MESSAGE_DUPLICATE_CLIENT = "This client already exists in the hub book"; public AddClientCommand(Client client) { super(client); diff --git a/src/main/java/seedu/address/logic/commands/AddCommand.java b/src/main/java/housekeeping/hub/logic/commands/AddCommand.java similarity index 64% rename from src/main/java/seedu/address/logic/commands/AddCommand.java rename to src/main/java/housekeeping/hub/logic/commands/AddCommand.java index bfbf88cb444..351e286ded0 100644 --- a/src/main/java/seedu/address/logic/commands/AddCommand.java +++ b/src/main/java/housekeeping/hub/logic/commands/AddCommand.java @@ -1,29 +1,25 @@ -package seedu.address.logic.commands; +package housekeeping.hub.logic.commands; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_ADDRESS; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_AREA; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_DETAILS; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_EMAIL; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_NAME; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_PHONE; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_TAG; import static java.util.Objects.requireNonNull; -import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS; -import static seedu.address.logic.parser.CliSyntax.PREFIX_AREA; -import static seedu.address.logic.parser.CliSyntax.PREFIX_DETAILS; -import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL; -import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; -import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE; -import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG; -import seedu.address.commons.util.ToStringBuilder; -import seedu.address.logic.Messages; -import seedu.address.logic.commands.exceptions.CommandException; -import seedu.address.model.Model; -import seedu.address.model.person.Client; -import seedu.address.model.person.Person; +import housekeeping.hub.commons.util.ToStringBuilder; +import housekeeping.hub.model.person.Person; /** - * Adds a person to the address book. + * Adds a person to the hub book. */ -abstract public class AddCommand extends Command { +public abstract class AddCommand extends Command { public static final String COMMAND_WORD = "add"; - public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a client or housekeeper to the address book.\n" + public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a client or housekeeper to the hub book.\n" + "Parameters: " + "TYPE(client or housekeeper) " + PREFIX_NAME + "NAME " diff --git a/src/main/java/seedu/address/logic/commands/AddHousekeeperCommand.java b/src/main/java/housekeeping/hub/logic/commands/AddHousekeeperCommand.java similarity index 65% rename from src/main/java/seedu/address/logic/commands/AddHousekeeperCommand.java rename to src/main/java/housekeeping/hub/logic/commands/AddHousekeeperCommand.java index 2fcc569f707..1aca6a998af 100644 --- a/src/main/java/seedu/address/logic/commands/AddHousekeeperCommand.java +++ b/src/main/java/housekeeping/hub/logic/commands/AddHousekeeperCommand.java @@ -1,17 +1,20 @@ -package seedu.address.logic.commands; +package housekeeping.hub.logic.commands; import static java.util.Objects.requireNonNull; -import seedu.address.logic.Messages; -import seedu.address.logic.commands.exceptions.CommandException; -import seedu.address.model.Model; -import seedu.address.model.person.Housekeeper; +import housekeeping.hub.logic.Messages; +import housekeeping.hub.logic.commands.exceptions.CommandException; +import housekeeping.hub.model.Model; +import housekeeping.hub.model.person.Housekeeper; +/** + * Adds a housekeeper to the address book. + */ public class AddHousekeeperCommand extends AddCommand { public static final String MESSAGE_SUCCESS = "New housekeeper added: %1$s"; - public static final String MESSAGE_DUPLICATE_HOUSEKEEPER = "This housekeeper already exists in the address book"; - public static final String MESSAGE_NO_HOUSEKEEPING_DETAILS = "Housekeeper should not have housekeeping details, " + - "that is specifically for client."; + public static final String MESSAGE_DUPLICATE_HOUSEKEEPER = "This housekeeper already exists in the hub book"; + public static final String MESSAGE_NO_HOUSEKEEPING_DETAILS = "Housekeeper should not have housekeeping details, " + + "that is specifically for client."; public AddHousekeeperCommand(Housekeeper housekeeper) { super(housekeeper); diff --git a/src/main/java/seedu/address/logic/commands/BookingCommand.java b/src/main/java/housekeeping/hub/logic/commands/BookingCommand.java similarity index 78% rename from src/main/java/seedu/address/logic/commands/BookingCommand.java rename to src/main/java/housekeeping/hub/logic/commands/BookingCommand.java index df9562e4c94..f71e23277c6 100644 --- a/src/main/java/seedu/address/logic/commands/BookingCommand.java +++ b/src/main/java/housekeeping/hub/logic/commands/BookingCommand.java @@ -1,26 +1,26 @@ -package seedu.address.logic.commands; +package housekeeping.hub.logic.commands; +import static housekeeping.hub.model.Model.PREDICATE_SHOW_ALL_CLIENTS; +import static housekeeping.hub.model.Model.PREDICATE_SHOW_ALL_HOUSEKEEPERS; import static java.util.Objects.requireNonNull; -import static seedu.address.model.Model.PREDICATE_SHOW_ALL_CLIENTS; -import static seedu.address.model.Model.PREDICATE_SHOW_ALL_HOUSEKEEPERS; -import java.time.Period; import java.time.LocalDate; +import java.time.Period; import java.time.format.DateTimeParseException; import java.util.List; -import seedu.address.commons.core.index.Index; -import seedu.address.commons.util.ToStringBuilder; -import seedu.address.logic.Messages; -import seedu.address.logic.commands.exceptions.CommandException; -import seedu.address.model.Model; -import seedu.address.model.person.Area; -import seedu.address.model.person.Booking; -import seedu.address.model.person.BookingList; -import seedu.address.model.person.BookingSearchPredicate; -import seedu.address.model.person.Client; -import seedu.address.model.person.Housekeeper; -import seedu.address.model.person.HousekeepingDetails; +import housekeeping.hub.commons.core.index.Index; +import housekeeping.hub.commons.util.ToStringBuilder; +import housekeeping.hub.logic.Messages; +import housekeeping.hub.logic.commands.exceptions.CommandException; +import housekeeping.hub.model.Model; +import housekeeping.hub.model.person.Area; +import housekeeping.hub.model.person.Booking; +import housekeeping.hub.model.person.BookingList; +import housekeeping.hub.model.person.BookingSearchPredicate; +import housekeeping.hub.model.person.Client; +import housekeeping.hub.model.person.Housekeeper; +import housekeeping.hub.model.person.HousekeepingDetails; /** * Encapsulates booking actions (add, delete, list) for a housekeeper. @@ -36,7 +36,7 @@ public class BookingCommand extends Command { public static final String MESSAGE_INVALID_ACTION = "Invalid action. Action words include {add, delete, list}."; public static final String MESSAGE_USAGE = "\nCLIENT COMMANDS:\n\n" - +"[edit last housekeeping date] : edits last housekeeping date for the client at the specified index.\n" + + "[edit last housekeeping date] : edits last housekeeping date for the client at the specified index.\n" + "Parameters: INDEX lhd/DATE(yyyy-mm-dd)\n" + "Example: booking client edit 2 lhd/2024-05-12\n\n[" + "edit preferred interval" @@ -75,7 +75,7 @@ public class BookingCommand extends Command { + "Example: " + COMMAND_WORD + " housekeeper " + ACTION_WORD_HOUSEKEEPER_ADD + " 1 2024-05-12 am\n\n[" + "delete booking] : deletes the specified booking for the housekeeper at the specified index.\n" + "Parameters: HOUSEKEEPER_INDEX BOOKING_INDEX\n" - + "Example: " + COMMAND_WORD + " housekeeper "+ ACTION_WORD_HOUSEKEEPER_DELETE + " 1 1\n\n[" + + "Example: " + COMMAND_WORD + " housekeeper " + ACTION_WORD_HOUSEKEEPER_DELETE + " 1 1\n\n[" + "list bookings] : lists all bookings for the housekeeper at the specified index.\n" + "Parameters: INDEX\n" + "Example: " + COMMAND_WORD + " housekeeper " + ACTION_WORD_HOUSEKEEPER_LIST + " 1\n\n[" @@ -83,7 +83,7 @@ public class BookingCommand extends Command { + "Parameters: AREA DATE(yyyy-mm-dd) TIME(am|pm)\n" + "Example: " + COMMAND_WORD + " housekeeper " + ACTION_WORD_HOUSEKEEPER_SEARCH + " west 2024-01-01 am"; - public static final String ADD_MESSAGE_CONSTRAINT = "If client does not have housekeeping details, " + public static final String NO_DETAILS_MESSAGE_CONSTRAINT = "If client does not have housekeeping details, " + "please set housekeeping details first using 'set'."; private String actionWord; @@ -154,6 +154,14 @@ public BookingCommand(String type, String actionWord, BookingSearchPredicate boo this.bookingSearchPredicate = bookingSearchPredicate; } + /** + * Constructs a BookingCommand for the "edit" action. + * + * @param type "housekeeper" + * @param actionWord "edit" + * @param index of housekeeper to edit + * @param housekeepingDetails to set + */ public BookingCommand(String type, String actionWord, Index index, HousekeepingDetails housekeepingDetails) { requireNonNull(index); this.type = type; @@ -162,6 +170,14 @@ public BookingCommand(String type, String actionWord, Index index, HousekeepingD this.housekeepingDetails = housekeepingDetails; } + /** + * Constructs a BookingCommand for the "edit" action. + * + * @param type "housekeeper" + * @param actionWord "edit" + * @param index of housekeeper to edit + * @param defer period to add to deferment + */ public BookingCommand(String type, String actionWord, Index index, Period defer) { requireNonNull(index); requireNonNull(defer); @@ -227,29 +243,35 @@ private CommandResult clientAdd(Model model) throws CommandException { } Client clientToEdit = lastShownList.get(index.getZeroBased()); - if (clientToEdit.hasHousekeepingDetails()) { - HousekeepingDetails details = clientToEdit.getDetails(); - details.setBooking(booking); - - EditCommand.EditPersonDescriptor editPersonDescriptor = new EditCommand.EditPersonDescriptor(); - editPersonDescriptor.setDetails(details); - Command editClientCommand = new EditClientCommand(index, editPersonDescriptor); - model.updateFilteredClientList(PREDICATE_SHOW_ALL_CLIENTS); - return editClientCommand.execute(model); - } else { - throw new CommandException(ADD_MESSAGE_CONSTRAINT); + if (!clientToEdit.hasHousekeepingDetails()) { + throw new CommandException(NO_DETAILS_MESSAGE_CONSTRAINT); } + + HousekeepingDetails details = clientToEdit.getDetails(); + details.setBooking(booking); + + EditCommand.EditPersonDescriptor editPersonDescriptor = new EditCommand.EditPersonDescriptor(); + editPersonDescriptor.setDetails(details); + + Command editClientCommand = new EditClientCommand(index, editPersonDescriptor); + model.updateFilteredClientList(PREDICATE_SHOW_ALL_CLIENTS); + return editClientCommand.execute(model); } private CommandResult clientDelete(Model model) throws CommandException { List lastShownList = model.getFilteredClientList(); if (index.getZeroBased() >= lastShownList.size()) { - throw new CommandException(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX); + throw new CommandException(Messages.MESSAGE_INVALID_CLIENT_DISPLAYED_INDEX); } Client clientToEdit = lastShownList.get(index.getZeroBased()); + + if (!clientToEdit.hasHousekeepingDetails()) { + throw new CommandException(NO_DETAILS_MESSAGE_CONSTRAINT); + } + HousekeepingDetails details = clientToEdit.getDetails(); details.deleteBooking(); @@ -264,7 +286,7 @@ private CommandResult clientSet(Model model) throws CommandException { List lastShownList = model.getFilteredClientList(); if (index.getZeroBased() >= lastShownList.size()) { - throw new CommandException(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX); + throw new CommandException(Messages.MESSAGE_INVALID_CLIENT_DISPLAYED_INDEX); } EditCommand.EditPersonDescriptor editPersonDescriptor = new EditCommand.EditPersonDescriptor(); @@ -279,14 +301,16 @@ private CommandResult clientDefer(Model model) throws CommandException { List lastShownList = model.getFilteredClientList(); if (index.getZeroBased() >= lastShownList.size()) { - throw new CommandException(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX); + throw new CommandException(Messages.MESSAGE_INVALID_CLIENT_DISPLAYED_INDEX); } - Client personToEdit = lastShownList.get(index.getZeroBased()); + Client clientToEdit = lastShownList.get(index.getZeroBased()); - HousekeepingDetails detailsToEdit = personToEdit.getDetails(); + if (!clientToEdit.hasHousekeepingDetails()) { + throw new CommandException(NO_DETAILS_MESSAGE_CONSTRAINT); + } + HousekeepingDetails detailsToEdit = clientToEdit.getDetails(); detailsToEdit.addDeferment(defer); - return new CommandResult(String.format(MESSAGE_DEFER_PERSON_SUCCESS, detailsToEdit.getDefermentToString())); } @@ -294,11 +318,11 @@ private CommandResult clientRemove(Model model) throws CommandException { List lastShownList = model.getFilteredClientList(); if (index.getZeroBased() >= lastShownList.size()) { - throw new CommandException(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX); + throw new CommandException(Messages.MESSAGE_INVALID_CLIENT_DISPLAYED_INDEX); } EditCommand.EditPersonDescriptor editPersonDescriptor = new EditCommand.EditPersonDescriptor(); - editPersonDescriptor.setDetails(HousekeepingDetails.empty); + editPersonDescriptor.setDetails(HousekeepingDetails.EMPTY); Command editClientCommand = new EditClientCommand(index, editPersonDescriptor); return editClientCommand.execute(model); @@ -308,7 +332,7 @@ private CommandResult housekeeperList(Model model) throws CommandException { List lastShownListList = model.getFilteredHousekeeperList(); if (index.getZeroBased() >= lastShownListList.size()) { - throw new CommandException(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX); + throw new CommandException(Messages.MESSAGE_INVALID_HOUSEKEEPER_DISPLAYED_INDEX); } Housekeeper housekeeperToListBooking = lastShownListList.get(index.getZeroBased()); @@ -320,7 +344,7 @@ private CommandResult housekeeperDelete(Model model) throws CommandException { List lastShownListDelete = model.getFilteredHousekeeperList(); if (index.getZeroBased() >= lastShownListDelete.size()) { - throw new CommandException(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX); + throw new CommandException(Messages.MESSAGE_INVALID_HOUSEKEEPER_DISPLAYED_INDEX); } Housekeeper housekeeperToDeleteBooking = lastShownListDelete.get(index.getZeroBased()); @@ -340,7 +364,7 @@ private CommandResult housekeeperAdd(Model model) throws CommandException { List lastShownListAdd = model.getFilteredHousekeeperList(); if (index.getZeroBased() >= lastShownListAdd.size()) { - throw new CommandException(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX); + throw new CommandException(Messages.MESSAGE_INVALID_HOUSEKEEPER_DISPLAYED_INDEX); } try { @@ -354,8 +378,8 @@ private CommandResult housekeeperAdd(Model model) throws CommandException { EditCommand.EditPersonDescriptor editHousekeeperDescriptor = new EditCommand.EditPersonDescriptor(); editHousekeeperDescriptor.setBookingList(housekeeperToAddBooking.getBookingList()); EditHousekeeperCommand command = new EditHousekeeperCommand(index, editHousekeeperDescriptor); - Housekeeper editedHousekeeper = command.createEditedPerson(housekeeperToAddBooking, editHousekeeperDescriptor); - + Housekeeper editedHousekeeper = command.createEditedPerson(housekeeperToAddBooking, + editHousekeeperDescriptor); model.setHousekeeper(housekeeperToAddBooking, editedHousekeeper); model.updateFilteredHousekeeperList(PREDICATE_SHOW_ALL_HOUSEKEEPERS); @@ -399,6 +423,24 @@ private CommandResult housekeeperSearch(Model model) throws CommandException { } } + /** + * Checks that BookingCommand has no bookedDateAndTime initialised. + * + * @return True if there is no booked date and time, false otherwise + */ + public boolean hasNoBookedDateAndTime() { + return bookedDateAndTime == null; + } + + /** + * Checks that BookingCommand has no Index initialised. + * + * @return True if there is no Index, false otherwise + */ + public boolean hasNoIndex() { + return index == null; + } + @Override public boolean equals(Object other) { if (other == this) { @@ -411,10 +453,24 @@ public boolean equals(Object other) { } BookingCommand otherBookingCommand = (BookingCommand) other; - return actionWord.equals(otherBookingCommand.actionWord) - && index.equals(otherBookingCommand.index) - && (bookingToDeleteIndex == otherBookingCommand.bookingToDeleteIndex) - && bookedDateAndTime.equals(otherBookingCommand.bookedDateAndTime); + + // for housekeeper search + if (this.hasNoIndex() && otherBookingCommand.hasNoIndex() + && this.hasNoBookedDateAndTime() && otherBookingCommand.hasNoBookedDateAndTime()) { + return actionWord.equals(otherBookingCommand.actionWord) + && (bookingToDeleteIndex == otherBookingCommand.bookingToDeleteIndex) + && bookingSearchPredicate.equals(otherBookingCommand.bookingSearchPredicate); + // for housekeeper delete + } else if (this.hasNoBookedDateAndTime() && otherBookingCommand.hasNoBookedDateAndTime()) { + return actionWord.equals(otherBookingCommand.actionWord) + && index.equals(otherBookingCommand.index) + && (bookingToDeleteIndex == otherBookingCommand.bookingToDeleteIndex); + } else { + return actionWord.equals(otherBookingCommand.actionWord) + && index.equals(otherBookingCommand.index) + && (bookingToDeleteIndex == otherBookingCommand.bookingToDeleteIndex) + && bookedDateAndTime.equals(otherBookingCommand.bookedDateAndTime); + } } @Override diff --git a/src/main/java/seedu/address/logic/commands/ClearCommand.java b/src/main/java/housekeeping/hub/logic/commands/ClearCommand.java similarity index 75% rename from src/main/java/seedu/address/logic/commands/ClearCommand.java rename to src/main/java/housekeeping/hub/logic/commands/ClearCommand.java index 9c86b1fa6e4..211e479e2d9 100644 --- a/src/main/java/seedu/address/logic/commands/ClearCommand.java +++ b/src/main/java/housekeeping/hub/logic/commands/ClearCommand.java @@ -1,12 +1,12 @@ -package seedu.address.logic.commands; +package housekeeping.hub.logic.commands; import static java.util.Objects.requireNonNull; -import seedu.address.model.AddressBook; -import seedu.address.model.Model; +import housekeeping.hub.model.AddressBook; +import housekeeping.hub.model.Model; /** - * Clears the address book. + * Clears the hub book. */ public class ClearCommand extends Command { diff --git a/src/main/java/seedu/address/logic/commands/Command.java b/src/main/java/housekeeping/hub/logic/commands/Command.java similarity index 77% rename from src/main/java/seedu/address/logic/commands/Command.java rename to src/main/java/housekeeping/hub/logic/commands/Command.java index 64f18992160..045cab43727 100644 --- a/src/main/java/seedu/address/logic/commands/Command.java +++ b/src/main/java/housekeeping/hub/logic/commands/Command.java @@ -1,7 +1,7 @@ -package seedu.address.logic.commands; +package housekeeping.hub.logic.commands; -import seedu.address.logic.commands.exceptions.CommandException; -import seedu.address.model.Model; +import housekeeping.hub.logic.commands.exceptions.CommandException; +import housekeeping.hub.model.Model; /** * Represents a command with hidden internal logic and the ability to be executed. diff --git a/src/main/java/seedu/address/logic/commands/CommandResult.java b/src/main/java/housekeeping/hub/logic/commands/CommandResult.java similarity index 95% rename from src/main/java/seedu/address/logic/commands/CommandResult.java rename to src/main/java/housekeeping/hub/logic/commands/CommandResult.java index 249b6072d0d..feee61aa585 100644 --- a/src/main/java/seedu/address/logic/commands/CommandResult.java +++ b/src/main/java/housekeeping/hub/logic/commands/CommandResult.java @@ -1,10 +1,10 @@ -package seedu.address.logic.commands; +package housekeeping.hub.logic.commands; import static java.util.Objects.requireNonNull; import java.util.Objects; -import seedu.address.commons.util.ToStringBuilder; +import housekeeping.hub.commons.util.ToStringBuilder; /** * Represents the result of a command execution. diff --git a/src/main/java/seedu/address/logic/commands/DeleteClientCommand.java b/src/main/java/housekeeping/hub/logic/commands/DeleteClientCommand.java similarity index 71% rename from src/main/java/seedu/address/logic/commands/DeleteClientCommand.java rename to src/main/java/housekeeping/hub/logic/commands/DeleteClientCommand.java index 5e498d0fd51..0720370e1f3 100644 --- a/src/main/java/seedu/address/logic/commands/DeleteClientCommand.java +++ b/src/main/java/housekeeping/hub/logic/commands/DeleteClientCommand.java @@ -1,15 +1,18 @@ -package seedu.address.logic.commands; +package housekeeping.hub.logic.commands; import static java.util.Objects.requireNonNull; import java.util.List; -import seedu.address.commons.core.index.Index; -import seedu.address.logic.Messages; -import seedu.address.logic.commands.exceptions.CommandException; -import seedu.address.model.Model; -import seedu.address.model.person.Client; +import housekeeping.hub.commons.core.index.Index; +import housekeeping.hub.logic.Messages; +import housekeeping.hub.logic.commands.exceptions.CommandException; +import housekeeping.hub.model.Model; +import housekeeping.hub.model.person.Client; +/** + * Deletes a client identified using it's displayed index from the address book. + */ public class DeleteClientCommand extends DeleteCommand { public static final String MESSAGE_DELETE_CLIENT_SUCCESS = "Deleted Client: %1$s"; diff --git a/src/main/java/seedu/address/logic/commands/DeleteCommand.java b/src/main/java/housekeeping/hub/logic/commands/DeleteCommand.java similarity index 70% rename from src/main/java/seedu/address/logic/commands/DeleteCommand.java rename to src/main/java/housekeeping/hub/logic/commands/DeleteCommand.java index f3b56697f7e..0b4f623517b 100644 --- a/src/main/java/seedu/address/logic/commands/DeleteCommand.java +++ b/src/main/java/housekeeping/hub/logic/commands/DeleteCommand.java @@ -1,21 +1,12 @@ -package seedu.address.logic.commands; +package housekeeping.hub.logic.commands; -import static java.util.Objects.requireNonNull; - -import java.util.List; - -import seedu.address.commons.core.index.Index; -import seedu.address.commons.util.ToStringBuilder; -import seedu.address.logic.Messages; -import seedu.address.logic.commands.exceptions.CommandException; -import seedu.address.model.Model; -import seedu.address.model.person.Client; -import seedu.address.model.person.Type; +import housekeeping.hub.commons.core.index.Index; +import housekeeping.hub.commons.util.ToStringBuilder; /** - * Deletes a person identified using it's displayed index from the address book. + * Deletes a person identified using it's displayed index from the hub book. */ -abstract public class DeleteCommand extends Command { +public abstract class DeleteCommand extends Command { public static final String COMMAND_WORD = "delete"; diff --git a/src/main/java/seedu/address/logic/commands/DeleteHousekeeperCommand.java b/src/main/java/housekeeping/hub/logic/commands/DeleteHousekeeperCommand.java similarity index 72% rename from src/main/java/seedu/address/logic/commands/DeleteHousekeeperCommand.java rename to src/main/java/housekeeping/hub/logic/commands/DeleteHousekeeperCommand.java index 79ae46f7a85..0c282c65c57 100644 --- a/src/main/java/seedu/address/logic/commands/DeleteHousekeeperCommand.java +++ b/src/main/java/housekeeping/hub/logic/commands/DeleteHousekeeperCommand.java @@ -1,16 +1,18 @@ -package seedu.address.logic.commands; +package housekeeping.hub.logic.commands; import static java.util.Objects.requireNonNull; import java.util.List; -import seedu.address.commons.core.index.Index; -import seedu.address.logic.Messages; -import seedu.address.logic.commands.exceptions.CommandException; -import seedu.address.model.Model; -import seedu.address.model.person.Client; -import seedu.address.model.person.Housekeeper; +import housekeeping.hub.commons.core.index.Index; +import housekeeping.hub.logic.Messages; +import housekeeping.hub.logic.commands.exceptions.CommandException; +import housekeeping.hub.model.Model; +import housekeeping.hub.model.person.Housekeeper; +/** + * Deletes a housekeeper identified using it's displayed index from the address book. + */ public class DeleteHousekeeperCommand extends DeleteCommand { public static final String MESSAGE_DELETE_HOUSEKEEPER_SUCCESS = "Deleted Housekeeper: %1$s"; diff --git a/src/main/java/seedu/address/logic/commands/EditClientCommand.java b/src/main/java/housekeeping/hub/logic/commands/EditClientCommand.java similarity index 76% rename from src/main/java/seedu/address/logic/commands/EditClientCommand.java rename to src/main/java/housekeeping/hub/logic/commands/EditClientCommand.java index a91eb7f5138..631efc3bade 100644 --- a/src/main/java/seedu/address/logic/commands/EditClientCommand.java +++ b/src/main/java/housekeeping/hub/logic/commands/EditClientCommand.java @@ -1,29 +1,30 @@ -package seedu.address.logic.commands; +package housekeeping.hub.logic.commands; import static java.util.Objects.requireNonNull; -import static seedu.address.model.Model.PREDICATE_SHOW_ALL_CLIENTS; import java.util.List; import java.util.Set; -import seedu.address.commons.core.index.Index; -import seedu.address.logic.Messages; -import seedu.address.logic.commands.exceptions.CommandException; -import seedu.address.model.Model; -import seedu.address.model.person.Address; -import seedu.address.model.person.Area; -import seedu.address.model.person.Client; -import seedu.address.model.person.Email; -import seedu.address.model.person.HousekeepingDetails; -import seedu.address.model.person.Name; -import seedu.address.model.person.Person; -import seedu.address.model.person.Phone; -import seedu.address.model.person.Type; -import seedu.address.model.tag.Tag; +import housekeeping.hub.commons.core.index.Index; +import housekeeping.hub.logic.Messages; +import housekeeping.hub.logic.commands.exceptions.CommandException; +import housekeeping.hub.model.Model; +import housekeeping.hub.model.person.Address; +import housekeeping.hub.model.person.Area; +import housekeeping.hub.model.person.Client; +import housekeeping.hub.model.person.Email; +import housekeeping.hub.model.person.HousekeepingDetails; +import housekeeping.hub.model.person.Name; +import housekeeping.hub.model.person.Person; +import housekeeping.hub.model.person.Phone; +import housekeeping.hub.model.tag.Tag; +/** + * Edits the details of an existing client in the address book. + */ public class EditClientCommand extends EditCommand { public static final String MESSAGE_EDIT_CLIENT_SUCCESS = "Edited Client: %1$s"; - public static final String MESSAGE_DUPLICATE_CLIENT = "This client already exists in the address book."; + public static final String MESSAGE_DUPLICATE_CLIENT = "This client already exists in the hub book."; public EditClientCommand(Index index, EditPersonDescriptor editPersonDescriptor) { super(index, editPersonDescriptor); diff --git a/src/main/java/seedu/address/logic/commands/EditCommand.java b/src/main/java/housekeeping/hub/logic/commands/EditCommand.java similarity index 82% rename from src/main/java/seedu/address/logic/commands/EditCommand.java rename to src/main/java/housekeeping/hub/logic/commands/EditCommand.java index e2ee65d9cb0..d9f800119e8 100644 --- a/src/main/java/seedu/address/logic/commands/EditCommand.java +++ b/src/main/java/housekeeping/hub/logic/commands/EditCommand.java @@ -1,11 +1,11 @@ -package seedu.address.logic.commands; +package housekeeping.hub.logic.commands; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_ADDRESS; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_EMAIL; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_NAME; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_PHONE; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_TAG; import static java.util.Objects.requireNonNull; -import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS; -import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL; -import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; -import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE; -import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG; import java.util.Collections; import java.util.HashSet; @@ -13,24 +13,23 @@ import java.util.Optional; import java.util.Set; -import seedu.address.commons.core.index.Index; -import seedu.address.commons.util.CollectionUtil; -import seedu.address.commons.util.ToStringBuilder; -import seedu.address.model.person.Address; -import seedu.address.model.person.BookingList; -import seedu.address.model.person.Area; -import seedu.address.model.person.Email; -import seedu.address.model.person.HousekeepingDetails; -import seedu.address.model.person.Name; -import seedu.address.model.person.Person; -import seedu.address.model.person.Phone; -import seedu.address.model.person.Type; -import seedu.address.model.tag.Tag; +import housekeeping.hub.commons.core.index.Index; +import housekeeping.hub.commons.util.CollectionUtil; +import housekeeping.hub.commons.util.ToStringBuilder; +import housekeeping.hub.model.person.Address; +import housekeeping.hub.model.person.Area; +import housekeeping.hub.model.person.BookingList; +import housekeeping.hub.model.person.Email; +import housekeeping.hub.model.person.HousekeepingDetails; +import housekeeping.hub.model.person.Name; +import housekeeping.hub.model.person.Person; +import housekeeping.hub.model.person.Phone; +import housekeeping.hub.model.tag.Tag; /** - * Edits the details of an existing person in the address book. + * Edits the details of an existing person in the hub book. */ -abstract public class EditCommand extends Command { +public abstract class EditCommand extends Command { public static final String COMMAND_WORD = "edit"; @@ -69,7 +68,7 @@ public EditCommand(Index index, EditPersonDescriptor editPersonDescriptor) { * Creates and returns a {@code Person} with the details of {@code personToEdit} * edited with {@code editPersonDescriptor}. */ - abstract protected Person createEditedPerson(Person personToEdit, EditPersonDescriptor editPersonDescriptor); + protected abstract Person createEditedPerson(Person personToEdit, EditPersonDescriptor editPersonDescriptor); @Override public boolean equals(Object other) { @@ -105,7 +104,6 @@ public static class EditPersonDescriptor { private Email email; private Address address; private Set tags; - private Type type; private BookingList bookingList; private HousekeepingDetails details; private Area area; @@ -122,7 +120,6 @@ public EditPersonDescriptor(EditPersonDescriptor toCopy) { setEmail(toCopy.email); setAddress(toCopy.address); setTags(toCopy.tags); - setType(toCopy.type); setBookingList(toCopy.bookingList); setDetails(toCopy.details); setArea(toCopy.area); @@ -132,7 +129,7 @@ public EditPersonDescriptor(EditPersonDescriptor toCopy) { * Returns true if at least one field is edited. */ public boolean isAnyFieldEdited() { - return CollectionUtil.isAnyNonNull(name, phone, email, address, tags, type, area, bookingList); + return CollectionUtil.isAnyNonNull(name, phone, email, address, tags, area, bookingList); } public void setName(Name name) { @@ -184,14 +181,6 @@ public Optional> getTags() { return (tags != null) ? Optional.of(Collections.unmodifiableSet(tags)) : Optional.empty(); } - public void setType(Type type) { - this.type = type; - } - - public Optional getType() { - return Optional.ofNullable(type); - } - public void setBookingList(BookingList bookingList) { this.bookingList = bookingList; } @@ -234,7 +223,6 @@ public boolean equals(Object other) { && Objects.equals(address, otherEditPersonDescriptor.address) && Objects.equals(area, otherEditPersonDescriptor.area) && Objects.equals(tags, otherEditPersonDescriptor.tags) - && Objects.equals(type, otherEditPersonDescriptor.type) && Objects.equals(bookingList, otherEditPersonDescriptor.bookingList); } @@ -244,9 +232,8 @@ public String toString() { .add("name", name) .add("phone", phone) .add("email", email) - .add("address", address) + .add("hub", address) .add("tags", tags) - .add("type", type) .add("area", area) .add("booking list", bookingList) .toString(); diff --git a/src/main/java/seedu/address/logic/commands/EditHousekeeperCommand.java b/src/main/java/housekeeping/hub/logic/commands/EditHousekeeperCommand.java similarity index 76% rename from src/main/java/seedu/address/logic/commands/EditHousekeeperCommand.java rename to src/main/java/housekeeping/hub/logic/commands/EditHousekeeperCommand.java index 0de6a4efcf3..66652a26d19 100644 --- a/src/main/java/seedu/address/logic/commands/EditHousekeeperCommand.java +++ b/src/main/java/housekeeping/hub/logic/commands/EditHousekeeperCommand.java @@ -1,29 +1,31 @@ -package seedu.address.logic.commands; +package housekeeping.hub.logic.commands; +import static housekeeping.hub.model.Model.PREDICATE_SHOW_ALL_HOUSEKEEPERS; import static java.util.Objects.requireNonNull; -import static seedu.address.model.Model.PREDICATE_SHOW_ALL_HOUSEKEEPERS; import java.util.List; import java.util.Set; -import seedu.address.commons.core.index.Index; -import seedu.address.logic.Messages; -import seedu.address.logic.commands.exceptions.CommandException; -import seedu.address.model.Model; -import seedu.address.model.person.Address; -import seedu.address.model.person.Area; -import seedu.address.model.person.Email; -import seedu.address.model.person.Housekeeper; -import seedu.address.model.person.Name; -import seedu.address.model.person.Person; -import seedu.address.model.person.Phone; -import seedu.address.model.person.Type; -import seedu.address.model.person.BookingList; -import seedu.address.model.tag.Tag; +import housekeeping.hub.commons.core.index.Index; +import housekeeping.hub.logic.Messages; +import housekeeping.hub.logic.commands.exceptions.CommandException; +import housekeeping.hub.model.Model; +import housekeeping.hub.model.person.Address; +import housekeeping.hub.model.person.Area; +import housekeeping.hub.model.person.BookingList; +import housekeeping.hub.model.person.Email; +import housekeeping.hub.model.person.Housekeeper; +import housekeeping.hub.model.person.Name; +import housekeeping.hub.model.person.Person; +import housekeeping.hub.model.person.Phone; +import housekeeping.hub.model.tag.Tag; +/** + * Edits the details of an existing housekeeper in housekeeping hub. + */ public class EditHousekeeperCommand extends EditCommand { public static final String MESSAGE_EDIT_HOUSEKEEPER_SUCCESS = "Edited Housekeeper: %1$s"; - public static final String MESSAGE_DUPLICATE_HOUSEKEEPER = "This housekeeper already exists in the address book."; + public static final String MESSAGE_DUPLICATE_HOUSEKEEPER = "This housekeeper already exists in the hub book."; public EditHousekeeperCommand(Index index, EditPersonDescriptor editPersonDescriptor) { super(index, editPersonDescriptor); diff --git a/src/main/java/seedu/address/logic/commands/EditHousekeepingDetailsCommand.java b/src/main/java/housekeeping/hub/logic/commands/EditHousekeepingDetailsCommand.java similarity index 82% rename from src/main/java/seedu/address/logic/commands/EditHousekeepingDetailsCommand.java rename to src/main/java/housekeeping/hub/logic/commands/EditHousekeepingDetailsCommand.java index 9fbff73feb5..01386e0f69f 100644 --- a/src/main/java/seedu/address/logic/commands/EditHousekeepingDetailsCommand.java +++ b/src/main/java/housekeeping/hub/logic/commands/EditHousekeepingDetailsCommand.java @@ -1,33 +1,35 @@ -package seedu.address.logic.commands; +package housekeeping.hub.logic.commands; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_LHD; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_PI; import static java.util.Objects.requireNonNull; -import static seedu.address.logic.parser.CliSyntax.PREFIX_LHD; -import static seedu.address.logic.parser.CliSyntax.PREFIX_PI; import java.time.LocalDate; import java.time.Period; -import java.util.*; - -import seedu.address.commons.core.index.Index; -import seedu.address.commons.util.CollectionUtil; -import seedu.address.commons.util.ToStringBuilder; -import seedu.address.logic.Messages; -import seedu.address.logic.commands.exceptions.CommandException; -import seedu.address.model.Model; -import seedu.address.model.person.Address; -import seedu.address.model.person.Area; -import seedu.address.model.person.Booking; -import seedu.address.model.person.Client; -import seedu.address.model.person.Email; -import seedu.address.model.person.HousekeepingDetails; -import seedu.address.model.person.Name; -import seedu.address.model.person.Person; -import seedu.address.model.person.Phone; -import seedu.address.model.person.Type; -import seedu.address.model.tag.Tag; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; + +import housekeeping.hub.commons.core.index.Index; +import housekeeping.hub.commons.util.CollectionUtil; +import housekeeping.hub.commons.util.ToStringBuilder; +import housekeeping.hub.logic.Messages; +import housekeeping.hub.logic.commands.exceptions.CommandException; +import housekeeping.hub.model.Model; +import housekeeping.hub.model.person.Address; +import housekeeping.hub.model.person.Area; +import housekeeping.hub.model.person.Booking; +import housekeeping.hub.model.person.Client; +import housekeeping.hub.model.person.Email; +import housekeeping.hub.model.person.HousekeepingDetails; +import housekeeping.hub.model.person.Name; +import housekeeping.hub.model.person.Person; +import housekeeping.hub.model.person.Phone; +import housekeeping.hub.model.tag.Tag; /** - * Edits the details of an existing person in the address book. + * Edits the details of an existing person in the hub book. */ public class EditHousekeepingDetailsCommand extends BookingCommand { @@ -45,7 +47,7 @@ public class EditHousekeepingDetailsCommand extends BookingCommand { public static final String MESSAGE_EDIT_PERSON_SUCCESS = "Edited Person: %1$s"; public static final String MESSAGE_NOT_EDITED = "At least one field to edit must be provided."; - public static final String MESSAGE_DUPLICATE_PERSON = "This person already exists in the address book."; + public static final String MESSAGE_DUPLICATE_PERSON = "This person already exists in the hub book."; protected final Index index; protected final EditHousekeepingDetailsDescriptor editPersonDescriptor; @@ -69,10 +71,13 @@ public CommandResult execute(Model model) throws CommandException { List lastShownList = model.getFilteredClientList(); if (index.getZeroBased() >= lastShownList.size()) { - throw new CommandException(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX); + throw new CommandException(Messages.MESSAGE_INVALID_CLIENT_DISPLAYED_INDEX); } Client personToEdit = lastShownList.get(index.getZeroBased()); + if (!personToEdit.hasHousekeepingDetails()) { + throw new CommandException(NO_DETAILS_MESSAGE_CONSTRAINT); + } Client editedPerson = createEditedPerson(personToEdit, editPersonDescriptor); if (!personToEdit.isSamePerson(editedPerson) && model.hasClient(editedPerson)) { @@ -88,9 +93,9 @@ public CommandResult execute(Model model) throws CommandException { * Creates and returns a {@code Person} with the details of {@code personToEdit} * edited with {@code editHousekeepingDetailsDescriptor}. */ - protected Client createEditedPerson - (Person personToEdit, - EditHousekeepingDetailsCommand.EditHousekeepingDetailsDescriptor editHousekeepingDetailsDescriptor) { + protected Client createEditedPerson( + Person personToEdit, + EditHousekeepingDetailsCommand.EditHousekeepingDetailsDescriptor editHousekeepingDetailsDescriptor) { assert personToEdit != null; Name updatedName = personToEdit.getName(); @@ -123,11 +128,11 @@ public boolean equals(Object other) { } // instanceof handles nulls - if (!(other instanceof EditCommand)) { + if (!(other instanceof EditHousekeepingDetailsCommand)) { return false; } - EditCommand otherEditCommand = (EditCommand) other; + EditHousekeepingDetailsCommand otherEditCommand = (EditHousekeepingDetailsCommand) other; return index.equals(otherEditCommand.index) && editPersonDescriptor.equals(otherEditCommand.editPersonDescriptor); } diff --git a/src/main/java/seedu/address/logic/commands/ExitCommand.java b/src/main/java/housekeeping/hub/logic/commands/ExitCommand.java similarity index 83% rename from src/main/java/seedu/address/logic/commands/ExitCommand.java rename to src/main/java/housekeeping/hub/logic/commands/ExitCommand.java index 3dd85a8ba90..24c61344a1b 100644 --- a/src/main/java/seedu/address/logic/commands/ExitCommand.java +++ b/src/main/java/housekeeping/hub/logic/commands/ExitCommand.java @@ -1,6 +1,6 @@ -package seedu.address.logic.commands; +package housekeeping.hub.logic.commands; -import seedu.address.model.Model; +import housekeeping.hub.model.Model; /** * Terminates the program. diff --git a/src/main/java/seedu/address/logic/commands/FindClientCommand.java b/src/main/java/housekeeping/hub/logic/commands/FindClientCommand.java similarity index 65% rename from src/main/java/seedu/address/logic/commands/FindClientCommand.java rename to src/main/java/housekeeping/hub/logic/commands/FindClientCommand.java index 22bffc4286a..2ec86d88e57 100644 --- a/src/main/java/seedu/address/logic/commands/FindClientCommand.java +++ b/src/main/java/housekeeping/hub/logic/commands/FindClientCommand.java @@ -1,11 +1,14 @@ -package seedu.address.logic.commands; +package housekeeping.hub.logic.commands; import static java.util.Objects.requireNonNull; -import seedu.address.logic.Messages; -import seedu.address.model.Model; -import seedu.address.model.person.ContainsKeywordsPredicate; +import housekeeping.hub.logic.Messages; +import housekeeping.hub.model.Model; +import housekeeping.hub.model.person.ContainsKeywordsPredicate; +/** + * Finds and lists all clients in the housekeeping hub with matching criteria. + */ public class FindClientCommand extends FindCommand { public FindClientCommand(ContainsKeywordsPredicate predicate) { super(predicate); diff --git a/src/main/java/seedu/address/logic/commands/FindCommand.java b/src/main/java/housekeeping/hub/logic/commands/FindCommand.java similarity index 53% rename from src/main/java/seedu/address/logic/commands/FindCommand.java rename to src/main/java/housekeeping/hub/logic/commands/FindCommand.java index c7c13292688..90cc2efa70d 100644 --- a/src/main/java/seedu/address/logic/commands/FindCommand.java +++ b/src/main/java/housekeeping/hub/logic/commands/FindCommand.java @@ -1,39 +1,18 @@ -package seedu.address.logic.commands; +package housekeeping.hub.logic.commands; -import static java.util.Objects.requireNonNull; - -import java.util.Collections; -import java.util.HashSet; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; - -import seedu.address.commons.util.CollectionUtil; -import seedu.address.commons.util.ToStringBuilder; -import seedu.address.logic.Messages; -import seedu.address.model.Model; -import seedu.address.model.person.Address; -import seedu.address.model.person.Area; -import seedu.address.model.person.BookingList; -import seedu.address.model.person.ContainsKeywordsPredicate; -import seedu.address.model.person.Email; -import seedu.address.model.person.HousekeepingDetails; -import seedu.address.model.person.Name; -import seedu.address.model.person.NameContainsKeywordsPredicate; -import seedu.address.model.person.Phone; -import seedu.address.model.person.Type; -import seedu.address.model.tag.Tag; +import housekeeping.hub.commons.util.ToStringBuilder; +import housekeeping.hub.model.person.ContainsKeywordsPredicate; /** - * Finds and lists all persons in address book whose name contains any of the argument keywords. + * Finds and lists all persons in hub book whose name contains any of the argument keywords. * Keyword matching is case-insensitive. */ -abstract public class FindCommand extends Command { +public abstract class FindCommand extends Command { public static final String COMMAND_WORD = "find"; public static final String MESSAGE_USAGE = COMMAND_WORD + ": Finds all clients or housekeepers filtered by " - + "the specified attribute(s). Valid attributes: {name, phone, address, area}\n" + + "the specified attribute(s). Valid attributes: {name, phone, hub, area}\n" + "Parameters: TYPE(client or housekeeper) PREFIX/KEYWORD [PREFIX/KEYWORDS...] (optional)\n" + "Example: " + COMMAND_WORD + " client n/alice p/90274629"; diff --git a/src/main/java/seedu/address/logic/commands/FindHousekeeperCommand.java b/src/main/java/housekeeping/hub/logic/commands/FindHousekeeperCommand.java similarity index 56% rename from src/main/java/seedu/address/logic/commands/FindHousekeeperCommand.java rename to src/main/java/housekeeping/hub/logic/commands/FindHousekeeperCommand.java index 5c018c7e425..1dfbd28e8cb 100644 --- a/src/main/java/seedu/address/logic/commands/FindHousekeeperCommand.java +++ b/src/main/java/housekeeping/hub/logic/commands/FindHousekeeperCommand.java @@ -1,11 +1,14 @@ -package seedu.address.logic.commands; +package housekeeping.hub.logic.commands; import static java.util.Objects.requireNonNull; -import seedu.address.logic.Messages; -import seedu.address.model.Model; -import seedu.address.model.person.ContainsKeywordsPredicate; +import housekeeping.hub.logic.Messages; +import housekeeping.hub.model.Model; +import housekeeping.hub.model.person.ContainsKeywordsPredicate; +/** + * Finds and lists all housekeepers in the housekeeping hub with matching criteria. + */ public class FindHousekeeperCommand extends FindCommand { public FindHousekeeperCommand(ContainsKeywordsPredicate predicate) { super(predicate); @@ -16,6 +19,7 @@ public CommandResult execute(Model model) { requireNonNull(model); model.updateFilteredHousekeeperList(predicate); return new CommandResult( - String.format(Messages.MESSAGE_HOUSEKEEPERS_LISTED_OVERVIEW, model.getFilteredHousekeeperList().size())); + String.format(Messages.MESSAGE_HOUSEKEEPERS_LISTED_OVERVIEW, + model.getFilteredHousekeeperList().size())); } } diff --git a/src/main/java/seedu/address/logic/commands/HelpCommand.java b/src/main/java/housekeeping/hub/logic/commands/HelpCommand.java similarity index 87% rename from src/main/java/seedu/address/logic/commands/HelpCommand.java rename to src/main/java/housekeeping/hub/logic/commands/HelpCommand.java index bf824f91bd0..9f370c3870c 100644 --- a/src/main/java/seedu/address/logic/commands/HelpCommand.java +++ b/src/main/java/housekeeping/hub/logic/commands/HelpCommand.java @@ -1,6 +1,6 @@ -package seedu.address.logic.commands; +package housekeeping.hub.logic.commands; -import seedu.address.model.Model; +import housekeeping.hub.model.Model; /** * Format full help instructions for every command for display. diff --git a/src/main/java/seedu/address/logic/commands/LeadsCommand.java b/src/main/java/housekeeping/hub/logic/commands/LeadsCommand.java similarity index 81% rename from src/main/java/seedu/address/logic/commands/LeadsCommand.java rename to src/main/java/housekeeping/hub/logic/commands/LeadsCommand.java index fe4a8b2162d..eaf6eb92341 100644 --- a/src/main/java/seedu/address/logic/commands/LeadsCommand.java +++ b/src/main/java/housekeeping/hub/logic/commands/LeadsCommand.java @@ -1,16 +1,16 @@ -package seedu.address.logic.commands; +package housekeeping.hub.logic.commands; import static java.util.Objects.requireNonNull; -import seedu.address.commons.util.ToStringBuilder; -import seedu.address.logic.Messages; -import seedu.address.model.Model; -import seedu.address.model.person.Client; -import seedu.address.model.person.ClientComparator; -import seedu.address.model.person.LeadsFilterPredicate; - import java.util.Comparator; +import housekeeping.hub.commons.util.ToStringBuilder; +import housekeeping.hub.logic.Messages; +import housekeeping.hub.model.Model; +import housekeeping.hub.model.person.Client; +import housekeeping.hub.model.person.ClientComparator; +import housekeeping.hub.model.person.LeadsFilterPredicate; + /** * Generates a list of leads based on the client's predicted next housekeeping date. */ diff --git a/src/main/java/seedu/address/logic/commands/ListClientCommand.java b/src/main/java/housekeeping/hub/logic/commands/ListClientCommand.java similarity index 68% rename from src/main/java/seedu/address/logic/commands/ListClientCommand.java rename to src/main/java/housekeeping/hub/logic/commands/ListClientCommand.java index 85a9ea676c0..ec72e027259 100644 --- a/src/main/java/seedu/address/logic/commands/ListClientCommand.java +++ b/src/main/java/housekeeping/hub/logic/commands/ListClientCommand.java @@ -1,10 +1,13 @@ -package seedu.address.logic.commands; +package housekeeping.hub.logic.commands; import static java.util.Objects.requireNonNull; -import seedu.address.model.Model; -import seedu.address.model.person.TypePredicate; +import housekeeping.hub.model.Model; +import housekeeping.hub.model.person.TypePredicate; +/** + * Lists all clients in the housekeeping hub to the user. + */ public class ListClientCommand extends ListCommand { public ListClientCommand() { super(new TypePredicate("client")); diff --git a/src/main/java/seedu/address/logic/commands/ListCommand.java b/src/main/java/housekeeping/hub/logic/commands/ListCommand.java similarity index 74% rename from src/main/java/seedu/address/logic/commands/ListCommand.java rename to src/main/java/housekeeping/hub/logic/commands/ListCommand.java index ba7516d4619..e24a2904671 100644 --- a/src/main/java/seedu/address/logic/commands/ListCommand.java +++ b/src/main/java/housekeeping/hub/logic/commands/ListCommand.java @@ -1,14 +1,11 @@ -package seedu.address.logic.commands; +package housekeeping.hub.logic.commands; -import static java.util.Objects.requireNonNull; - -import seedu.address.model.Model; -import seedu.address.model.person.TypePredicate; +import housekeeping.hub.model.person.TypePredicate; /** - * Lists all persons in the address book to the user. + * Lists all persons in the hub book to the user. */ -abstract public class ListCommand extends Command { +public abstract class ListCommand extends Command { public static final String COMMAND_WORD = "list"; diff --git a/src/main/java/seedu/address/logic/commands/ListHousekeeperCommand.java b/src/main/java/housekeeping/hub/logic/commands/ListHousekeeperCommand.java similarity index 69% rename from src/main/java/seedu/address/logic/commands/ListHousekeeperCommand.java rename to src/main/java/housekeeping/hub/logic/commands/ListHousekeeperCommand.java index f745e1636b5..f39a07f8d36 100644 --- a/src/main/java/seedu/address/logic/commands/ListHousekeeperCommand.java +++ b/src/main/java/housekeeping/hub/logic/commands/ListHousekeeperCommand.java @@ -1,10 +1,13 @@ -package seedu.address.logic.commands; +package housekeeping.hub.logic.commands; import static java.util.Objects.requireNonNull; -import seedu.address.model.Model; -import seedu.address.model.person.TypePredicate; +import housekeeping.hub.model.Model; +import housekeeping.hub.model.person.TypePredicate; +/** + * Lists all clients in the housekeeping hub to the user. + */ public class ListHousekeeperCommand extends ListCommand { public ListHousekeeperCommand() { super(new TypePredicate("housekeeper")); diff --git a/src/main/java/seedu/address/logic/commands/exceptions/CommandException.java b/src/main/java/housekeeping/hub/logic/commands/exceptions/CommandException.java similarity index 89% rename from src/main/java/seedu/address/logic/commands/exceptions/CommandException.java rename to src/main/java/housekeeping/hub/logic/commands/exceptions/CommandException.java index a16bd14f2cd..8a4d488ccb0 100644 --- a/src/main/java/seedu/address/logic/commands/exceptions/CommandException.java +++ b/src/main/java/housekeeping/hub/logic/commands/exceptions/CommandException.java @@ -1,4 +1,4 @@ -package seedu.address.logic.commands.exceptions; +package housekeeping.hub.logic.commands.exceptions; /** * Represents an error which occurs during execution of a {@link Command}. diff --git a/src/main/java/seedu/address/logic/parser/AddCommandParser.java b/src/main/java/housekeeping/hub/logic/parser/AddCommandParser.java similarity index 68% rename from src/main/java/seedu/address/logic/parser/AddCommandParser.java rename to src/main/java/housekeeping/hub/logic/parser/AddCommandParser.java index 7f78452c627..58b0e789b70 100644 --- a/src/main/java/seedu/address/logic/parser/AddCommandParser.java +++ b/src/main/java/housekeeping/hub/logic/parser/AddCommandParser.java @@ -1,35 +1,32 @@ -package seedu.address.logic.parser; +package housekeeping.hub.logic.parser; -import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; -import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS; -import static seedu.address.logic.parser.CliSyntax.PREFIX_DETAILS; -import static seedu.address.logic.parser.CliSyntax.PREFIX_AREA; -import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL; -import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; -import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE; -import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG; -import static seedu.address.model.person.Type.preambleIsAllowed; +import static housekeeping.hub.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_ADDRESS; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_AREA; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_DETAILS; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_EMAIL; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_NAME; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_PHONE; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_TAG; +import static housekeeping.hub.model.person.Type.preambleIsAllowed; import java.util.Set; import java.util.stream.Stream; -import seedu.address.logic.commands.AddClientCommand; -import seedu.address.logic.commands.AddCommand; -import seedu.address.logic.commands.AddHousekeeperCommand; -import seedu.address.logic.parser.exceptions.ParseException; - -import seedu.address.model.person.Address; -import seedu.address.model.person.BookingList; -import seedu.address.model.person.Area; -import seedu.address.model.person.Client; -import seedu.address.model.person.Email; -import seedu.address.model.person.HousekeepingDetails; -import seedu.address.model.person.Housekeeper; -import seedu.address.model.person.Name; -import seedu.address.model.person.Person; -import seedu.address.model.person.Phone; -import seedu.address.model.person.Type; -import seedu.address.model.tag.Tag; +import housekeeping.hub.logic.commands.AddClientCommand; +import housekeeping.hub.logic.commands.AddCommand; +import housekeeping.hub.logic.commands.AddHousekeeperCommand; +import housekeeping.hub.logic.parser.exceptions.ParseException; +import housekeeping.hub.model.person.Address; +import housekeeping.hub.model.person.Area; +import housekeeping.hub.model.person.BookingList; +import housekeeping.hub.model.person.Client; +import housekeeping.hub.model.person.Email; +import housekeeping.hub.model.person.Housekeeper; +import housekeeping.hub.model.person.HousekeepingDetails; +import housekeeping.hub.model.person.Name; +import housekeeping.hub.model.person.Phone; +import housekeeping.hub.model.tag.Tag; /** * Parses input arguments and creates a new AddCommand object @@ -43,7 +40,8 @@ public class AddCommandParser implements Parser { public AddCommand parse(String args) throws ParseException { ArgumentMultimap argMultimap = ArgumentTokenizer.tokenize(args, - PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS, PREFIX_TAG, PREFIX_DETAILS, PREFIX_AREA); + PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS, PREFIX_TAG, PREFIX_DETAILS, + PREFIX_AREA); if (!arePrefixesPresent(argMultimap, PREFIX_NAME, PREFIX_ADDRESS, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_AREA) || !preambleIsAllowed(argMultimap.getPreamble())) { diff --git a/src/main/java/seedu/address/logic/parser/AddressBookParser.java b/src/main/java/housekeeping/hub/logic/parser/AddressBookParser.java similarity index 74% rename from src/main/java/seedu/address/logic/parser/AddressBookParser.java rename to src/main/java/housekeeping/hub/logic/parser/AddressBookParser.java index 77024dde887..3d60b40083e 100644 --- a/src/main/java/seedu/address/logic/parser/AddressBookParser.java +++ b/src/main/java/housekeeping/hub/logic/parser/AddressBookParser.java @@ -1,15 +1,25 @@ -package seedu.address.logic.parser; +package housekeeping.hub.logic.parser; -import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; -import static seedu.address.logic.Messages.MESSAGE_UNKNOWN_COMMAND; +import static housekeeping.hub.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; +import static housekeeping.hub.logic.Messages.MESSAGE_UNKNOWN_COMMAND; import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; -import seedu.address.commons.core.LogsCenter; -import seedu.address.logic.commands.*; -import seedu.address.logic.parser.exceptions.ParseException; +import housekeeping.hub.commons.core.LogsCenter; +import housekeeping.hub.logic.commands.AddCommand; +import housekeeping.hub.logic.commands.BookingCommand; +import housekeeping.hub.logic.commands.ClearCommand; +import housekeeping.hub.logic.commands.Command; +import housekeeping.hub.logic.commands.DeleteCommand; +import housekeeping.hub.logic.commands.EditCommand; +import housekeeping.hub.logic.commands.ExitCommand; +import housekeeping.hub.logic.commands.FindCommand; +import housekeeping.hub.logic.commands.HelpCommand; +import housekeeping.hub.logic.commands.LeadsCommand; +import housekeeping.hub.logic.commands.ListCommand; +import housekeeping.hub.logic.parser.exceptions.ParseException; /** * Parses user input. diff --git a/src/main/java/seedu/address/logic/parser/ArgumentMultimap.java b/src/main/java/housekeeping/hub/logic/parser/ArgumentMultimap.java similarity index 95% rename from src/main/java/seedu/address/logic/parser/ArgumentMultimap.java rename to src/main/java/housekeeping/hub/logic/parser/ArgumentMultimap.java index 21e26887a83..816486c737c 100644 --- a/src/main/java/seedu/address/logic/parser/ArgumentMultimap.java +++ b/src/main/java/housekeeping/hub/logic/parser/ArgumentMultimap.java @@ -1,4 +1,4 @@ -package seedu.address.logic.parser; +package housekeeping.hub.logic.parser; import java.util.ArrayList; import java.util.HashMap; @@ -7,8 +7,8 @@ import java.util.Optional; import java.util.stream.Stream; -import seedu.address.logic.Messages; -import seedu.address.logic.parser.exceptions.ParseException; +import housekeeping.hub.logic.Messages; +import housekeeping.hub.logic.parser.exceptions.ParseException; /** * Stores mapping of prefixes to their respective arguments. diff --git a/src/main/java/seedu/address/logic/parser/ArgumentTokenizer.java b/src/main/java/housekeeping/hub/logic/parser/ArgumentTokenizer.java similarity index 99% rename from src/main/java/seedu/address/logic/parser/ArgumentTokenizer.java rename to src/main/java/housekeeping/hub/logic/parser/ArgumentTokenizer.java index 5c9aebfa488..e40ae89b082 100644 --- a/src/main/java/seedu/address/logic/parser/ArgumentTokenizer.java +++ b/src/main/java/housekeeping/hub/logic/parser/ArgumentTokenizer.java @@ -1,4 +1,4 @@ -package seedu.address.logic.parser; +package housekeeping.hub.logic.parser; import java.util.ArrayList; import java.util.Arrays; diff --git a/src/main/java/seedu/address/logic/parser/BookingCommandParser.java b/src/main/java/housekeeping/hub/logic/parser/BookingCommandParser.java similarity index 87% rename from src/main/java/seedu/address/logic/parser/BookingCommandParser.java rename to src/main/java/housekeeping/hub/logic/parser/BookingCommandParser.java index 2c3c45e9503..27e79e117f4 100644 --- a/src/main/java/seedu/address/logic/parser/BookingCommandParser.java +++ b/src/main/java/housekeeping/hub/logic/parser/BookingCommandParser.java @@ -1,19 +1,22 @@ -package seedu.address.logic.parser; +package housekeeping.hub.logic.parser; +import static housekeeping.hub.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; import static java.util.Objects.requireNonNull; -import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; import java.time.Period; import java.util.Optional; import java.util.regex.Matcher; import java.util.regex.Pattern; -import seedu.address.commons.core.index.Index; -import seedu.address.logic.commands.BookingCommand; -import seedu.address.logic.parser.exceptions.ParseException; -import seedu.address.model.person.BookingSearchPredicate; -import seedu.address.model.person.HousekeepingDetails; +import housekeeping.hub.commons.core.index.Index; +import housekeeping.hub.logic.commands.BookingCommand; +import housekeeping.hub.logic.parser.exceptions.ParseException; +import housekeeping.hub.model.person.BookingSearchPredicate; +import housekeeping.hub.model.person.HousekeepingDetails; +/** + * Parses input arguments and creates a new BookingCommand object + */ public class BookingCommandParser implements Parser { private static final Pattern PATTERN_TYPE = Pattern.compile("^(client|housekeeper).*"); private static final Pattern PATTERN_ADD = Pattern.compile( @@ -66,10 +69,10 @@ public BookingCommand parse(String args) throws ParseException { } } - private static BookingCommand clientBookingCommandParser - (Matcher addMatcher, Matcher deleteMatcher, Matcher listMatcher, - Matcher setMatcher, Matcher removeMatcher, Matcher editMatcher, - Matcher deferMatcher, String args) throws ParseException { + private static BookingCommand clientBookingCommandParser( + Matcher addMatcher, Matcher deleteMatcher, Matcher listMatcher, + Matcher setMatcher, Matcher removeMatcher, Matcher editMatcher, + Matcher deferMatcher, String args) throws ParseException { if (setMatcher.matches()) { Index clientIndex = ParserUtil.parseIndex(setMatcher.group(1)); // Date and period is not really optional since it is guaranteed by the regex. @@ -97,9 +100,9 @@ public BookingCommand parse(String args) throws ParseException { } } - private static BookingCommand housekeeperBookingCommandParser - (Matcher addMatcher, Matcher deleteMatcher, Matcher listMatcher, - Matcher searchMatcher) throws ParseException { + private static BookingCommand housekeeperBookingCommandParser( + Matcher addMatcher, Matcher deleteMatcher, Matcher listMatcher, + Matcher searchMatcher) throws ParseException { if (addMatcher.matches()) { Index housekeeperIndex = ParserUtil.parseIndex(addMatcher.group(1)); String bookedDateAndTime = addMatcher.group(2); @@ -111,7 +114,7 @@ public BookingCommand parse(String args) throws ParseException { } else if (listMatcher.matches()) { Index housekeeperIndex = ParserUtil.parseIndex(listMatcher.group(1)); return new BookingCommand(HOUSEKEEPER, LIST_COMMAND, housekeeperIndex); - } else if (searchMatcher.matches()){ + } else if (searchMatcher.matches()) { String area = searchMatcher.group(1); String bookedDateAndTime = searchMatcher.group(2) + " " + searchMatcher.group(3); BookingSearchPredicate bookingSearchPredicate = new BookingSearchPredicate(area, bookedDateAndTime); diff --git a/src/main/java/seedu/address/logic/parser/CliSyntax.java b/src/main/java/housekeeping/hub/logic/parser/CliSyntax.java similarity index 88% rename from src/main/java/seedu/address/logic/parser/CliSyntax.java rename to src/main/java/housekeeping/hub/logic/parser/CliSyntax.java index 7e585948642..a6949698a88 100644 --- a/src/main/java/seedu/address/logic/parser/CliSyntax.java +++ b/src/main/java/housekeeping/hub/logic/parser/CliSyntax.java @@ -1,4 +1,4 @@ -package seedu.address.logic.parser; +package housekeeping.hub.logic.parser; /** @@ -20,6 +20,6 @@ public class CliSyntax { public static final Prefix PREFIX_DEFERMENT = new Prefix("d/"); public static final String[] ALLOWED_PREAMBLES = new String[] {"client", "housekeeper"}; public static final String[] ALLOWED_PREAMBLES_TYPE = new String[] {"client", "housekeeper"}; - public static final String[] ALLOWED_PREAMBLES_AREA = new String[] {"north", "northeast", "east", "southeast" - , "south", "southwest", "west", "northwest"}; + public static final String[] ALLOWED_PREAMBLES_AREA = new String[] {"north", "northeast", "east", "southeast", + "south", "southwest", "west", "northwest"}; } diff --git a/src/main/java/housekeeping/hub/logic/parser/DeleteCommandParser.java b/src/main/java/housekeeping/hub/logic/parser/DeleteCommandParser.java new file mode 100644 index 00000000000..80504c06443 --- /dev/null +++ b/src/main/java/housekeeping/hub/logic/parser/DeleteCommandParser.java @@ -0,0 +1,65 @@ +package housekeeping.hub.logic.parser; + +import static housekeeping.hub.logic.Messages.MESSAGE_INVALID_CLIENT_DISPLAYED_INDEX; +import static housekeeping.hub.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; +import static housekeeping.hub.logic.Messages.MESSAGE_INVALID_HOUSEKEEPER_DISPLAYED_INDEX; + +import housekeeping.hub.commons.core.index.Index; +import housekeeping.hub.logic.commands.DeleteClientCommand; +import housekeeping.hub.logic.commands.DeleteCommand; +import housekeeping.hub.logic.commands.DeleteHousekeeperCommand; +import housekeeping.hub.logic.parser.exceptions.ParseException; + + +/** + * Parses input arguments and creates a new DeleteCommand object + */ +public class DeleteCommandParser implements Parser { + + /** + * Parses the given {@code String} of arguments in the context of the DeleteCommand + * and returns a DeleteCommand object for execution. + * @throws ParseException if the user input does not conform the expected format + */ + public DeleteCommand parse(String args) throws ParseException { + try { + String[] splitArgs = args.trim().split(" "); + + // check that input is valid + if (splitArgs.length < 2 || splitArgs.length > 2) { + throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, DeleteCommand.MESSAGE_USAGE)); + } + + String type = ParserUtil.parseType(splitArgs[0]); + Index index; + + if (type.equals("client")) { + try { + if (Integer.parseInt(splitArgs[1]) <= 0) { + throw new ParseException(MESSAGE_INVALID_CLIENT_DISPLAYED_INDEX); + } + } catch (NumberFormatException e) { + throw new ParseException(MESSAGE_INVALID_CLIENT_DISPLAYED_INDEX); + } + index = ParserUtil.parseIndex(splitArgs[1]); + return new DeleteClientCommand(index); + } else if (type.equals("housekeeper")) { + try { + if (Integer.parseInt(splitArgs[1]) <= 0) { + throw new ParseException(MESSAGE_INVALID_HOUSEKEEPER_DISPLAYED_INDEX); + } + } catch (NumberFormatException e) { + throw new ParseException(MESSAGE_INVALID_HOUSEKEEPER_DISPLAYED_INDEX); + } + index = ParserUtil.parseIndex(splitArgs[1]); + return new DeleteHousekeeperCommand(index); + } else { + throw new ParseException( + String.format(MESSAGE_INVALID_COMMAND_FORMAT, DeleteCommand.MESSAGE_USAGE)); + } + } catch (ParseException pe) { + throw new ParseException(pe.getMessage()); + } + } + +} diff --git a/src/main/java/seedu/address/logic/parser/EditCommandParser.java b/src/main/java/housekeeping/hub/logic/parser/EditCommandParser.java similarity index 68% rename from src/main/java/seedu/address/logic/parser/EditCommandParser.java rename to src/main/java/housekeeping/hub/logic/parser/EditCommandParser.java index 2a0d87c236d..9079c9b0e96 100644 --- a/src/main/java/seedu/address/logic/parser/EditCommandParser.java +++ b/src/main/java/housekeeping/hub/logic/parser/EditCommandParser.java @@ -1,24 +1,28 @@ -package seedu.address.logic.parser; - +package housekeeping.hub.logic.parser; + +import static housekeeping.hub.logic.Messages.MESSAGE_INVALID_CLIENT_DISPLAYED_INDEX; +import static housekeeping.hub.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; +import static housekeeping.hub.logic.Messages.MESSAGE_INVALID_HOUSEKEEPER_DISPLAYED_INDEX; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_ADDRESS; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_AREA; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_EMAIL; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_NAME; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_PHONE; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_TAG; import static java.util.Objects.requireNonNull; -import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; -import static seedu.address.logic.Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX; -import static seedu.address.logic.parser.CliSyntax.*; import java.util.Collection; import java.util.Collections; import java.util.Optional; import java.util.Set; -import seedu.address.commons.core.index.Index; -import seedu.address.logic.commands.DeleteCommand; -import seedu.address.logic.commands.EditClientCommand; -import seedu.address.logic.commands.EditCommand; -import seedu.address.logic.commands.EditCommand.EditPersonDescriptor; -import seedu.address.logic.commands.EditHousekeeperCommand; -import seedu.address.logic.parser.exceptions.ParseException; -import seedu.address.model.person.Type; -import seedu.address.model.tag.Tag; +import housekeeping.hub.commons.core.index.Index; +import housekeeping.hub.logic.commands.EditClientCommand; +import housekeeping.hub.logic.commands.EditCommand; +import housekeeping.hub.logic.commands.EditCommand.EditPersonDescriptor; +import housekeeping.hub.logic.commands.EditHousekeeperCommand; +import housekeeping.hub.logic.parser.exceptions.ParseException; +import housekeeping.hub.model.tag.Tag; /** * Parses input arguments and creates a new EditCommand object @@ -45,14 +49,6 @@ public EditCommand parse(String args) throws ParseException { throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, EditCommand.MESSAGE_USAGE)); } - try { - if (Integer.parseInt(splitArgs[1]) <= 0) { - throw new ParseException(MESSAGE_INVALID_PERSON_DISPLAYED_INDEX); - } - } catch (NumberFormatException e) { - throw new ParseException(MESSAGE_INVALID_PERSON_DISPLAYED_INDEX); - } - try { type = ParserUtil.parseType(splitArgs[0]); index = ParserUtil.parseIndex(splitArgs[1]); @@ -88,8 +84,24 @@ public EditCommand parse(String args) throws ParseException { } if (type.equals("client")) { + try { + if (Integer.parseInt(splitArgs[1]) <= 0) { + throw new ParseException(MESSAGE_INVALID_CLIENT_DISPLAYED_INDEX); + } + } catch (NumberFormatException e) { + throw new ParseException(MESSAGE_INVALID_CLIENT_DISPLAYED_INDEX); + } + index = ParserUtil.parseIndex(splitArgs[1]); return new EditClientCommand(index, editPersonDescriptor); } else if (type.equals("housekeeper")) { + try { + if (Integer.parseInt(splitArgs[1]) <= 0) { + throw new ParseException(MESSAGE_INVALID_HOUSEKEEPER_DISPLAYED_INDEX); + } + } catch (NumberFormatException e) { + throw new ParseException(MESSAGE_INVALID_HOUSEKEEPER_DISPLAYED_INDEX); + } + index = ParserUtil.parseIndex(splitArgs[1]); return new EditHousekeeperCommand(index, editPersonDescriptor); } else { throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, EditCommand.MESSAGE_USAGE)); diff --git a/src/main/java/seedu/address/logic/parser/EditHousekeepingDetailsParser.java b/src/main/java/housekeeping/hub/logic/parser/EditHousekeepingDetailsParser.java similarity index 78% rename from src/main/java/seedu/address/logic/parser/EditHousekeepingDetailsParser.java rename to src/main/java/housekeeping/hub/logic/parser/EditHousekeepingDetailsParser.java index 67277c1db70..6f2a8144204 100644 --- a/src/main/java/seedu/address/logic/parser/EditHousekeepingDetailsParser.java +++ b/src/main/java/housekeeping/hub/logic/parser/EditHousekeepingDetailsParser.java @@ -1,16 +1,16 @@ -package seedu.address.logic.parser; +package housekeeping.hub.logic.parser; +import static housekeeping.hub.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_BD; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_DEFERMENT; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_LHD; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_PI; import static java.util.Objects.requireNonNull; -import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; -import static seedu.address.logic.parser.CliSyntax.PREFIX_BD; -import static seedu.address.logic.parser.CliSyntax.PREFIX_DEFERMENT; -import static seedu.address.logic.parser.CliSyntax.PREFIX_LHD; -import static seedu.address.logic.parser.CliSyntax.PREFIX_PI; -import seedu.address.commons.core.index.Index; -import seedu.address.logic.commands.EditHousekeepingDetailsCommand; -import seedu.address.logic.commands.EditHousekeepingDetailsCommand.EditHousekeepingDetailsDescriptor; -import seedu.address.logic.parser.exceptions.ParseException; +import housekeeping.hub.commons.core.index.Index; +import housekeeping.hub.logic.commands.EditHousekeepingDetailsCommand; +import housekeeping.hub.logic.commands.EditHousekeepingDetailsCommand.EditHousekeepingDetailsDescriptor; +import housekeeping.hub.logic.parser.exceptions.ParseException; /** * Parses input arguments and creates a new EditCommand object diff --git a/src/main/java/seedu/address/logic/parser/FindCommandParser.java b/src/main/java/housekeeping/hub/logic/parser/FindCommandParser.java similarity index 72% rename from src/main/java/seedu/address/logic/parser/FindCommandParser.java rename to src/main/java/housekeeping/hub/logic/parser/FindCommandParser.java index 7982eace15f..05e5cf9b70c 100644 --- a/src/main/java/seedu/address/logic/parser/FindCommandParser.java +++ b/src/main/java/housekeeping/hub/logic/parser/FindCommandParser.java @@ -1,21 +1,18 @@ -package seedu.address.logic.parser; +package housekeeping.hub.logic.parser; -import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; -import static seedu.address.logic.parser.CliSyntax.*; -import static seedu.address.logic.parser.CliSyntax.PREFIX_AREA; +import static housekeeping.hub.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_ADDRESS; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_AREA; +import static housekeeping.hub.logic.parser.CliSyntax.PREFIX_NAME; import java.util.Arrays; -import seedu.address.logic.commands.EditCommand; -import seedu.address.logic.commands.FindClientCommand; -import seedu.address.logic.commands.FindCommand; -import seedu.address.logic.commands.FindHousekeeperCommand; -import seedu.address.logic.parser.exceptions.ParseException; -import seedu.address.model.person.Address; -import seedu.address.model.person.Area; -import seedu.address.model.person.ContainsKeywordsPredicate; -import seedu.address.model.person.NameContainsKeywordsPredicate; -import seedu.address.model.person.Type; +import housekeeping.hub.logic.commands.FindClientCommand; +import housekeeping.hub.logic.commands.FindCommand; +import housekeeping.hub.logic.commands.FindHousekeeperCommand; +import housekeeping.hub.logic.parser.exceptions.ParseException; +import housekeeping.hub.model.person.Area; +import housekeeping.hub.model.person.ContainsKeywordsPredicate; /** * Parses input arguments and creates a new FindCommand object @@ -53,10 +50,6 @@ public FindCommand parse(String args) throws ParseException { } if (argMultimap.getValue(PREFIX_AREA).isPresent()) { area = argMultimap.getValue(PREFIX_AREA).get(); - if (!Area.isValidArea(area)) { - throw new ParseException( - String.format(MESSAGE_INVALID_COMMAND_FORMAT, Area.MESSAGE_CONSTRAINTS)); - } } String trimmedName = name.trim(); @@ -66,6 +59,15 @@ public FindCommand parse(String args) throws ParseException { String[] addressKeywords = trimmedAddress.split("\\s+"); String[] areaKeywords = trimmedArea.split("\\s+"); + if (argMultimap.getValue(PREFIX_AREA).isPresent()) { + for (int i = 0; i < areaKeywords.length; i++) { + if (!Area.isValidArea(areaKeywords[i])) { + throw new ParseException( + String.format(MESSAGE_INVALID_COMMAND_FORMAT, Area.MESSAGE_CONSTRAINTS)); + } + } + } + if (nameKeywords[0].isEmpty() && addressKeywords[0].isEmpty() && areaKeywords[0].isEmpty()) { throw new ParseException(FindCommand.MESSAGE_NOT_FOUND); } diff --git a/src/main/java/seedu/address/logic/parser/ListCommandParser.java b/src/main/java/housekeeping/hub/logic/parser/ListCommandParser.java similarity index 78% rename from src/main/java/seedu/address/logic/parser/ListCommandParser.java rename to src/main/java/housekeeping/hub/logic/parser/ListCommandParser.java index 44ed79bf087..5fdf752f735 100644 --- a/src/main/java/seedu/address/logic/parser/ListCommandParser.java +++ b/src/main/java/housekeeping/hub/logic/parser/ListCommandParser.java @@ -1,12 +1,11 @@ -package seedu.address.logic.parser; +package housekeeping.hub.logic.parser; -import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; +import static housekeeping.hub.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; -import seedu.address.logic.commands.ListClientCommand; -import seedu.address.logic.commands.ListCommand; -import seedu.address.logic.commands.ListHousekeeperCommand; -import seedu.address.logic.parser.exceptions.ParseException; -import seedu.address.model.person.TypePredicate; +import housekeeping.hub.logic.commands.ListClientCommand; +import housekeeping.hub.logic.commands.ListCommand; +import housekeeping.hub.logic.commands.ListHousekeeperCommand; +import housekeeping.hub.logic.parser.exceptions.ParseException; /** * Parses input arguments and creates a new FindCommand object diff --git a/src/main/java/seedu/address/logic/parser/Parser.java b/src/main/java/housekeeping/hub/logic/parser/Parser.java similarity index 71% rename from src/main/java/seedu/address/logic/parser/Parser.java rename to src/main/java/housekeeping/hub/logic/parser/Parser.java index d6551ad8e3f..45ca2b11345 100644 --- a/src/main/java/seedu/address/logic/parser/Parser.java +++ b/src/main/java/housekeeping/hub/logic/parser/Parser.java @@ -1,7 +1,7 @@ -package seedu.address.logic.parser; +package housekeeping.hub.logic.parser; -import seedu.address.logic.commands.Command; -import seedu.address.logic.parser.exceptions.ParseException; +import housekeeping.hub.logic.commands.Command; +import housekeeping.hub.logic.parser.exceptions.ParseException; /** * Represents a Parser that is able to parse user input into a {@code Command} of type {@code T}. diff --git a/src/main/java/seedu/address/logic/parser/ParserUtil.java b/src/main/java/housekeeping/hub/logic/parser/ParserUtil.java similarity index 82% rename from src/main/java/seedu/address/logic/parser/ParserUtil.java rename to src/main/java/housekeeping/hub/logic/parser/ParserUtil.java index 7df6f5f8620..b22ff788ebd 100644 --- a/src/main/java/seedu/address/logic/parser/ParserUtil.java +++ b/src/main/java/housekeeping/hub/logic/parser/ParserUtil.java @@ -1,7 +1,7 @@ -package seedu.address.logic.parser; +package housekeeping.hub.logic.parser; +import static housekeeping.hub.logic.parser.CliSyntax.ALLOWED_PREAMBLES_TYPE; import static java.util.Objects.requireNonNull; -import static seedu.address.logic.parser.CliSyntax.ALLOWED_PREAMBLES_TYPE; import java.time.LocalDate; import java.time.Period; @@ -12,23 +12,28 @@ import java.util.Set; import java.util.regex.Pattern; -import seedu.address.commons.core.index.Index; -import seedu.address.commons.util.StringUtil; -import seedu.address.logic.parser.exceptions.ParseException; -import seedu.address.model.person.*; -import seedu.address.model.tag.Tag; +import housekeeping.hub.commons.core.index.Index; +import housekeeping.hub.commons.util.StringUtil; +import housekeeping.hub.logic.parser.exceptions.ParseException; +import housekeeping.hub.model.person.Address; +import housekeeping.hub.model.person.Area; +import housekeeping.hub.model.person.Booking; +import housekeeping.hub.model.person.Email; +import housekeeping.hub.model.person.HousekeepingDetails; +import housekeeping.hub.model.person.Name; +import housekeeping.hub.model.person.Phone; +import housekeeping.hub.model.person.Type; +import housekeeping.hub.model.tag.Tag; /** * Contains utility methods used for parsing strings in the various *Parser classes. */ public class ParserUtil { - - private static final Pattern PATTERN_BOOKING = Pattern.compile( - "(\\d{4}-\\d{2}-\\d{2}\\s+(am|pm))"); - public static final String MESSAGE_INVALID_INDEX = "Index is not a non-zero unsigned integer."; public static final String TYPE_VALIDATION_REGEX = "[^\\s].*"; + private static final Pattern PATTERN_BOOKING = Pattern.compile( + "(\\d{4}-\\d{2}-\\d{2}\\s+(am|pm))"); /** * Parses {@code oneBasedIndex} into an {@code Index} and returns it. Leading and trailing whitespaces will be @@ -74,10 +79,10 @@ public static Phone parsePhone(String phone) throws ParseException { } /** - * Parses a {@code String address} into an {@code Address}. + * Parses a {@code String hub} into an {@code Address}. * Leading and trailing whitespaces will be trimmed. * - * @throws ParseException if the given {@code address} is invalid. + * @throws ParseException if the given {@code hub} is invalid. */ public static Address parseAddress(String address) throws ParseException { requireNonNull(address); @@ -174,15 +179,22 @@ public static Set parseTags(Collection tags) throws ParseException return tagSet; } + /** + * Parses a {@code String lHD} into a {@code LocalDate}. + */ public static LocalDate parseLastHousekeepingDate(String lHD) throws ParseException { requireNonNull(lHD); try { - LocalDate parsedLHD = LocalDate.parse(lHD); - return parsedLHD; + LocalDate parsedLhd = LocalDate.parse(lHD); + return parsedLhd; } catch (Exception e) { throw new ParseException(HousekeepingDetails.MESSAGE_CONSTRAINTS); } } + + /** + * Parses a {@code String booking} into a {@code Booking}. + */ public static Booking parseBooking(String booking) throws ParseException { requireNonNull(booking); if (PATTERN_BOOKING.matcher(booking.trim()).matches()) { @@ -193,6 +205,9 @@ public static Booking parseBooking(String booking) throws ParseException { } } + /** + * Parses a {@code String pI} into a {@code Period}. + */ public static Period parsePreferredInterval(String pI) throws ParseException { requireNonNull(pI); String trimmedPI = pI.trim(); @@ -200,27 +215,30 @@ public static Period parsePreferredInterval(String pI) throws ParseException { Period period; int quantity = Integer.parseInt(splitPI[0]); switch (splitPI[1]) { - case "days": - period = Period.ofDays(quantity); - break; - case "weeks": - period = Period.ofWeeks(quantity); - break; - case "months": - period = Period.ofMonths(quantity); - break; - case "years": - period = Period.ofYears(quantity); - break; - default: - throw new ParseException(HousekeepingDetails.MESSAGE_CONSTRAINTS); + case "days": + period = Period.ofDays(quantity); + break; + case "weeks": + period = Period.ofWeeks(quantity); + break; + case "months": + period = Period.ofMonths(quantity); + break; + case "years": + period = Period.ofYears(quantity); + break; + default: + throw new ParseException(HousekeepingDetails.MESSAGE_CONSTRAINTS); } return period; } + /** + * Parses a {@code String details} into a {@code HousekeepingDetails}. + */ public static HousekeepingDetails parseHousekeepingDetails(Optional details) throws ParseException { if (details.isEmpty()) { - return HousekeepingDetails.empty; + return HousekeepingDetails.EMPTY; } String trimmedDetails = details.get().trim(); if (!HousekeepingDetails.isValidHousekeepingDetailsUser(trimmedDetails)) { diff --git a/src/main/java/seedu/address/logic/parser/Prefix.java b/src/main/java/housekeeping/hub/logic/parser/Prefix.java similarity index 95% rename from src/main/java/seedu/address/logic/parser/Prefix.java rename to src/main/java/housekeeping/hub/logic/parser/Prefix.java index 348b7686c8a..db2e0293715 100644 --- a/src/main/java/seedu/address/logic/parser/Prefix.java +++ b/src/main/java/housekeeping/hub/logic/parser/Prefix.java @@ -1,4 +1,4 @@ -package seedu.address.logic.parser; +package housekeeping.hub.logic.parser; /** * A prefix that marks the beginning of an argument in an arguments string. diff --git a/src/main/java/seedu/address/logic/parser/exceptions/ParseException.java b/src/main/java/housekeeping/hub/logic/parser/exceptions/ParseException.java similarity index 72% rename from src/main/java/seedu/address/logic/parser/exceptions/ParseException.java rename to src/main/java/housekeeping/hub/logic/parser/exceptions/ParseException.java index 158a1a54c1c..55691046789 100644 --- a/src/main/java/seedu/address/logic/parser/exceptions/ParseException.java +++ b/src/main/java/housekeeping/hub/logic/parser/exceptions/ParseException.java @@ -1,6 +1,6 @@ -package seedu.address.logic.parser.exceptions; +package housekeeping.hub.logic.parser.exceptions; -import seedu.address.commons.exceptions.IllegalValueException; +import housekeeping.hub.commons.exceptions.IllegalValueException; /** * Represents a parse error encountered by a parser. diff --git a/src/main/java/seedu/address/model/AddressBook.java b/src/main/java/housekeeping/hub/model/AddressBook.java similarity index 78% rename from src/main/java/seedu/address/model/AddressBook.java rename to src/main/java/housekeeping/hub/model/AddressBook.java index 2f510723a3b..29b5d994fc0 100644 --- a/src/main/java/seedu/address/model/AddressBook.java +++ b/src/main/java/housekeeping/hub/model/AddressBook.java @@ -1,20 +1,19 @@ -package seedu.address.model; +package housekeeping.hub.model; +import static housekeeping.hub.commons.util.CollectionUtil.requireAllNonNull; import static java.util.Objects.requireNonNull; import java.util.Comparator; import java.util.List; -import javafx.collections.FXCollections; +import housekeeping.hub.commons.util.ToStringBuilder; +import housekeeping.hub.model.person.Client; +import housekeeping.hub.model.person.Housekeeper; +import housekeeping.hub.model.person.UniquePersonList; import javafx.collections.ObservableList; -import seedu.address.commons.util.ToStringBuilder; -import seedu.address.model.person.Client; -import seedu.address.model.person.Housekeeper; -import seedu.address.model.person.Person; -import seedu.address.model.person.UniquePersonList; /** - * Wraps all data at the address-book level + * Wraps all data at the hub-book level * Duplicates are not allowed (by .isSamePerson comparison) */ public class AddressBook implements ReadOnlyAddressBook { @@ -79,7 +78,7 @@ public void resetData(ReadOnlyAddressBook newData) { //// person-level operations /** - * Returns true if a client with the same identity as {@code client} exists in the address book. + * Returns true if a client with the same identity as {@code client} exists in the hub book. */ public boolean hasClient(Client client) { requireNonNull(client); @@ -87,7 +86,7 @@ public boolean hasClient(Client client) { } /** - * Returns true if a housekeeper with the same identity as {@code housekeeper} exists in the address book. + * Returns true if a housekeeper with the same identity as {@code housekeeper} exists in the hub book. */ public boolean hasHousekeeper(Housekeeper housekeeper) { requireNonNull(housekeeper); @@ -95,16 +94,16 @@ public boolean hasHousekeeper(Housekeeper housekeeper) { } /** - * Adds a client to the address book. - * The client must not already exist in the address book. + * Adds a client to the hub book. + * The client must not already exist in the hub book. */ public void addClient(Client client) { clients.add(client); } /** - * Adds a housekeeper to the address book. - * The housekeeper must not already exist in the address book. + * Adds a housekeeper to the hub book. + * The housekeeper must not already exist in the hub book. */ public void addHousekeeper(Housekeeper housekeeper) { housekeepers.add(housekeeper); @@ -112,19 +111,20 @@ public void addHousekeeper(Housekeeper housekeeper) { /** * Replaces the given client {@code target} in the list with {@code editedClient}. - * {@code target} must exist in the address book. - * The client identity of {@code editedClient} must not be the same as another existing client in the address book. + * {@code target} must exist in the hub book. + * The client identity of {@code editedClient} must not be the same as another existing client in the hub book. */ public void setClient(Client target, Client editedClient) { - requireNonNull(editedClient); + requireAllNonNull(target, editedClient); clients.setPerson(target, editedClient); } /** * Replaces the given housekeeper {@code target} in the list with {@code editedHousekeeper}. - * {@code target} must exist in the address book. - * The housekeeper identity of {@code editedHousekeeper} must not be the same as another existing housekeeper in the address book. + * {@code target} must exist in the hub book. + * The housekeeper identity of {@code editedHousekeeper} must not be the same as another existing housekeeper in + * the hub book. */ public void setHousekeeper(Housekeeper target, Housekeeper editedHousekeeper) { requireNonNull(editedHousekeeper); @@ -132,21 +132,9 @@ public void setHousekeeper(Housekeeper target, Housekeeper editedHousekeeper) { housekeepers.setPerson(target, editedHousekeeper); } - /** - * Removes {@code key} from this {@code AddressBook}. - * {@code key} must exist in the address book. - */ - public void removePerson(Person key) { - if (key.isClient()) { - clients.remove((Client) key); - } else { - housekeepers.remove((Housekeeper) key); - } - } - /** * Removes {@code client} from this {@code AddressBook}. - * {@code client} must exist in the address book. + * {@code client} must exist in the hub book. */ public void removeClient(Client client) { clients.remove(client); @@ -154,7 +142,7 @@ public void removeClient(Client client) { /** * Removes {@code housekeeper} from this {@code AddressBook}. - * {@code housekeeper} must exist in the address book. + * {@code housekeeper} must exist in the hub book. */ public void removeHousekeeper(Housekeeper housekeeper) { housekeepers.remove(housekeeper); diff --git a/src/main/java/seedu/address/model/Model.java b/src/main/java/housekeeping/hub/model/Model.java similarity index 74% rename from src/main/java/seedu/address/model/Model.java rename to src/main/java/housekeeping/hub/model/Model.java index 6f428c8bbc5..fb81909c0a6 100644 --- a/src/main/java/seedu/address/model/Model.java +++ b/src/main/java/housekeeping/hub/model/Model.java @@ -1,20 +1,14 @@ -package seedu.address.model; - -import static java.util.Objects.requireNonNull; -import static seedu.address.commons.util.CollectionUtil.requireAllNonNull; +package housekeeping.hub.model; import java.nio.file.Path; import java.util.Comparator; import java.util.function.Predicate; -import java.util.logging.Logger; +import housekeeping.hub.commons.core.GuiSettings; +import housekeeping.hub.model.person.Client; +import housekeeping.hub.model.person.Housekeeper; +import housekeeping.hub.model.person.Person; import javafx.collections.ObservableList; -import javafx.collections.transformation.FilteredList; -import seedu.address.commons.core.GuiSettings; -import seedu.address.commons.core.LogsCenter; -import seedu.address.model.person.Client; -import seedu.address.model.person.Housekeeper; -import seedu.address.model.person.Person; /** * The API of the Model component. @@ -45,17 +39,17 @@ public interface Model { void setGuiSettings(GuiSettings guiSettings); /** - * Returns the user prefs' address book file path. + * Returns the user prefs' hub book file path. */ Path getAddressBookFilePath(); /** - * Sets the user prefs' address book file path. + * Sets the user prefs' hub book file path. */ void setAddressBookFilePath(Path addressBookFilePath); /** - * Replaces address book data with the data in {@code addressBook}. + * Replaces hub book data with the data in {@code addressBook}. */ void setAddressBook(ReadOnlyAddressBook addressBook); @@ -63,50 +57,51 @@ public interface Model { ReadOnlyAddressBook getAddressBook(); /** - * Returns true if a client with the same identity as {@code client} exists in the address book. + * Returns true if a client with the same identity as {@code client} exists in the hub book. */ boolean hasClient(Client client); /** - * Returns true if a housekeeper with the same identity as {@code housekeeper} exists in the address book. + * Returns true if a housekeeper with the same identity as {@code housekeeper} exists in the hub book. */ boolean hasHousekeeper(Housekeeper housekeeper); /** * Deletes the given client. - * The client must exist in the address book. + * The client must exist in the hub book. */ void deleteClient(Client target); /** * Deletes the given housekeeper. - * The housekeeper must exist in the address book. + * The housekeeper must exist in the hub book. */ void deleteHousekeeper(Housekeeper target); /** * Adds the given client. - * {@code client} must not already exist in the address book. + * {@code client} must not already exist in the hub book. */ void addClient(Client client); /** * Adds the given housekeeper. - * {@code housekeeper} must not already exist in the address book. + * {@code housekeeper} must not already exist in the hub book. */ void addHousekeeper(Housekeeper housekeeper); /** * Replaces the given client {@code target} with {@code editedClient}. - * {@code target} must exist in the address book. - * The client identity of {@code editedClient} must not be the same as another existing client in the address book. + * {@code target} must exist in the hub book. + * The client identity of {@code editedClient} must not be the same as another existing client in the hub book. */ void setClient(Client target, Client editedClient); /** * Replaces the given housekeeper {@code target} with {@code editedHousekeeper}. - * {@code target} must exist in the address book. - * The housekeeper identity of {@code editedHousekeeper} must not be the same as another existing housekeeper in the address book. + * {@code target} must exist in the hub book. + * The housekeeper identity of {@code editedHousekeeper} must not be the same as another existing housekeeper in + * the housekeeping hub. */ void setHousekeeper(Housekeeper target, Housekeeper editedHousekeeper); diff --git a/src/main/java/seedu/address/model/ModelManager.java b/src/main/java/housekeeping/hub/model/ModelManager.java similarity index 91% rename from src/main/java/seedu/address/model/ModelManager.java rename to src/main/java/housekeeping/hub/model/ModelManager.java index 24202ab2eec..1beb4f77aab 100644 --- a/src/main/java/seedu/address/model/ModelManager.java +++ b/src/main/java/housekeeping/hub/model/ModelManager.java @@ -1,23 +1,23 @@ -package seedu.address.model; +package housekeeping.hub.model; +import static housekeeping.hub.commons.util.CollectionUtil.requireAllNonNull; import static java.util.Objects.requireNonNull; -import static seedu.address.commons.util.CollectionUtil.requireAllNonNull; import java.nio.file.Path; import java.util.Comparator; import java.util.function.Predicate; import java.util.logging.Logger; +import housekeeping.hub.commons.core.GuiSettings; +import housekeeping.hub.commons.core.LogsCenter; +import housekeeping.hub.model.person.Client; +import housekeeping.hub.model.person.Housekeeper; +import housekeeping.hub.model.person.Person; import javafx.collections.ObservableList; import javafx.collections.transformation.FilteredList; -import seedu.address.commons.core.GuiSettings; -import seedu.address.commons.core.LogsCenter; -import seedu.address.model.person.Client; -import seedu.address.model.person.Housekeeper; -import seedu.address.model.person.Person; /** - * Represents the in-memory model of the address book data. + * Represents the in-memory model of the hub book data. */ public class ModelManager implements Model { private static final Logger logger = LogsCenter.getLogger(ModelManager.class); @@ -33,7 +33,7 @@ public class ModelManager implements Model { public ModelManager(ReadOnlyAddressBook addressBook, ReadOnlyUserPrefs userPrefs) { requireAllNonNull(addressBook, userPrefs); - logger.fine("Initializing with address book: " + addressBook + " and user prefs " + userPrefs); + logger.fine("Initializing with hub book: " + addressBook + " and user prefs " + userPrefs); this.addressBook = new AddressBook(addressBook); this.userPrefs = new UserPrefs(userPrefs); @@ -156,6 +156,7 @@ public ObservableList getFilteredHousekeeperList() { return filteredHousekeepers; } + @SuppressWarnings("unchecked") @Override public void updateFilteredClientList(Predicate predicate) { requireNonNull(predicate); @@ -169,6 +170,7 @@ public void updateAndSortFilteredClientList(Predicate predicate, Compara filteredClients.setPredicate(predicate); } + @SuppressWarnings("unchecked") @Override public void updateFilteredHousekeeperList(Predicate predicate) { requireNonNull(predicate); diff --git a/src/main/java/seedu/address/model/ReadOnlyAddressBook.java b/src/main/java/housekeeping/hub/model/ReadOnlyAddressBook.java similarity index 55% rename from src/main/java/seedu/address/model/ReadOnlyAddressBook.java rename to src/main/java/housekeeping/hub/model/ReadOnlyAddressBook.java index cbca8946ac7..da192012bb8 100644 --- a/src/main/java/seedu/address/model/ReadOnlyAddressBook.java +++ b/src/main/java/housekeeping/hub/model/ReadOnlyAddressBook.java @@ -1,21 +1,13 @@ -package seedu.address.model; +package housekeeping.hub.model; +import housekeeping.hub.model.person.Client; +import housekeeping.hub.model.person.Housekeeper; import javafx.collections.ObservableList; -import seedu.address.model.person.Client; -import seedu.address.model.person.Housekeeper; -import seedu.address.model.person.Person; /** - * Unmodifiable view of an address book + * Unmodifiable view of an hub book */ public interface ReadOnlyAddressBook { - - /** - * Returns an unmodifiable view of the persons list. - * This list will not contain any duplicate persons. - */ - //ObservableList getPersonList(); - /** * Returns an unmodifiable view of the clients list. * This list will not contain any duplicate clients. diff --git a/src/main/java/seedu/address/model/ReadOnlyUserPrefs.java b/src/main/java/housekeeping/hub/model/ReadOnlyUserPrefs.java similarity index 69% rename from src/main/java/seedu/address/model/ReadOnlyUserPrefs.java rename to src/main/java/housekeeping/hub/model/ReadOnlyUserPrefs.java index e6810b61b6b..2559e212030 100644 --- a/src/main/java/seedu/address/model/ReadOnlyUserPrefs.java +++ b/src/main/java/housekeeping/hub/model/ReadOnlyUserPrefs.java @@ -1,8 +1,8 @@ -package seedu.address.model; +package housekeeping.hub.model; import java.nio.file.Path; -import seedu.address.commons.core.GuiSettings; +import housekeeping.hub.commons.core.GuiSettings; /** * Unmodifiable view of user prefs. diff --git a/src/main/java/seedu/address/model/UserPrefs.java b/src/main/java/housekeeping/hub/model/UserPrefs.java similarity index 96% rename from src/main/java/seedu/address/model/UserPrefs.java rename to src/main/java/housekeeping/hub/model/UserPrefs.java index b0cc2b25a2c..4717c861962 100644 --- a/src/main/java/seedu/address/model/UserPrefs.java +++ b/src/main/java/housekeeping/hub/model/UserPrefs.java @@ -1,4 +1,4 @@ -package seedu.address.model; +package housekeeping.hub.model; import static java.util.Objects.requireNonNull; @@ -6,7 +6,7 @@ import java.nio.file.Paths; import java.util.Objects; -import seedu.address.commons.core.GuiSettings; +import housekeeping.hub.commons.core.GuiSettings; /** * Represents User's preferences. diff --git a/src/main/java/seedu/address/model/person/Address.java b/src/main/java/housekeeping/hub/model/person/Address.java similarity index 83% rename from src/main/java/seedu/address/model/person/Address.java rename to src/main/java/housekeeping/hub/model/person/Address.java index 469a2cc9a1e..4183c44cc90 100644 --- a/src/main/java/seedu/address/model/person/Address.java +++ b/src/main/java/housekeeping/hub/model/person/Address.java @@ -1,10 +1,10 @@ -package seedu.address.model.person; +package housekeeping.hub.model.person; +import static housekeeping.hub.commons.util.AppUtil.checkArgument; import static java.util.Objects.requireNonNull; -import static seedu.address.commons.util.AppUtil.checkArgument; /** - * Represents a Person's address in the address book. + * Represents a Person's hub in the hub book. * Guarantees: immutable; is valid as declared in {@link #isValidAddress(String)} */ public class Address { @@ -12,7 +12,7 @@ public class Address { public static final String MESSAGE_CONSTRAINTS = "Addresses can take any values, and it should not be blank"; /* - * The first character of the address must not be a whitespace, + * The first character of the hub must not be a whitespace, * otherwise " " (a blank string) becomes a valid input. */ public static final String VALIDATION_REGEX = "[^\\s].*"; @@ -22,7 +22,7 @@ public class Address { /** * Constructs an {@code Address}. * - * @param address A valid address. + * @param address A valid hub. */ public Address(String address) { requireNonNull(address); diff --git a/src/main/java/seedu/address/model/person/Area.java b/src/main/java/housekeeping/hub/model/person/Area.java similarity index 88% rename from src/main/java/seedu/address/model/person/Area.java rename to src/main/java/housekeeping/hub/model/person/Area.java index 8c965998735..124bb40e5cc 100644 --- a/src/main/java/seedu/address/model/person/Area.java +++ b/src/main/java/housekeeping/hub/model/person/Area.java @@ -1,11 +1,11 @@ -package seedu.address.model.person; +package housekeeping.hub.model.person; +import static housekeeping.hub.commons.util.AppUtil.checkArgument; +import static housekeeping.hub.logic.parser.CliSyntax.ALLOWED_PREAMBLES_AREA; import static java.util.Objects.requireNonNull; -import static seedu.address.commons.util.AppUtil.checkArgument; -import static seedu.address.logic.parser.CliSyntax.ALLOWED_PREAMBLES_AREA; /** - * Represents a Person's area in the address book. + * Represents a Person's area in the hub book. * Guarantees: immutable; is valid as declared in {@link #isValidArea(String)} */ public class Area { diff --git a/src/main/java/seedu/address/model/person/Booking.java b/src/main/java/housekeeping/hub/model/person/Booking.java similarity index 96% rename from src/main/java/seedu/address/model/person/Booking.java rename to src/main/java/housekeeping/hub/model/person/Booking.java index e38275be894..cbaf5010884 100644 --- a/src/main/java/seedu/address/model/person/Booking.java +++ b/src/main/java/housekeeping/hub/model/person/Booking.java @@ -1,7 +1,7 @@ -package seedu.address.model.person; +package housekeeping.hub.model.person; +import static housekeeping.hub.commons.util.AppUtil.checkArgument; import static java.util.Objects.requireNonNull; -import static seedu.address.commons.util.AppUtil.checkArgument; import java.time.LocalDate; import java.time.format.DateTimeFormatter; @@ -62,7 +62,7 @@ public static boolean isValidBookedDateAndTime(String bookedDateAndTime) { */ public static LocalDate retrieveDate(String bookedDateAndTime) { Matcher matcher = PATTERN_BOOKED_DATE_AND_TIME.matcher(bookedDateAndTime); - LocalDate parsedDate = LocalDate.ofEpochDay(2024-01-02); + LocalDate parsedDate = LocalDate.ofEpochDay(2024 - 01 - 02); if (matcher.matches()) { String dateString = matcher.group(1); parsedDate = LocalDate.parse(dateString, FORMATTER_BOOKED_DATE); diff --git a/src/main/java/seedu/address/model/person/BookingList.java b/src/main/java/housekeeping/hub/model/person/BookingList.java similarity index 95% rename from src/main/java/seedu/address/model/person/BookingList.java rename to src/main/java/housekeeping/hub/model/person/BookingList.java index 3abaadf15f1..bb9908af9c6 100644 --- a/src/main/java/seedu/address/model/person/BookingList.java +++ b/src/main/java/housekeeping/hub/model/person/BookingList.java @@ -1,4 +1,4 @@ -package seedu.address.model.person; +package housekeeping.hub.model.person; import java.util.ArrayList; import java.util.Collections; @@ -33,9 +33,9 @@ public BookingList(BookingList bookingList) { } /** - * Constructs a BookingList object with an ArrayList. + * Constructs a BookingList object with an ArrayList<{@code Booking}>. * - * @param bookingList ArrayList containing list of bookings + * @param bookingList ArrayList<{@code Booking}> containing list of bookings */ public BookingList(ArrayList bookingList) { this.bookings = bookingList; diff --git a/src/main/java/seedu/address/model/person/BookingSearchPredicate.java b/src/main/java/housekeeping/hub/model/person/BookingSearchPredicate.java similarity index 87% rename from src/main/java/seedu/address/model/person/BookingSearchPredicate.java rename to src/main/java/housekeeping/hub/model/person/BookingSearchPredicate.java index 3a74d2c4c5c..f2bc9f5c5d1 100644 --- a/src/main/java/seedu/address/model/person/BookingSearchPredicate.java +++ b/src/main/java/housekeeping/hub/model/person/BookingSearchPredicate.java @@ -1,9 +1,9 @@ -package seedu.address.model.person; +package housekeeping.hub.model.person; import java.util.function.Predicate; -import seedu.address.commons.util.StringUtil; -import seedu.address.commons.util.ToStringBuilder; +import housekeeping.hub.commons.util.StringUtil; +import housekeeping.hub.commons.util.ToStringBuilder; /** * Tests that a {@code Housekeeper}'s {@code Area} matches the specified area and that they do not have a booking @@ -50,7 +50,7 @@ public boolean equals(Object other) { } BookingSearchPredicate otherBookingSearchPredicate = (BookingSearchPredicate) other; - boolean isSameBooking = bookingToSearch.equals(otherBookingSearchPredicate.bookingToSearch); + boolean isSameBooking = bookingToSearch.equals(otherBookingSearchPredicate.bookingToSearch); return isSameBooking; } diff --git a/src/main/java/seedu/address/model/person/Client.java b/src/main/java/housekeeping/hub/model/person/Client.java similarity index 93% rename from src/main/java/seedu/address/model/person/Client.java rename to src/main/java/housekeeping/hub/model/person/Client.java index a3c98d9bb89..ef367e2e890 100644 --- a/src/main/java/seedu/address/model/person/Client.java +++ b/src/main/java/housekeeping/hub/model/person/Client.java @@ -1,15 +1,14 @@ -package seedu.address.model.person; +package housekeeping.hub.model.person; import java.time.LocalDate; -import java.util.Comparator; import java.util.Set; -import seedu.address.commons.util.ToStringBuilder; -import seedu.address.model.tag.Tag; +import housekeeping.hub.commons.util.ToStringBuilder; +import housekeeping.hub.model.tag.Tag; /** - * Represents a Person in the address book. + * Represents a Person in the hub book. * Guarantees: details are present and not null, field values are validated, immutable. */ public class Client extends Person implements Comparable { @@ -106,7 +105,7 @@ public String toString() { .add("name", this.getName()) .add("phone", this.getPhone()) .add("email", this.getEmail()) - .add("address", this.getAddress()) + .add("hub", this.getAddress()) .add("tags", this.getTags()) .add("housekeepingDetails", this.housekeepingDetails) .toString(); diff --git a/src/main/java/seedu/address/model/person/ClientComparator.java b/src/main/java/housekeeping/hub/model/person/ClientComparator.java similarity index 87% rename from src/main/java/seedu/address/model/person/ClientComparator.java rename to src/main/java/housekeeping/hub/model/person/ClientComparator.java index 954a8a286ce..77ea7268d34 100644 --- a/src/main/java/seedu/address/model/person/ClientComparator.java +++ b/src/main/java/housekeeping/hub/model/person/ClientComparator.java @@ -1,4 +1,4 @@ -package seedu.address.model.person; +package housekeeping.hub.model.person; import java.util.Comparator; diff --git a/src/main/java/seedu/address/model/person/ContainsKeywordsPredicate.java b/src/main/java/housekeeping/hub/model/person/ContainsKeywordsPredicate.java similarity index 76% rename from src/main/java/seedu/address/model/person/ContainsKeywordsPredicate.java rename to src/main/java/housekeeping/hub/model/person/ContainsKeywordsPredicate.java index 0255326ca49..28bb0f3c360 100644 --- a/src/main/java/seedu/address/model/person/ContainsKeywordsPredicate.java +++ b/src/main/java/housekeeping/hub/model/person/ContainsKeywordsPredicate.java @@ -1,10 +1,10 @@ -package seedu.address.model.person; +package housekeeping.hub.model.person; import java.util.List; import java.util.function.Predicate; -import seedu.address.commons.util.StringUtil; -import seedu.address.commons.util.ToStringBuilder; +import housekeeping.hub.commons.util.StringUtil; +import housekeeping.hub.commons.util.ToStringBuilder; /** * Tests that a {@code Person}'s {@code Name} matches any of the keywords given. @@ -14,6 +14,12 @@ public class ContainsKeywordsPredicate implements Predicate { private final List keywordsAd; private final List keywordsAr; + /** + * Constructs a ContainsKeywordsPredicate with the given keywords. + * @param keywordsN name keywords. + * @param keywordsAd address keywords. + * @param keywordsAr area keywords. + */ public ContainsKeywordsPredicate(List keywordsN, List keywordsAd, List keywordsAr) { this.keywordsN = keywordsN; this.keywordsAd = keywordsAd; @@ -52,9 +58,9 @@ public boolean equals(Object other) { } ContainsKeywordsPredicate otherContainsKeywordsPredicate = (ContainsKeywordsPredicate) other; - boolean isSameName = keywordsN.equals(otherContainsKeywordsPredicate.keywordsN); - boolean isSameAddress = keywordsAd.equals(otherContainsKeywordsPredicate.keywordsAd); - boolean isSameArea = keywordsAr.equals(otherContainsKeywordsPredicate.keywordsAr); + boolean isSameName = keywordsN.equals(otherContainsKeywordsPredicate.keywordsN); + boolean isSameAddress = keywordsAd.equals(otherContainsKeywordsPredicate.keywordsAd); + boolean isSameArea = keywordsAr.equals(otherContainsKeywordsPredicate.keywordsAr); return isSameName && isSameAddress && isSameArea; } diff --git a/src/main/java/seedu/address/model/person/Email.java b/src/main/java/housekeeping/hub/model/person/Email.java similarity index 93% rename from src/main/java/seedu/address/model/person/Email.java rename to src/main/java/housekeeping/hub/model/person/Email.java index c62e512bc29..a6a73a608a2 100644 --- a/src/main/java/seedu/address/model/person/Email.java +++ b/src/main/java/housekeeping/hub/model/person/Email.java @@ -1,10 +1,10 @@ -package seedu.address.model.person; +package housekeeping.hub.model.person; +import static housekeeping.hub.commons.util.AppUtil.checkArgument; import static java.util.Objects.requireNonNull; -import static seedu.address.commons.util.AppUtil.checkArgument; /** - * Represents a Person's email in the address book. + * Represents a Person's email in the hub book. * Guarantees: immutable; is valid as declared in {@link #isValidEmail(String)} */ public class Email { @@ -36,7 +36,7 @@ public class Email { /** * Constructs an {@code Email}. * - * @param email A valid email address. + * @param email A valid email hub. */ public Email(String email) { requireNonNull(email); diff --git a/src/main/java/seedu/address/model/person/Housekeeper.java b/src/main/java/housekeeping/hub/model/person/Housekeeper.java similarity index 95% rename from src/main/java/seedu/address/model/person/Housekeeper.java rename to src/main/java/housekeeping/hub/model/person/Housekeeper.java index 999454a4f7a..26bca8fedf1 100644 --- a/src/main/java/seedu/address/model/person/Housekeeper.java +++ b/src/main/java/housekeeping/hub/model/person/Housekeeper.java @@ -1,12 +1,12 @@ -package seedu.address.model.person; +package housekeeping.hub.model.person; import java.util.Set; -import seedu.address.model.tag.Tag; +import housekeeping.hub.model.tag.Tag; /** - * Represents a Housekeeper in the address book. + * Represents a Housekeeper in the hub book. * Guarantees: details are present and not null, field values are validated, immutable. */ public class Housekeeper extends Person { diff --git a/src/main/java/seedu/address/model/person/HousekeepingDetails.java b/src/main/java/housekeeping/hub/model/person/HousekeepingDetails.java similarity index 81% rename from src/main/java/seedu/address/model/person/HousekeepingDetails.java rename to src/main/java/housekeeping/hub/model/person/HousekeepingDetails.java index 6886dfe457a..621abaa2d4b 100644 --- a/src/main/java/seedu/address/model/person/HousekeepingDetails.java +++ b/src/main/java/housekeeping/hub/model/person/HousekeepingDetails.java @@ -1,4 +1,4 @@ -package seedu.address.model.person; +package housekeeping.hub.model.person; import java.time.LocalDate; import java.time.Period; @@ -9,12 +9,7 @@ * Represents the housekeeping details of a client. */ public class HousekeepingDetails implements Comparable { - private static final Pattern USER_FORMAT = Pattern.compile("\\d{4}-\\d{2}-\\d{2} \\d+ (days|weeks|months|years)"); - private static final Pattern STORAGE_FORMAT = - Pattern.compile("(null|(\\d{4}-\\d{2}-\\d{2})\\s" // Last housekeeping date - + "(P(?!$)(\\d+Y)?(\\d+M)?(\\d+W)?(\\d+D)?)\\s" // Preferred interval - + "(null|\\d{4}-\\d{2}-\\d{2}\\s+(am|pm))\\s" // Booking date (can be null) - + "(P(?!$)(\\d+Y)?(\\d+M)?(\\d+W)?(\\d+D)?))"); // Deferment + public static final HousekeepingDetails EMPTY = new HousekeepingDetails(); public static final String MESSAGE_CONSTRAINTS = "Housekeeping details should be in the format: yyyy-mm-dd n (days|weeks|months|years) " + "where n is an integer quantity of days, weeks, months or years."; @@ -24,8 +19,12 @@ public class HousekeepingDetails implements Comparable { + "YMWD must be in that order. All fields are optional." + "The second date is the booking date and it can be null"; public static final String NO_DETAILS_PROVIDED = "No housekeeping details provided"; - - public static final HousekeepingDetails empty = new HousekeepingDetails(); + private static final Pattern USER_FORMAT = Pattern.compile("\\d{4}-\\d{2}-\\d{2} \\d+ (days|weeks|months|years)"); + private static final Pattern STORAGE_FORMAT = + Pattern.compile("(null|(\\d{4}-\\d{2}-\\d{2})\\s" // Last housekeeping date + + "(P(?!$)(\\d+Y)?(\\d+M)?(\\d+W)?(\\d+D)?)\\s" // Preferred interval + + "(null|\\d{4}-\\d{2}-\\d{2}\\s+(am|pm))\\s" // Booking date (can be null) + + "(P(?!$)(\\d+Y)?(\\d+M)?(\\d+W)?(\\d+D)?))"); // Deferment /** The last date the housekeeping was done. */ private LocalDate lastHousekeepingDate; @@ -36,6 +35,50 @@ public class HousekeepingDetails implements Comparable { /** The period to delay calling the client */ private Period deferment; + /** + * Creates a HousekeepingDetails objectC with no details provided. + */ + public HousekeepingDetails() { + this.lastHousekeepingDate = null; + this.preferredInterval = null; + this.booking = null; + this.deferment = null; + } + + /** + * Creates a HousekeepingDetails object using a string representation of the housekeeping details used for storage. + * @param details A string representation of the housekeeping details in the format: "null" or + * yyyy-mm-dd P?Y?M?W?D? yyyy-mm-dd P?Y?M?W?D? + */ + public HousekeepingDetails(String details) { + if (details.equals("null")) { + this.lastHousekeepingDate = null; + this.preferredInterval = null; + this.booking = null; + this.deferment = null; + } else { + // Using groups to extract details + Matcher storageMatcher = STORAGE_FORMAT.matcher(details); + storageMatcher.matches(); + this.lastHousekeepingDate = LocalDate.parse(storageMatcher.group(2)); + this.preferredInterval = Period.parse(storageMatcher.group(3)); + this.booking = storageMatcher.group(8).equals("null") ? null : new Booking(storageMatcher.group(8)); + this.deferment = Period.parse(storageMatcher.group(10)); + } + } + + /** + * Creates a HousekeepingDetails object. + * @param lastHousekeepingDate + * @param preferredInterval + */ + public HousekeepingDetails(LocalDate lastHousekeepingDate, Period preferredInterval) { + this.lastHousekeepingDate = lastHousekeepingDate; + this.preferredInterval = preferredInterval; + this.booking = null; + this.deferment = Period.ZERO; + } + /** User must add as "yyyy-mm-dd n (days|weeks|months|years)" */ public static boolean isValidHousekeepingDetailsUser(String test) { Matcher userInputMatcher = USER_FORMAT.matcher(test); @@ -58,14 +101,14 @@ public static boolean isValidHousekeepingDetailsStorage(String test) { public static String makeStoredDetailsReadable(String details) { if (details.equals("null")) { return NO_DETAILS_PROVIDED; - } - else if (!isValidHousekeepingDetailsStorage(details)) { + } else if (!isValidHousekeepingDetailsStorage(details)) { return "Invalid housekeeping details format"; } // Converting Period of preferred interval to a readable format - String[] s = details.split(" "); // If valid s[0] = lastHousekeepingDate, s[1] = preferredInterval, - // s[2] = booking, s[3] = deferment + String[] s = details.split(" "); + // If valid s[0] = lastHousekeepingDate, s[1] = preferredInterval, + // s[2] = booking, s[3] = deferment String num = s[1].substring(1, s[1].length() - 1); String unit = s[1].substring(s[1].length() - 1); String unitString; @@ -102,8 +145,7 @@ else if (!isValidHousekeepingDetailsStorage(details)) { public static String makeStoredDetailsReadableWithDeferment(String details) { if (details.equals("null")) { return NO_DETAILS_PROVIDED; - } - else if (!isValidHousekeepingDetailsStorage(details)) { + } else if (!isValidHousekeepingDetailsStorage(details)) { return "Invalid housekeeping details format"; } @@ -113,40 +155,41 @@ else if (!isValidHousekeepingDetailsStorage(details)) { String numPI = s[1].substring(1, s[1].length() - 1); String unitPI = s[1].substring(s[1].length() - 1); String unitStringPI; + switch (unitPI) { - case "Y": - unitStringPI = "years"; - break; - case "M": - unitStringPI = "months"; - break; - case "W": - unitStringPI = "weeks"; - break; - case "D": - unitStringPI = "days"; - break; - default: - unitStringPI = "Invalid unit"; + case "Y": + unitStringPI = "years"; + break; + case "M": + unitStringPI = "months"; + break; + case "W": + unitStringPI = "weeks"; + break; + case "D": + unitStringPI = "days"; + break; + default: + unitStringPI = "Invalid unit"; } - String numD = s[s.length-1].substring(1, s[s.length-1].length() - 1); - String unitD= s[s.length-1].substring(s[s.length-1].length() - 1); + String numD = s[s.length - 1].substring(1, s[s.length - 1].length() - 1); + String unitD = s[s.length - 1].substring(s[s.length - 1].length() - 1); String unitStringD; switch (unitD) { - case "Y": - unitStringD = "years"; - break; - case "M": - unitStringD = "months"; - break; - case "W": - unitStringD = "weeks"; - break; - case "D": - unitStringD = "days"; - break; - default: - unitStringD = "Invalid unit"; + case "Y": + unitStringD = "years"; + break; + case "M": + unitStringD = "months"; + break; + case "W": + unitStringD = "weeks"; + break; + case "D": + unitStringD = "days"; + break; + default: + unitStringD = "Invalid unit"; } // Makes null booking readable @@ -156,55 +199,14 @@ else if (!isValidHousekeepingDetailsStorage(details)) { s[0], numPI, unitStringPI, booking, numD, unitStringD); } - /** - * Creates a HousekeepingDetails object with no details provided. - */ - public HousekeepingDetails() { - this.lastHousekeepingDate = null; - this.preferredInterval = null; - this.booking = null; - this.deferment = null; - } - - /** - * Creates a HousekeepingDetails object. - * @param lastHousekeepingDate - * @param preferredInterval - */ - public HousekeepingDetails(LocalDate lastHousekeepingDate, Period preferredInterval) { - this.lastHousekeepingDate = lastHousekeepingDate; - this.preferredInterval = preferredInterval; - this.booking = null; - this.deferment = Period.ZERO; - } - - /** - * Creates a HousekeepingDetails object using a string representation of the housekeeping details used for storage. - * @param details A string representation of the housekeeping details in the format: "null" or - * yyyy-mm-dd P?Y?M?W?D? yyyy-mm-dd P?Y?M?W?D? - */ - public HousekeepingDetails(String details) { - if (details.equals("null")) { - this.lastHousekeepingDate = null; - this.preferredInterval = null; - this.booking = null; - this.deferment = null; - } else { - // Using groups to extract details - Matcher storageMatcher = STORAGE_FORMAT.matcher(details); - storageMatcher.matches(); - this.lastHousekeepingDate = LocalDate.parse(storageMatcher.group(2)); - this.preferredInterval = Period.parse(storageMatcher.group(3)); - this.booking = storageMatcher.group(8).equals("null") ? null : new Booking(storageMatcher.group(8)); - this.deferment = Period.parse(storageMatcher.group(10)); - } - } - /** Checks if the housekeeping details is empty */ public boolean isEmpty() { - return this.equals(empty); + return this.equals(EMPTY); } + /** + * Checks if the client has a booking. + */ public boolean hasBooking() { LocalDate currentDate = LocalDate.now(); return booking != null && booking.getBookedDate().isAfter(currentDate); @@ -243,24 +245,24 @@ public String getDefermentToString() { String details = this.toString(); String[] s = details.split(" "); // If valid s[0] = lastHousekeepingDate, s[1] = preferredInterval, // s[2] = bookingDate, s[4] = deferment - String num = s[s.length-1].substring(1, s[3].length() - 1); - String unit = s[s.length-1].substring(s[s.length-1].length() - 1); + String num = s[s.length - 1].substring(1, s[3].length() - 1); + String unit = s[s.length - 1].substring(s[s.length - 1].length() - 1); String unitString; switch (unit) { - case "Y": - unitString = "years"; - break; - case "M": - unitString = "months"; - break; - case "W": - unitString = "weeks"; - break; - case "D": - unitString = "days"; - break; - default: - unitString = "Invalid unit"; + case "Y": + unitString = "years"; + break; + case "M": + unitString = "months"; + break; + case "W": + unitString = "weeks"; + break; + case "D": + unitString = "days"; + break; + default: + unitString = "Invalid unit"; } return num + " " + unitString; @@ -289,18 +291,18 @@ public boolean equals(Object other) { return ((lastHousekeepingDate == otherDetails.lastHousekeepingDate || lastHousekeepingDate.equals(otherDetails.lastHousekeepingDate)) && (preferredInterval == otherDetails.preferredInterval - ||preferredInterval.equals(otherDetails.preferredInterval)) + || preferredInterval.equals(otherDetails.preferredInterval)) && (booking == otherDetails.booking || booking.equals(otherDetails.booking)) && (deferment == otherDetails.deferment || deferment.equals(otherDetails.deferment))); - } + } @Override public String toString() { - if (this.equals(empty)) { + if (this.equals(EMPTY)) { return "null"; } return lastHousekeepingDate + " " + preferredInterval + " " + booking + " " + deferment; } - } \ No newline at end of file +} diff --git a/src/main/java/seedu/address/model/person/LeadsFilterPredicate.java b/src/main/java/housekeeping/hub/model/person/LeadsFilterPredicate.java similarity index 92% rename from src/main/java/seedu/address/model/person/LeadsFilterPredicate.java rename to src/main/java/housekeeping/hub/model/person/LeadsFilterPredicate.java index 916bf9c2f95..f85a47dedf3 100644 --- a/src/main/java/seedu/address/model/person/LeadsFilterPredicate.java +++ b/src/main/java/housekeeping/hub/model/person/LeadsFilterPredicate.java @@ -1,9 +1,9 @@ -package seedu.address.model.person; +package housekeeping.hub.model.person; import java.time.LocalDate; import java.util.function.Predicate; -import seedu.address.commons.util.ToStringBuilder; +import housekeeping.hub.commons.util.ToStringBuilder; /** * Tests that a {@code Person}'s {@code Name} matches any of the keywords given. diff --git a/src/main/java/seedu/address/model/person/Name.java b/src/main/java/housekeeping/hub/model/person/Name.java similarity index 86% rename from src/main/java/seedu/address/model/person/Name.java rename to src/main/java/housekeeping/hub/model/person/Name.java index 173f15b9b00..aad9117e2cf 100644 --- a/src/main/java/seedu/address/model/person/Name.java +++ b/src/main/java/housekeeping/hub/model/person/Name.java @@ -1,10 +1,10 @@ -package seedu.address.model.person; +package housekeeping.hub.model.person; +import static housekeeping.hub.commons.util.AppUtil.checkArgument; import static java.util.Objects.requireNonNull; -import static seedu.address.commons.util.AppUtil.checkArgument; /** - * Represents a Person's name in the address book. + * Represents a Person's name in the hub book. * Guarantees: immutable; is valid as declared in {@link #isValidName(String)} */ public class Name { @@ -13,7 +13,7 @@ public class Name { "Names should only contain alphanumeric characters and spaces, and it should not be blank"; /* - * The first character of the address must not be a whitespace, + * The first character of the hub must not be a whitespace, * otherwise " " (a blank string) becomes a valid input. */ public static final String VALIDATION_REGEX = "[\\p{Alnum}][\\p{Alnum} ]*"; diff --git a/src/main/java/seedu/address/model/person/NameContainsKeywordsPredicate.java b/src/main/java/housekeeping/hub/model/person/NameContainsKeywordsPredicate.java similarity index 89% rename from src/main/java/seedu/address/model/person/NameContainsKeywordsPredicate.java rename to src/main/java/housekeeping/hub/model/person/NameContainsKeywordsPredicate.java index 62d19be2977..730cc6fa2b8 100644 --- a/src/main/java/seedu/address/model/person/NameContainsKeywordsPredicate.java +++ b/src/main/java/housekeeping/hub/model/person/NameContainsKeywordsPredicate.java @@ -1,10 +1,10 @@ -package seedu.address.model.person; +package housekeeping.hub.model.person; import java.util.List; import java.util.function.Predicate; -import seedu.address.commons.util.StringUtil; -import seedu.address.commons.util.ToStringBuilder; +import housekeeping.hub.commons.util.StringUtil; +import housekeeping.hub.commons.util.ToStringBuilder; /** * Tests that a {@code Person}'s {@code Name} matches any of the keywords given. diff --git a/src/main/java/seedu/address/model/person/Person.java b/src/main/java/housekeeping/hub/model/person/Person.java similarity index 89% rename from src/main/java/seedu/address/model/person/Person.java rename to src/main/java/housekeeping/hub/model/person/Person.java index dd04bae7646..3db2499e60e 100644 --- a/src/main/java/seedu/address/model/person/Person.java +++ b/src/main/java/housekeeping/hub/model/person/Person.java @@ -1,17 +1,16 @@ -package seedu.address.model.person; +package housekeeping.hub.model.person; -import static seedu.address.commons.util.CollectionUtil.requireAllNonNull; +import static housekeeping.hub.commons.util.CollectionUtil.requireAllNonNull; import java.util.Collections; import java.util.HashSet; import java.util.Objects; import java.util.Set; -import seedu.address.commons.util.ToStringBuilder; -import seedu.address.model.tag.Tag; +import housekeeping.hub.model.tag.Tag; /** - * Represents a Person in the address book. + * Represents a Person in the hub book. * Guarantees: details are present and not null, field values are validated, immutable. */ public abstract class Person { diff --git a/src/main/java/seedu/address/model/person/Phone.java b/src/main/java/housekeeping/hub/model/person/Phone.java similarity index 81% rename from src/main/java/seedu/address/model/person/Phone.java rename to src/main/java/housekeeping/hub/model/person/Phone.java index d733f63d739..7af75c88273 100644 --- a/src/main/java/seedu/address/model/person/Phone.java +++ b/src/main/java/housekeeping/hub/model/person/Phone.java @@ -1,18 +1,18 @@ -package seedu.address.model.person; +package housekeeping.hub.model.person; +import static housekeeping.hub.commons.util.AppUtil.checkArgument; import static java.util.Objects.requireNonNull; -import static seedu.address.commons.util.AppUtil.checkArgument; /** - * Represents a Person's phone number in the address book. + * Represents a Person's phone number in the hub book. * Guarantees: immutable; is valid as declared in {@link #isValidPhone(String)} */ public class Phone { public static final String MESSAGE_CONSTRAINTS = - "Phone numbers should only contain numbers, and it should be at least 3 digits long"; - public static final String VALIDATION_REGEX = "\\d{3,}"; + "Phone numbers should only contain numbers, and it should be at least 3 digits long and below 16 digits"; + public static final String VALIDATION_REGEX = "\\d{3,15}"; public final String value; /** diff --git a/src/main/java/seedu/address/model/person/Type.java b/src/main/java/housekeeping/hub/model/person/Type.java similarity index 89% rename from src/main/java/seedu/address/model/person/Type.java rename to src/main/java/housekeeping/hub/model/person/Type.java index f73bb61e64a..cc065daba64 100644 --- a/src/main/java/seedu/address/model/person/Type.java +++ b/src/main/java/housekeeping/hub/model/person/Type.java @@ -1,11 +1,11 @@ -package seedu.address.model.person; +package housekeeping.hub.model.person; +import static housekeeping.hub.commons.util.AppUtil.checkArgument; +import static housekeeping.hub.logic.parser.CliSyntax.ALLOWED_PREAMBLES_TYPE; import static java.util.Objects.requireNonNull; -import static seedu.address.commons.util.AppUtil.checkArgument; -import static seedu.address.logic.parser.CliSyntax.ALLOWED_PREAMBLES_TYPE; /** - * Represents a Person's Type in the address book. + * Represents a Person's Type in the hub book. * Guarantees: immutable; is valid as declared in {@link #isValidType(String)} */ public class Type { diff --git a/src/main/java/seedu/address/model/person/TypePredicate.java b/src/main/java/housekeeping/hub/model/person/TypePredicate.java similarity index 92% rename from src/main/java/seedu/address/model/person/TypePredicate.java rename to src/main/java/housekeeping/hub/model/person/TypePredicate.java index eeeec32a1f9..cbf0ad17583 100644 --- a/src/main/java/seedu/address/model/person/TypePredicate.java +++ b/src/main/java/housekeeping/hub/model/person/TypePredicate.java @@ -1,8 +1,8 @@ -package seedu.address.model.person; +package housekeeping.hub.model.person; import java.util.function.Predicate; -import seedu.address.commons.util.ToStringBuilder; +import housekeeping.hub.commons.util.ToStringBuilder; /** * Tests that a {@code Person}'s {@code Name} matches any of the keywords given. diff --git a/src/main/java/seedu/address/model/person/UniquePersonList.java b/src/main/java/housekeeping/hub/model/person/UniquePersonList.java similarity index 93% rename from src/main/java/seedu/address/model/person/UniquePersonList.java rename to src/main/java/housekeeping/hub/model/person/UniquePersonList.java index 697d7529cba..d089a3a3e1a 100644 --- a/src/main/java/seedu/address/model/person/UniquePersonList.java +++ b/src/main/java/housekeeping/hub/model/person/UniquePersonList.java @@ -1,16 +1,16 @@ -package seedu.address.model.person; +package housekeeping.hub.model.person; +import static housekeeping.hub.commons.util.CollectionUtil.requireAllNonNull; import static java.util.Objects.requireNonNull; -import static seedu.address.commons.util.CollectionUtil.requireAllNonNull; import java.util.Comparator; import java.util.Iterator; import java.util.List; +import housekeeping.hub.model.person.exceptions.DuplicatePersonException; +import housekeeping.hub.model.person.exceptions.PersonNotFoundException; import javafx.collections.FXCollections; import javafx.collections.ObservableList; -import seedu.address.model.person.exceptions.DuplicatePersonException; -import seedu.address.model.person.exceptions.PersonNotFoundException; /** * A list of persons that enforces uniqueness between its elements and does not allow nulls. @@ -146,7 +146,7 @@ public String toString() { /** * Returns true if {@code persons} contains only unique persons. */ - private boolean personsAreUnique(List persons) { + public boolean personsAreUnique(List persons) { for (int i = 0; i < persons.size() - 1; i++) { for (int j = i + 1; j < persons.size(); j++) { if (persons.get(i).isSamePerson(persons.get(j))) { diff --git a/src/main/java/seedu/address/model/person/exceptions/DuplicatePersonException.java b/src/main/java/housekeeping/hub/model/person/exceptions/DuplicatePersonException.java similarity index 86% rename from src/main/java/seedu/address/model/person/exceptions/DuplicatePersonException.java rename to src/main/java/housekeeping/hub/model/person/exceptions/DuplicatePersonException.java index d7290f59442..0eb435b7cdd 100644 --- a/src/main/java/seedu/address/model/person/exceptions/DuplicatePersonException.java +++ b/src/main/java/housekeeping/hub/model/person/exceptions/DuplicatePersonException.java @@ -1,4 +1,4 @@ -package seedu.address.model.person.exceptions; +package housekeeping.hub.model.person.exceptions; /** * Signals that the operation will result in duplicate Persons (Persons are considered duplicates if they have the same diff --git a/src/main/java/seedu/address/model/person/exceptions/PersonNotFoundException.java b/src/main/java/housekeeping/hub/model/person/exceptions/PersonNotFoundException.java similarity index 74% rename from src/main/java/seedu/address/model/person/exceptions/PersonNotFoundException.java rename to src/main/java/housekeeping/hub/model/person/exceptions/PersonNotFoundException.java index fa764426ca7..e498705ab85 100644 --- a/src/main/java/seedu/address/model/person/exceptions/PersonNotFoundException.java +++ b/src/main/java/housekeeping/hub/model/person/exceptions/PersonNotFoundException.java @@ -1,4 +1,4 @@ -package seedu.address.model.person.exceptions; +package housekeeping.hub.model.person.exceptions; /** * Signals that the operation is unable to find the specified person. diff --git a/src/main/java/seedu/address/model/tag/Tag.java b/src/main/java/housekeeping/hub/model/tag/Tag.java similarity index 91% rename from src/main/java/seedu/address/model/tag/Tag.java rename to src/main/java/housekeeping/hub/model/tag/Tag.java index 28fba86ae8b..b8bf347c87b 100644 --- a/src/main/java/seedu/address/model/tag/Tag.java +++ b/src/main/java/housekeeping/hub/model/tag/Tag.java @@ -1,10 +1,10 @@ -package seedu.address.model.tag; +package housekeeping.hub.model.tag; +import static housekeeping.hub.commons.util.AppUtil.checkArgument; import static java.util.Objects.requireNonNull; -import static seedu.address.commons.util.AppUtil.checkArgument; /** - * Represents a Tag in the address book. + * Represents a Tag in the hub book. * Guarantees: immutable; name is valid as declared in {@link #isValidTagName(String)} */ public class Tag { diff --git a/src/main/java/housekeeping/hub/model/util/SampleDataUtil.java b/src/main/java/housekeeping/hub/model/util/SampleDataUtil.java new file mode 100644 index 00000000000..57625394d16 --- /dev/null +++ b/src/main/java/housekeeping/hub/model/util/SampleDataUtil.java @@ -0,0 +1,101 @@ +package housekeeping.hub.model.util; + +import java.util.Arrays; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import housekeeping.hub.logic.parser.ParserUtil; +import housekeeping.hub.model.AddressBook; +import housekeeping.hub.model.ReadOnlyAddressBook; +import housekeeping.hub.model.person.Address; +import housekeeping.hub.model.person.Area; +import housekeeping.hub.model.person.BookingList; +import housekeeping.hub.model.person.Client; +import housekeeping.hub.model.person.Email; +import housekeeping.hub.model.person.Housekeeper; +import housekeeping.hub.model.person.HousekeepingDetails; +import housekeeping.hub.model.person.Name; +import housekeeping.hub.model.person.Phone; +import housekeeping.hub.model.tag.Tag; + +/** + * Contains utility methods for populating {@code AddressBook} with sample data. + */ +public class SampleDataUtil { + public static Client[] getSampleClients() { + return new Client[] { + new Client(new Name("Alex Yeoh"), new Phone("87438807"), new Email("alexyeoh@example.com"), + new Address("Blk 30 Geylang Street 29, #06-40"), getTagSet("friends"), + getHousekeepingDetails(Optional.of("2024-01-30 2 months")), new Area("east")), + new Client(new Name("Bernice Yu"), new Phone("99272758"), new Email("berniceyu@example.com"), + new Address("Blk 30 Lorong 3 Serangoon Gardens, #07-18"), + getTagSet("colleagues", "friends"), + getHousekeepingDetails(Optional.of("2024-02-28 2 weeks")), new Area("east")), + new Client(new Name("Charlotte Oliveiro"), new Phone("93210283"), new Email("charlotte@example.com"), + new Address("Blk 11 Ang Mo Kio Street 74, #11-04"), getTagSet("neighbours"), + getHousekeepingDetails(Optional.of("2024-03-03 1 years")), new Area("east")), + new Client(new Name("David Li"), new Phone("91031282"), new Email("lidavid@example.com"), + new Address("Blk 436 Serangoon Gardens Street 26, #16-43"), getTagSet("family"), + getHousekeepingDetails(Optional.of("2024-03-11 39 days")), new Area("east")), + new Client(new Name("Irfan Ibrahim"), new Phone("92492021"), new Email("irfan@example.com"), + new Address("Blk 47 Tampines Street 20, #17-35"), getTagSet("classmates"), + getHousekeepingDetails(Optional.of("2024-04-01 6 months")), new Area("east")), + new Client(new Name("Roy Balakrishnan"), new Phone("92624417"), new Email("royb@example.com"), + new Address("Blk 45 Aljunied Street 85, #11-31"), getTagSet("colleagues"), + getHousekeepingDetails(Optional.empty()), new Area("east")) + }; + } + + public static Housekeeper[] getSampleHousekeepers() { + return new Housekeeper[] { + new Housekeeper(new Name("John Doe"), new Phone("12345678"), new Email("johndoe@example.com"), + new Address("Blk 123 Woodlands Street 45, #05-12"), + getTagSet("cleaning"), new Area("east"), new BookingList()), + new Housekeeper(new Name("Jane Smith"), new Phone("98765432"), new Email("janesmith@example.com"), + new Address("Blk 456 Jurong East Avenue 89, #08-15"), + getTagSet("part-time"), new Area("east"), new BookingList()), + new Housekeeper(new Name("Michael Tan"), new Phone("87654321"), new Email("michaeltan@example.com"), + new Address("Blk 789 Bukit Timah Road, #02-34"), + getTagSet("full-time"), new Area("east"), new BookingList()), + new Housekeeper(new Name("Emily Lee"), new Phone("98761234"), new Email("emilylee@example.com"), + new Address("Blk 234 Sengkang Street 12, #07-23"), + getTagSet("pet-friendly"), new Area("east"), new BookingList()), + new Housekeeper(new Name("Daniel Lim"), new Phone("87651234"), new Email("daniellim@example.com"), + new Address("Blk 345 Yishun Avenue 67, #10-45"), + getTagSet("experienced"), new Area("east"), new BookingList()), + new Housekeeper(new Name("Samantha Tan"), new Phone("76543210"), new Email("samanthatan@example.com"), + new Address("Blk 678 Clementi Road, #03-21"), + getTagSet("trustworthy"), new Area("east"), new BookingList()) + }; + } + + public static ReadOnlyAddressBook getSampleAddressBook() { + AddressBook sampleAb = new AddressBook(); + for (Client sampleClient : getSampleClients()) { + sampleAb.addClient(sampleClient); + } + for (Housekeeper sampleHousekeeper : getSampleHousekeepers()) { + sampleAb.addHousekeeper(sampleHousekeeper); + } + return sampleAb; + } + + /** + * Returns a tag set containing the list of strings given. + */ + public static Set getTagSet(String... strings) { + return Arrays.stream(strings) + .map(Tag::new) + .collect(Collectors.toSet()); + } + + public static HousekeepingDetails getHousekeepingDetails(Optional details) { + try { + return ParserUtil.parseHousekeepingDetails(details); + } catch (Exception e) { + return null; + } + } + +} diff --git a/src/main/java/seedu/address/storage/AddressBookStorage.java b/src/main/java/housekeeping/hub/storage/AddressBookStorage.java similarity index 83% rename from src/main/java/seedu/address/storage/AddressBookStorage.java rename to src/main/java/housekeeping/hub/storage/AddressBookStorage.java index 490685ad07b..6ae36555f54 100644 --- a/src/main/java/seedu/address/storage/AddressBookStorage.java +++ b/src/main/java/housekeeping/hub/storage/AddressBookStorage.java @@ -1,14 +1,14 @@ -package seedu.address.storage; +package housekeeping.hub.storage; import java.io.IOException; import java.nio.file.Path; import java.util.Optional; -import seedu.address.commons.exceptions.DataLoadingException; -import seedu.address.model.ReadOnlyAddressBook; +import housekeeping.hub.commons.exceptions.DataLoadingException; +import housekeeping.hub.model.ReadOnlyAddressBook; /** - * Represents a storage for {@link seedu.address.model.AddressBook}. + * Represents a storage for {@link housekeeping.hub.model.AddressBook}. */ public interface AddressBookStorage { diff --git a/src/main/java/seedu/address/storage/JsonAdaptedBooking.java b/src/main/java/housekeeping/hub/storage/JsonAdaptedBooking.java similarity index 70% rename from src/main/java/seedu/address/storage/JsonAdaptedBooking.java rename to src/main/java/housekeeping/hub/storage/JsonAdaptedBooking.java index e1ee2e2e18b..b4322472d76 100644 --- a/src/main/java/seedu/address/storage/JsonAdaptedBooking.java +++ b/src/main/java/housekeeping/hub/storage/JsonAdaptedBooking.java @@ -1,10 +1,10 @@ -package seedu.address.storage; +package housekeeping.hub.storage; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -import seedu.address.commons.exceptions.IllegalValueException; -import seedu.address.model.person.Booking; +import housekeeping.hub.commons.exceptions.IllegalValueException; +import housekeeping.hub.model.person.Booking; /** * Jackson-friendly version of {@link Booking}. @@ -38,10 +38,10 @@ public String getBooking() { * * @throws IllegalValueException if there were any data constraints violated in the adapted booking. */ - public Booking toModelType() throws IllegalValueException { - if (!Booking.isValidBookedDateAndTime(booking)) { - throw new IllegalValueException(Booking.MESSAGE_CONSTRAINTS); - } - return new Booking(booking); - } + public Booking toModelType() throws IllegalValueException { + if (!Booking.isValidBookedDateAndTime(booking)) { + throw new IllegalValueException(Booking.MESSAGE_CONSTRAINTS); + } + return new Booking(booking); + } } diff --git a/src/main/java/seedu/address/storage/JsonAdaptedClient.java b/src/main/java/housekeeping/hub/storage/JsonAdaptedClient.java similarity index 85% rename from src/main/java/seedu/address/storage/JsonAdaptedClient.java rename to src/main/java/housekeeping/hub/storage/JsonAdaptedClient.java index 065dcaba153..de6c077dd0d 100644 --- a/src/main/java/seedu/address/storage/JsonAdaptedClient.java +++ b/src/main/java/housekeeping/hub/storage/JsonAdaptedClient.java @@ -1,25 +1,26 @@ -package seedu.address.storage; +package housekeeping.hub.storage; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; -import java.util.stream.Collectors; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; -import seedu.address.commons.exceptions.IllegalValueException; -import seedu.address.model.person.Address; -import seedu.address.model.person.Area; -import seedu.address.model.person.Client; -import seedu.address.model.person.Email; -import seedu.address.model.person.HousekeepingDetails; -import seedu.address.model.person.Name; -import seedu.address.model.person.Phone; -import seedu.address.model.person.Type; -import seedu.address.model.tag.Tag; +import housekeeping.hub.commons.exceptions.IllegalValueException; +import housekeeping.hub.model.person.Address; +import housekeeping.hub.model.person.Area; +import housekeeping.hub.model.person.Client; +import housekeeping.hub.model.person.Email; +import housekeeping.hub.model.person.HousekeepingDetails; +import housekeeping.hub.model.person.Name; +import housekeeping.hub.model.person.Phone; +import housekeeping.hub.model.tag.Tag; +/** + * Jackson-friendly version of {@link Client}. + */ public class JsonAdaptedClient extends JsonAdaptedPerson { protected final JsonAdaptedDetails details; @@ -28,7 +29,7 @@ public class JsonAdaptedClient extends JsonAdaptedPerson { */ @JsonCreator public JsonAdaptedClient(@JsonProperty("name") String name, @JsonProperty("phone") String phone, - @JsonProperty("email") String email, @JsonProperty("address") String address, + @JsonProperty("email") String email, @JsonProperty("hub") String address, @JsonProperty("tags") List tags, @JsonProperty("details") JsonAdaptedDetails details, @JsonProperty("area") String area) { super(name, phone, email, address, tags, area); @@ -90,7 +91,7 @@ public Client toModelType() throws IllegalValueException { } final HousekeepingDetails modelDetail = details.toModelType(); final Area modelArea = new Area(area); - + return new Client(modelName, modelPhone, modelEmail, modelAddress, modelTags, modelDetail, modelArea); } } diff --git a/src/main/java/seedu/address/storage/JsonAdaptedDetails.java b/src/main/java/housekeeping/hub/storage/JsonAdaptedDetails.java similarity index 78% rename from src/main/java/seedu/address/storage/JsonAdaptedDetails.java rename to src/main/java/housekeeping/hub/storage/JsonAdaptedDetails.java index 233f85b0cd0..5b49a97e44f 100644 --- a/src/main/java/seedu/address/storage/JsonAdaptedDetails.java +++ b/src/main/java/housekeeping/hub/storage/JsonAdaptedDetails.java @@ -1,10 +1,10 @@ -package seedu.address.storage; +package housekeeping.hub.storage; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -import seedu.address.commons.exceptions.IllegalValueException; -import seedu.address.model.person.HousekeepingDetails; +import housekeeping.hub.commons.exceptions.IllegalValueException; +import housekeeping.hub.model.person.HousekeepingDetails; /** * Jackson-friendly version of {@link HousekeepingDetails}. @@ -33,6 +33,9 @@ public String getDetails() { return details; } + /** + * Converts this Jackson-friendly adapted details object into the model's {@code HousekeepingDetails} object. + */ public HousekeepingDetails toModelType() throws IllegalValueException { if (!HousekeepingDetails.isValidHousekeepingDetailsStorage(details)) { throw new IllegalValueException(HousekeepingDetails.MESSAGE_CONSTRAINTS); diff --git a/src/main/java/seedu/address/storage/JsonAdaptedHousekeeper.java b/src/main/java/housekeeping/hub/storage/JsonAdaptedHousekeeper.java similarity index 85% rename from src/main/java/seedu/address/storage/JsonAdaptedHousekeeper.java rename to src/main/java/housekeeping/hub/storage/JsonAdaptedHousekeeper.java index 6f74d1c6cc8..7e647b717f7 100644 --- a/src/main/java/seedu/address/storage/JsonAdaptedHousekeeper.java +++ b/src/main/java/housekeeping/hub/storage/JsonAdaptedHousekeeper.java @@ -1,4 +1,4 @@ -package seedu.address.storage; +package housekeeping.hub.storage; import java.util.ArrayList; import java.util.HashSet; @@ -8,19 +8,20 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; -import seedu.address.commons.exceptions.IllegalValueException; -import seedu.address.model.person.Address; -import seedu.address.model.person.Booking; -import seedu.address.model.person.BookingList; -import seedu.address.model.person.Client; -import seedu.address.model.person.Area; -import seedu.address.model.person.Email; -import seedu.address.model.person.Housekeeper; -import seedu.address.model.person.Name; -import seedu.address.model.person.Phone; -import seedu.address.model.person.Type; -import seedu.address.model.tag.Tag; - +import housekeeping.hub.commons.exceptions.IllegalValueException; +import housekeeping.hub.model.person.Address; +import housekeeping.hub.model.person.Area; +import housekeeping.hub.model.person.Booking; +import housekeeping.hub.model.person.BookingList; +import housekeeping.hub.model.person.Email; +import housekeeping.hub.model.person.Housekeeper; +import housekeeping.hub.model.person.Name; +import housekeeping.hub.model.person.Phone; +import housekeeping.hub.model.tag.Tag; + +/** + * Jackson-friendly version of {@link Housekeeper}. + */ public class JsonAdaptedHousekeeper extends JsonAdaptedPerson { protected final ArrayList bookingList; @@ -29,7 +30,7 @@ public class JsonAdaptedHousekeeper extends JsonAdaptedPerson { */ @JsonCreator public JsonAdaptedHousekeeper(@JsonProperty("name") String name, @JsonProperty("phone") String phone, - @JsonProperty("email") String email, @JsonProperty("address") String address, + @JsonProperty("email") String email, @JsonProperty("hub") String address, @JsonProperty("tags") List tags, @JsonProperty("area") String area, @JsonProperty("booking list") ArrayList bookingList) { super(name, phone, email, address, tags, area); diff --git a/src/main/java/seedu/address/storage/JsonAdaptedPerson.java b/src/main/java/housekeeping/hub/storage/JsonAdaptedPerson.java similarity index 76% rename from src/main/java/seedu/address/storage/JsonAdaptedPerson.java rename to src/main/java/housekeeping/hub/storage/JsonAdaptedPerson.java index 0991e78f260..f132755ebef 100644 --- a/src/main/java/seedu/address/storage/JsonAdaptedPerson.java +++ b/src/main/java/housekeeping/hub/storage/JsonAdaptedPerson.java @@ -1,24 +1,14 @@ -package seedu.address.storage; +package housekeeping.hub.storage; import java.util.ArrayList; -import java.util.HashSet; import java.util.List; -import java.util.Set; import java.util.stream.Collectors; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; -import seedu.address.commons.exceptions.IllegalValueException; -import seedu.address.model.person.Address; -import seedu.address.model.person.Client; -import seedu.address.model.person.Email; -import seedu.address.model.person.Housekeeper; -import seedu.address.model.person.Name; -import seedu.address.model.person.Person; -import seedu.address.model.person.Phone; -import seedu.address.model.person.Type; -import seedu.address.model.tag.Tag; +import housekeeping.hub.commons.exceptions.IllegalValueException; +import housekeeping.hub.model.person.Person; /** * Jackson-friendly version of {@link Person}. @@ -39,7 +29,7 @@ abstract class JsonAdaptedPerson { */ @JsonCreator public JsonAdaptedPerson(@JsonProperty("name") String name, @JsonProperty("phone") String phone, - @JsonProperty("email") String email, @JsonProperty("address") String address, + @JsonProperty("email") String email, @JsonProperty("hub") String address, @JsonProperty("tags") List tags, @JsonProperty("area") String area) { this.name = name; this.phone = phone; @@ -70,5 +60,5 @@ public JsonAdaptedPerson(Person source) { * * @throws IllegalValueException if there were any data constraints violated in the adapted person. */ - abstract public Person toModelType() throws IllegalValueException; + public abstract Person toModelType() throws IllegalValueException; } diff --git a/src/main/java/seedu/address/storage/JsonAdaptedTag.java b/src/main/java/housekeeping/hub/storage/JsonAdaptedTag.java similarity index 88% rename from src/main/java/seedu/address/storage/JsonAdaptedTag.java rename to src/main/java/housekeeping/hub/storage/JsonAdaptedTag.java index 0df22bdb754..8badd29bc6f 100644 --- a/src/main/java/seedu/address/storage/JsonAdaptedTag.java +++ b/src/main/java/housekeeping/hub/storage/JsonAdaptedTag.java @@ -1,10 +1,10 @@ -package seedu.address.storage; +package housekeeping.hub.storage; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -import seedu.address.commons.exceptions.IllegalValueException; -import seedu.address.model.tag.Tag; +import housekeeping.hub.commons.exceptions.IllegalValueException; +import housekeeping.hub.model.tag.Tag; /** * Jackson-friendly version of {@link Tag}. diff --git a/src/main/java/seedu/address/storage/JsonAddressBookStorage.java b/src/main/java/housekeeping/hub/storage/JsonAddressBookStorage.java similarity index 86% rename from src/main/java/seedu/address/storage/JsonAddressBookStorage.java rename to src/main/java/housekeeping/hub/storage/JsonAddressBookStorage.java index 41e06f264e1..d8a6fe8adbf 100644 --- a/src/main/java/seedu/address/storage/JsonAddressBookStorage.java +++ b/src/main/java/housekeeping/hub/storage/JsonAddressBookStorage.java @@ -1,4 +1,4 @@ -package seedu.address.storage; +package housekeeping.hub.storage; import static java.util.Objects.requireNonNull; @@ -7,12 +7,12 @@ import java.util.Optional; import java.util.logging.Logger; -import seedu.address.commons.core.LogsCenter; -import seedu.address.commons.exceptions.DataLoadingException; -import seedu.address.commons.exceptions.IllegalValueException; -import seedu.address.commons.util.FileUtil; -import seedu.address.commons.util.JsonUtil; -import seedu.address.model.ReadOnlyAddressBook; +import housekeeping.hub.commons.core.LogsCenter; +import housekeeping.hub.commons.exceptions.DataLoadingException; +import housekeeping.hub.commons.exceptions.IllegalValueException; +import housekeeping.hub.commons.util.FileUtil; +import housekeeping.hub.commons.util.JsonUtil; +import housekeeping.hub.model.ReadOnlyAddressBook; /** * A class to access AddressBook data stored as a json file on the hard disk. diff --git a/src/main/java/seedu/address/storage/JsonSerializableAddressBook.java b/src/main/java/housekeeping/hub/storage/JsonSerializableAddressBook.java similarity index 86% rename from src/main/java/seedu/address/storage/JsonSerializableAddressBook.java rename to src/main/java/housekeeping/hub/storage/JsonSerializableAddressBook.java index 94ed08a23dd..2cfedd7c819 100644 --- a/src/main/java/seedu/address/storage/JsonSerializableAddressBook.java +++ b/src/main/java/housekeeping/hub/storage/JsonSerializableAddressBook.java @@ -1,4 +1,4 @@ -package seedu.address.storage; +package housekeeping.hub.storage; import java.util.ArrayList; import java.util.List; @@ -8,12 +8,11 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; -import seedu.address.commons.exceptions.IllegalValueException; -import seedu.address.model.AddressBook; -import seedu.address.model.ReadOnlyAddressBook; -import seedu.address.model.person.Client; -import seedu.address.model.person.Housekeeper; -import seedu.address.model.person.Person; +import housekeeping.hub.commons.exceptions.IllegalValueException; +import housekeeping.hub.model.AddressBook; +import housekeeping.hub.model.ReadOnlyAddressBook; +import housekeeping.hub.model.person.Client; +import housekeeping.hub.model.person.Housekeeper; /** * An Immutable AddressBook that is serializable to JSON format. @@ -49,7 +48,7 @@ public JsonSerializableAddressBook(ReadOnlyAddressBook source) { } /** - * Converts this address book into the model's {@code AddressBook} object. + * Converts this hub book into the model's {@code AddressBook} object. * * @throws IllegalValueException if there were any data constraints violated. */ diff --git a/src/main/java/seedu/address/storage/JsonUserPrefsStorage.java b/src/main/java/housekeeping/hub/storage/JsonUserPrefsStorage.java similarity index 82% rename from src/main/java/seedu/address/storage/JsonUserPrefsStorage.java rename to src/main/java/housekeeping/hub/storage/JsonUserPrefsStorage.java index 48a9754807d..583ad4a3db4 100644 --- a/src/main/java/seedu/address/storage/JsonUserPrefsStorage.java +++ b/src/main/java/housekeeping/hub/storage/JsonUserPrefsStorage.java @@ -1,13 +1,13 @@ -package seedu.address.storage; +package housekeeping.hub.storage; import java.io.IOException; import java.nio.file.Path; import java.util.Optional; -import seedu.address.commons.exceptions.DataLoadingException; -import seedu.address.commons.util.JsonUtil; -import seedu.address.model.ReadOnlyUserPrefs; -import seedu.address.model.UserPrefs; +import housekeeping.hub.commons.exceptions.DataLoadingException; +import housekeeping.hub.commons.util.JsonUtil; +import housekeeping.hub.model.ReadOnlyUserPrefs; +import housekeeping.hub.model.UserPrefs; /** * A class to access UserPrefs stored in the hard disk as a json file diff --git a/src/main/java/seedu/address/storage/Storage.java b/src/main/java/housekeeping/hub/storage/Storage.java similarity index 71% rename from src/main/java/seedu/address/storage/Storage.java rename to src/main/java/housekeeping/hub/storage/Storage.java index 9fba0c7a1d6..6739fe2b2e5 100644 --- a/src/main/java/seedu/address/storage/Storage.java +++ b/src/main/java/housekeeping/hub/storage/Storage.java @@ -1,13 +1,13 @@ -package seedu.address.storage; +package housekeeping.hub.storage; import java.io.IOException; import java.nio.file.Path; import java.util.Optional; -import seedu.address.commons.exceptions.DataLoadingException; -import seedu.address.model.ReadOnlyAddressBook; -import seedu.address.model.ReadOnlyUserPrefs; -import seedu.address.model.UserPrefs; +import housekeeping.hub.commons.exceptions.DataLoadingException; +import housekeeping.hub.model.ReadOnlyAddressBook; +import housekeeping.hub.model.ReadOnlyUserPrefs; +import housekeeping.hub.model.UserPrefs; /** * API of the Storage component diff --git a/src/main/java/seedu/address/storage/StorageManager.java b/src/main/java/housekeeping/hub/storage/StorageManager.java similarity index 89% rename from src/main/java/seedu/address/storage/StorageManager.java rename to src/main/java/housekeeping/hub/storage/StorageManager.java index 78c378dd4ce..4067eb8fd58 100644 --- a/src/main/java/seedu/address/storage/StorageManager.java +++ b/src/main/java/housekeeping/hub/storage/StorageManager.java @@ -1,15 +1,15 @@ -package seedu.address.storage; +package housekeeping.hub.storage; import java.io.IOException; import java.nio.file.Path; import java.util.Optional; import java.util.logging.Logger; -import seedu.address.commons.core.LogsCenter; -import seedu.address.commons.exceptions.DataLoadingException; -import seedu.address.model.ReadOnlyAddressBook; -import seedu.address.model.ReadOnlyUserPrefs; -import seedu.address.model.UserPrefs; +import housekeeping.hub.commons.core.LogsCenter; +import housekeeping.hub.commons.exceptions.DataLoadingException; +import housekeeping.hub.model.ReadOnlyAddressBook; +import housekeeping.hub.model.ReadOnlyUserPrefs; +import housekeeping.hub.model.UserPrefs; /** * Manages storage of AddressBook data in local storage. diff --git a/src/main/java/seedu/address/storage/UserPrefsStorage.java b/src/main/java/housekeeping/hub/storage/UserPrefsStorage.java similarity index 67% rename from src/main/java/seedu/address/storage/UserPrefsStorage.java rename to src/main/java/housekeeping/hub/storage/UserPrefsStorage.java index e94ca422ea8..66d2442588e 100644 --- a/src/main/java/seedu/address/storage/UserPrefsStorage.java +++ b/src/main/java/housekeeping/hub/storage/UserPrefsStorage.java @@ -1,15 +1,15 @@ -package seedu.address.storage; +package housekeeping.hub.storage; import java.io.IOException; import java.nio.file.Path; import java.util.Optional; -import seedu.address.commons.exceptions.DataLoadingException; -import seedu.address.model.ReadOnlyUserPrefs; -import seedu.address.model.UserPrefs; +import housekeeping.hub.commons.exceptions.DataLoadingException; +import housekeeping.hub.model.ReadOnlyUserPrefs; +import housekeeping.hub.model.UserPrefs; /** - * Represents a storage for {@link seedu.address.model.UserPrefs}. + * Represents a storage for {@link housekeeping.hub.model.UserPrefs}. */ public interface UserPrefsStorage { @@ -27,7 +27,7 @@ public interface UserPrefsStorage { Optional readUserPrefs() throws DataLoadingException; /** - * Saves the given {@link seedu.address.model.ReadOnlyUserPrefs} to the storage. + * Saves the given {@link housekeeping.hub.model.ReadOnlyUserPrefs} to the storage. * @param userPrefs cannot be null. * @throws IOException if there was any problem writing to the file. */ diff --git a/src/main/java/seedu/address/ui/ClientCard.java b/src/main/java/housekeeping/hub/ui/ClientCard.java similarity index 67% rename from src/main/java/seedu/address/ui/ClientCard.java rename to src/main/java/housekeeping/hub/ui/ClientCard.java index fa08438f82a..d5dfc8800b2 100644 --- a/src/main/java/seedu/address/ui/ClientCard.java +++ b/src/main/java/housekeeping/hub/ui/ClientCard.java @@ -1,15 +1,21 @@ -package seedu.address.ui; +package housekeeping.hub.ui; +import housekeeping.hub.model.person.Client; +import housekeeping.hub.model.person.HousekeepingDetails; import javafx.fxml.FXML; import javafx.scene.control.Label; -import seedu.address.model.person.Client; -import seedu.address.model.person.HousekeepingDetails; +/** + * An UI component that displays information of a {@code Client}. + */ public class ClientCard extends PersonCard { private static final String FXML = "ClientListCard.fxml"; @FXML private Label details; + /** + * Creates a {@code ClientCard} with the given {@code Client} and index to display. + */ public ClientCard(Client client, int displayedIndex) { super(client, displayedIndex, FXML); HousekeepingDetails housekeepingDetails = client.getDetails(); diff --git a/src/main/java/seedu/address/ui/CommandBox.java b/src/main/java/housekeeping/hub/ui/CommandBox.java similarity index 89% rename from src/main/java/seedu/address/ui/CommandBox.java rename to src/main/java/housekeeping/hub/ui/CommandBox.java index 9e75478664b..699e3dd62bb 100644 --- a/src/main/java/seedu/address/ui/CommandBox.java +++ b/src/main/java/housekeeping/hub/ui/CommandBox.java @@ -1,12 +1,12 @@ -package seedu.address.ui; +package housekeeping.hub.ui; +import housekeeping.hub.logic.commands.CommandResult; +import housekeeping.hub.logic.commands.exceptions.CommandException; +import housekeeping.hub.logic.parser.exceptions.ParseException; import javafx.collections.ObservableList; import javafx.fxml.FXML; import javafx.scene.control.TextField; import javafx.scene.layout.Region; -import seedu.address.logic.commands.CommandResult; -import seedu.address.logic.commands.exceptions.CommandException; -import seedu.address.logic.parser.exceptions.ParseException; /** * The UI component that is responsible for receiving user command inputs. @@ -77,7 +77,7 @@ public interface CommandExecutor { /** * Executes the command and returns the result. * - * @see seedu.address.logic.Logic#execute(String) + * @see housekeeping.hub.logic.Logic#execute(String) */ CommandResult execute(String commandText) throws CommandException, ParseException; } diff --git a/src/main/java/seedu/address/ui/HelpWindow.java b/src/main/java/housekeeping/hub/ui/HelpWindow.java similarity index 97% rename from src/main/java/seedu/address/ui/HelpWindow.java rename to src/main/java/housekeeping/hub/ui/HelpWindow.java index 6f16ab10c48..597bcc79b19 100644 --- a/src/main/java/seedu/address/ui/HelpWindow.java +++ b/src/main/java/housekeeping/hub/ui/HelpWindow.java @@ -1,14 +1,14 @@ -package seedu.address.ui; +package housekeeping.hub.ui; import java.util.logging.Logger; +import housekeeping.hub.commons.core.LogsCenter; import javafx.fxml.FXML; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.input.Clipboard; import javafx.scene.input.ClipboardContent; import javafx.stage.Stage; -import seedu.address.commons.core.LogsCenter; /** * Controller for a help page diff --git a/src/main/java/seedu/address/ui/HousekeeperCard.java b/src/main/java/housekeeping/hub/ui/HousekeeperCard.java similarity index 61% rename from src/main/java/seedu/address/ui/HousekeeperCard.java rename to src/main/java/housekeeping/hub/ui/HousekeeperCard.java index 3c13783098e..2d1e2d4ba86 100644 --- a/src/main/java/seedu/address/ui/HousekeeperCard.java +++ b/src/main/java/housekeeping/hub/ui/HousekeeperCard.java @@ -1,7 +1,10 @@ -package seedu.address.ui; +package housekeeping.hub.ui; -import seedu.address.model.person.Housekeeper; +import housekeeping.hub.model.person.Housekeeper; +/** + * An UI component that displays information of a {@code Housekeeper}. + */ public class HousekeeperCard extends PersonCard { private static final String FXML = "HousekeeperListCard.fxml"; public HousekeeperCard(Housekeeper housekeeper, int displayedIndex) { diff --git a/src/main/java/seedu/address/ui/MainWindow.java b/src/main/java/housekeeping/hub/ui/MainWindow.java similarity index 92% rename from src/main/java/seedu/address/ui/MainWindow.java rename to src/main/java/housekeeping/hub/ui/MainWindow.java index 9df3526a4a0..4575a50ebf4 100644 --- a/src/main/java/seedu/address/ui/MainWindow.java +++ b/src/main/java/housekeeping/hub/ui/MainWindow.java @@ -1,24 +1,23 @@ -package seedu.address.ui; +package housekeeping.hub.ui; import java.util.logging.Logger; +import housekeeping.hub.commons.core.GuiSettings; +import housekeeping.hub.commons.core.LogsCenter; +import housekeeping.hub.logic.Logic; +import housekeeping.hub.logic.commands.CommandResult; +import housekeeping.hub.logic.commands.exceptions.CommandException; +import housekeeping.hub.logic.parser.exceptions.ParseException; +import housekeeping.hub.model.person.Client; +import housekeeping.hub.model.person.Housekeeper; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.control.MenuItem; import javafx.scene.control.TextInputControl; import javafx.scene.input.KeyCombination; import javafx.scene.input.KeyEvent; -import javafx.scene.layout.HBox; import javafx.scene.layout.StackPane; import javafx.stage.Stage; -import seedu.address.commons.core.GuiSettings; -import seedu.address.commons.core.LogsCenter; -import seedu.address.logic.Logic; -import seedu.address.logic.commands.CommandResult; -import seedu.address.logic.commands.exceptions.CommandException; -import seedu.address.logic.parser.exceptions.ParseException; -import seedu.address.model.person.Client; -import seedu.address.model.person.Housekeeper; /** * The Main Window. Provides the basic application layout containing @@ -186,7 +185,7 @@ public PersonListPanel getHousekeeperListPanel() { /** * Executes the command and returns the result. * - * @see seedu.address.logic.Logic#execute(String) + * @see housekeeping.hub.logic.Logic#execute(String) */ private CommandResult executeCommand(String commandText) throws CommandException, ParseException { try { diff --git a/src/main/java/seedu/address/ui/PersonCard.java b/src/main/java/housekeeping/hub/ui/PersonCard.java similarity index 89% rename from src/main/java/seedu/address/ui/PersonCard.java rename to src/main/java/housekeeping/hub/ui/PersonCard.java index 0a943501de4..c9b6638bd4b 100644 --- a/src/main/java/seedu/address/ui/PersonCard.java +++ b/src/main/java/housekeeping/hub/ui/PersonCard.java @@ -1,19 +1,18 @@ -package seedu.address.ui; +package housekeeping.hub.ui; import java.util.Comparator; +import housekeeping.hub.model.person.Person; import javafx.fxml.FXML; import javafx.scene.control.Label; import javafx.scene.layout.FlowPane; import javafx.scene.layout.HBox; import javafx.scene.layout.Region; -import seedu.address.model.person.HousekeepingDetails; -import seedu.address.model.person.Person; /** * An UI component that displays information of a {@code Person}. */ -abstract public class PersonCard extends UiPart { +public abstract class PersonCard extends UiPart { //private static final String FXML = "PersonListCard.fxml"; @@ -47,8 +46,8 @@ abstract public class PersonCard extends UiPart { /** * Creates a {@code PersonCode} with the given {@code Person} and index to display. */ - public PersonCard(Person person, int displayedIndex, String FXML) { - super(FXML); + public PersonCard(Person person, int displayedIndex, String fxml) { + super(fxml); this.person = person; id.setText(displayedIndex + ". "); name.setText(person.getName().fullName); diff --git a/src/main/java/seedu/address/ui/PersonListPanel.java b/src/main/java/housekeeping/hub/ui/PersonListPanel.java similarity index 87% rename from src/main/java/seedu/address/ui/PersonListPanel.java rename to src/main/java/housekeeping/hub/ui/PersonListPanel.java index e1fc90f5768..81aa77e6ab9 100644 --- a/src/main/java/seedu/address/ui/PersonListPanel.java +++ b/src/main/java/housekeeping/hub/ui/PersonListPanel.java @@ -1,16 +1,16 @@ -package seedu.address.ui; +package housekeeping.hub.ui; import java.util.logging.Logger; +import housekeeping.hub.commons.core.LogsCenter; +import housekeeping.hub.model.person.Client; +import housekeeping.hub.model.person.Housekeeper; +import housekeeping.hub.model.person.Person; import javafx.collections.ObservableList; import javafx.fxml.FXML; import javafx.scene.control.ListCell; import javafx.scene.control.ListView; import javafx.scene.layout.Region; -import seedu.address.commons.core.LogsCenter; -import seedu.address.model.person.Client; -import seedu.address.model.person.Housekeeper; -import seedu.address.model.person.Person; /** * Panel containing the list of persons. diff --git a/src/main/java/seedu/address/ui/ResultDisplay.java b/src/main/java/housekeeping/hub/ui/ResultDisplay.java similarity index 95% rename from src/main/java/seedu/address/ui/ResultDisplay.java rename to src/main/java/housekeeping/hub/ui/ResultDisplay.java index 7d98e84eedf..702518716c8 100644 --- a/src/main/java/seedu/address/ui/ResultDisplay.java +++ b/src/main/java/housekeeping/hub/ui/ResultDisplay.java @@ -1,4 +1,4 @@ -package seedu.address.ui; +package housekeeping.hub.ui; import static java.util.Objects.requireNonNull; diff --git a/src/main/java/seedu/address/ui/StatusBarFooter.java b/src/main/java/housekeeping/hub/ui/StatusBarFooter.java similarity index 95% rename from src/main/java/seedu/address/ui/StatusBarFooter.java rename to src/main/java/housekeeping/hub/ui/StatusBarFooter.java index b577f829423..334bca4c338 100644 --- a/src/main/java/seedu/address/ui/StatusBarFooter.java +++ b/src/main/java/housekeeping/hub/ui/StatusBarFooter.java @@ -1,4 +1,4 @@ -package seedu.address.ui; +package housekeeping.hub.ui; import java.nio.file.Path; import java.nio.file.Paths; diff --git a/src/main/java/seedu/address/ui/Ui.java b/src/main/java/housekeeping/hub/ui/Ui.java similarity index 84% rename from src/main/java/seedu/address/ui/Ui.java rename to src/main/java/housekeeping/hub/ui/Ui.java index 17aa0b494fe..eb45cada45d 100644 --- a/src/main/java/seedu/address/ui/Ui.java +++ b/src/main/java/housekeeping/hub/ui/Ui.java @@ -1,4 +1,4 @@ -package seedu.address.ui; +package housekeeping.hub.ui; import javafx.stage.Stage; diff --git a/src/main/java/seedu/address/ui/UiManager.java b/src/main/java/housekeeping/hub/ui/UiManager.java similarity index 93% rename from src/main/java/seedu/address/ui/UiManager.java rename to src/main/java/housekeeping/hub/ui/UiManager.java index 939951361b7..1d7a22bba65 100644 --- a/src/main/java/seedu/address/ui/UiManager.java +++ b/src/main/java/housekeeping/hub/ui/UiManager.java @@ -1,16 +1,16 @@ -package seedu.address.ui; +package housekeeping.hub.ui; import java.util.logging.Logger; +import housekeeping.hub.MainApp; +import housekeeping.hub.commons.core.LogsCenter; +import housekeeping.hub.commons.util.StringUtil; +import housekeeping.hub.logic.Logic; import javafx.application.Platform; import javafx.scene.control.Alert; import javafx.scene.control.Alert.AlertType; import javafx.scene.image.Image; import javafx.stage.Stage; -import seedu.address.MainApp; -import seedu.address.commons.core.LogsCenter; -import seedu.address.commons.util.StringUtil; -import seedu.address.logic.Logic; /** * The manager of the UI component. diff --git a/src/main/java/seedu/address/ui/UiPart.java b/src/main/java/housekeeping/hub/ui/UiPart.java similarity index 97% rename from src/main/java/seedu/address/ui/UiPart.java rename to src/main/java/housekeeping/hub/ui/UiPart.java index fc820e01a9c..36834998183 100644 --- a/src/main/java/seedu/address/ui/UiPart.java +++ b/src/main/java/housekeeping/hub/ui/UiPart.java @@ -1,12 +1,12 @@ -package seedu.address.ui; +package housekeeping.hub.ui; import static java.util.Objects.requireNonNull; import java.io.IOException; import java.net.URL; +import housekeeping.hub.MainApp; import javafx.fxml.FXMLLoader; -import seedu.address.MainApp; /** * Represents a distinct part of the UI. e.g. Windows, dialogs, panels, status bars, etc. diff --git a/src/main/java/seedu/address/logic/parser/DeleteCommandParser.java b/src/main/java/seedu/address/logic/parser/DeleteCommandParser.java deleted file mode 100644 index c07a1c0d5c0..00000000000 --- a/src/main/java/seedu/address/logic/parser/DeleteCommandParser.java +++ /dev/null @@ -1,57 +0,0 @@ -package seedu.address.logic.parser; - -import static seedu.address.logic.Messages.MESSAGE_INVALID_CLIENT_DISPLAYED_INDEX; -import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; -import static seedu.address.logic.Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX; - -import seedu.address.commons.core.index.Index; -import seedu.address.logic.commands.DeleteClientCommand; -import seedu.address.logic.commands.DeleteCommand; -import seedu.address.logic.commands.DeleteHousekeeperCommand; -import seedu.address.logic.commands.exceptions.CommandException; -import seedu.address.logic.parser.exceptions.ParseException; -import seedu.address.model.person.Type; - -/** - * Parses input arguments and creates a new DeleteCommand object - */ -public class DeleteCommandParser implements Parser { - - /** - * Parses the given {@code String} of arguments in the context of the DeleteCommand - * and returns a DeleteCommand object for execution. - * @throws ParseException if the user input does not conform the expected format - */ - public DeleteCommand parse(String args) throws ParseException { - try { - String[] splitArgs = args.trim().split(" "); - - // check that input is valid - if (splitArgs.length < 2 || splitArgs.length > 2) { - throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, DeleteCommand.MESSAGE_USAGE)); - } - try { - if (Integer.parseInt(splitArgs[1]) < 0) { - throw new ParseException(MESSAGE_INVALID_PERSON_DISPLAYED_INDEX); - } - } catch (NumberFormatException e) { - throw new ParseException(MESSAGE_INVALID_PERSON_DISPLAYED_INDEX); - } - - String type = ParserUtil.parseType(splitArgs[0]); - Index index = ParserUtil.parseIndex(splitArgs[1]); - - if (type.equals("client")) { - return new DeleteClientCommand(index); - } else if (type.equals("housekeeper")) { - return new DeleteHousekeeperCommand(index); - } else { - throw new ParseException( - String.format(MESSAGE_INVALID_COMMAND_FORMAT, DeleteCommand.MESSAGE_USAGE)); - } - } catch (ParseException pe) { - throw new ParseException(pe.getMessage()); - } - } - -} diff --git a/src/main/java/seedu/address/model/util/SampleDataUtil.java b/src/main/java/seedu/address/model/util/SampleDataUtil.java deleted file mode 100644 index af10f9b48b4..00000000000 --- a/src/main/java/seedu/address/model/util/SampleDataUtil.java +++ /dev/null @@ -1,102 +0,0 @@ -package seedu.address.model.util; - -import java.util.Arrays; -import java.util.Optional; -import java.util.Set; -import java.util.stream.Collectors; - -import seedu.address.logic.parser.ParserUtil; -import seedu.address.model.AddressBook; -import seedu.address.model.ReadOnlyAddressBook; -import seedu.address.model.person.Address; -import seedu.address.model.person.BookingList; -import seedu.address.model.person.Area; -import seedu.address.model.person.Client; -import seedu.address.model.person.Email; -import seedu.address.model.person.HousekeepingDetails; -import seedu.address.model.person.Housekeeper; -import seedu.address.model.person.Name; -import seedu.address.model.person.Phone; -import seedu.address.model.person.Type; -import seedu.address.model.tag.Tag; - -/** - * Contains utility methods for populating {@code AddressBook} with sample data. - */ -public class SampleDataUtil { - public static Client[] getSampleClients() { - return new Client[] { - new Client(new Name("Alex Yeoh"), new Phone("87438807"), new Email("alexyeoh@example.com"), - new Address("Blk 30 Geylang Street 29, #06-40"), getTagSet("friends"), - getHousekeepingDetails(Optional.of("2024-01-30 2 months")), new Area("east")), - new Client(new Name("Bernice Yu"), new Phone("99272758"), new Email("berniceyu@example.com"), - new Address("Blk 30 Lorong 3 Serangoon Gardens, #07-18"), - getTagSet("colleagues", "friends"), - getHousekeepingDetails(Optional.of("2024-02-28 2 weeks")), new Area("east")), - new Client(new Name("Charlotte Oliveiro"), new Phone("93210283"), new Email("charlotte@example.com"), - new Address("Blk 11 Ang Mo Kio Street 74, #11-04"), getTagSet("neighbours"), - getHousekeepingDetails(Optional.of("2024-03-03 1 years")), new Area("east")), - new Client(new Name("David Li"), new Phone("91031282"), new Email("lidavid@example.com"), - new Address("Blk 436 Serangoon Gardens Street 26, #16-43"), getTagSet("family"), - getHousekeepingDetails(Optional.of("2024-03-11 39 days")), new Area("east")), - new Client(new Name("Irfan Ibrahim"), new Phone("92492021"), new Email("irfan@example.com"), - new Address("Blk 47 Tampines Street 20, #17-35"), getTagSet("classmates"), - getHousekeepingDetails(Optional.of("2024-04-01 6 months")), new Area("east")), - new Client(new Name("Roy Balakrishnan"), new Phone("92624417"), new Email("royb@example.com"), - new Address("Blk 45 Aljunied Street 85, #11-31"), getTagSet("colleagues"), - getHousekeepingDetails(Optional.empty()), new Area("east")) - }; - } - - public static Housekeeper[] getSampleHousekeepers() { - return new Housekeeper[] { - new Housekeeper(new Name("John Doe"), new Phone("12345678"), new Email("johndoe@example.com"), - new Address("Blk 123 Woodlands Street 45, #05-12"), - getTagSet("cleaning"), new Area("east"), new BookingList()), - new Housekeeper(new Name("Jane Smith"), new Phone("98765432"), new Email("janesmith@example.com"), - new Address("Blk 456 Jurong East Avenue 89, #08-15"), - getTagSet("part-time"), new Area("east"), new BookingList()), - new Housekeeper(new Name("Michael Tan"), new Phone("87654321"), new Email("michaeltan@example.com"), - new Address("Blk 789 Bukit Timah Road, #02-34"), - getTagSet("full-time"), new Area("east"), new BookingList()), - new Housekeeper(new Name("Emily Lee"), new Phone("98761234"), new Email("emilylee@example.com"), - new Address("Blk 234 Sengkang Street 12, #07-23"), - getTagSet("pet-friendly"), new Area("east"), new BookingList()), - new Housekeeper(new Name("Daniel Lim"), new Phone("87651234"), new Email("daniellim@example.com"), - new Address("Blk 345 Yishun Avenue 67, #10-45"), - getTagSet("experienced"), new Area("east"), new BookingList()), - new Housekeeper(new Name("Samantha Tan"), new Phone("76543210"), new Email("samanthatan@example.com"), - new Address("Blk 678 Clementi Road, #03-21"), - getTagSet("trustworthy"), new Area("east"), new BookingList()) - }; - } - - public static ReadOnlyAddressBook getSampleAddressBook() { - AddressBook sampleAb = new AddressBook(); - for (Client sampleClient : getSampleClients()) { - sampleAb.addClient(sampleClient); - } - for (Housekeeper sampleHousekeeper : getSampleHousekeepers()) { - sampleAb.addHousekeeper(sampleHousekeeper); - } - return sampleAb; - } - - /** - * Returns a tag set containing the list of strings given. - */ - public static Set getTagSet(String... strings) { - return Arrays.stream(strings) - .map(Tag::new) - .collect(Collectors.toSet()); - } - - public static HousekeepingDetails getHousekeepingDetails(Optional details) { - try { - return ParserUtil.parseHousekeepingDetails(details); - } catch (Exception e) { - return null; - } - } - -} diff --git a/src/main/resources/view/MainWindow.fxml b/src/main/resources/view/MainWindow.fxml index 6589df0e015..6f99442321c 100644 --- a/src/main/resources/view/MainWindow.fxml +++ b/src/main/resources/view/MainWindow.fxml @@ -58,8 +58,8 @@