Skip to content

Commit

Permalink
Merge pull request #74 from S-K-Y-Light/rename-Person-Student
Browse files Browse the repository at this point in the history
Refactor all Files: Rename Person to Student
  • Loading branch information
notnotmax authored Oct 15, 2024
2 parents 5c5f1c7 + e2f357c commit 05e1f98
Show file tree
Hide file tree
Showing 81 changed files with 1,043 additions and 1,036 deletions.
32 changes: 16 additions & 16 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ The **API** of this component is specified in [`Ui.java`](https://github.com/se-

![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 consists of a `MainWindow` that is made up of parts e.g.`CommandBox`, `ResultDisplay`, `StudentListPanel`, `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)

Expand All @@ -81,7 +81,7 @@ The `UI` component,
* executes user commands using the `Logic` component.
* listens for changes to `Model` data so that the UI can be updated with the modified data.
* keeps a reference to the `Logic` component, because the `UI` relies on the `Logic` to execute commands.
* depends on some classes in the `Model` component, as it displays `Person` object residing in the `Model`.
* depends on some classes in the `Model` component, as it displays `Student` object residing in the `Model`.

### Logic component

Expand All @@ -102,7 +102,7 @@ How the `Logic` component works:

1. When `Logic` is called upon to execute a command, it is passed to an `AddressBookParser` object which in turn creates a parser that matches the command (e.g., `DeleteCommandParser`) and uses it to parse the command.
1. This results in a `Command` object (more precisely, an object of one of its subclasses e.g., `DeleteCommand`) which is executed by the `LogicManager`.
1. The command can communicate with the `Model` when it is executed (e.g. to delete a person).<br>
1. The command can communicate with the `Model` when it is executed (e.g. to delete a student).<br>
Note that although this is shown as a single step in the diagram above (for simplicity), in the code it can take several interactions (between the command object and the `Model`) to achieve.
1. The result of the command execution is encapsulated as a `CommandResult` object which is returned back from `Logic`.

Expand All @@ -122,12 +122,12 @@ How the parsing works:

The `Model` component,

* stores the address book data i.e., all `Person` objects (which are contained in a `UniquePersonList` object).
* stores the currently 'selected' `Person` objects (e.g., results of a search query) as a separate _filtered_ list which is exposed to outsiders as an unmodifiable `ObservableList<Person>` that can be 'observed' e.g. the UI can be bound to this list so that the UI automatically updates when the data in the list change.
* stores the address book data i.e., all `Student` objects (which are contained in a `UniqueStudentList` object).
* stores the currently 'selected' `Student` objects (e.g., results of a search query) as a separate _filtered_ list which is exposed to outsiders as an unmodifiable `ObservableList<Student>` that can be 'observed' e.g. the UI can be bound to this list so that the UI automatically updates when the data in the list change.
* stores a `UserPref` object that represents the user’s preferences. This is exposed to the outside as a `ReadOnlyUserPref` objects.
* does not depend on any of the other three components (as the `Model` represents data entities of the domain, they should make sense on their own without depending on other components)

<div markdown="span" class="alert alert-info">:information_source: **Note:** An alternative (arguably, a more OOP) model is given below. It has a `Tag` list in the `AddressBook`, which `Person` references. This allows `AddressBook` to only require one `Tag` object per unique tag, instead of each `Person` needing their own `Tag` objects.<br>
<div markdown="span" class="alert alert-info">:information_source: **Note:** An alternative (arguably, a more OOP) model is given below. It has a `Tag` list in the `AddressBook`, which `Student` references. This allows `AddressBook` to only require one `Tag` object per unique tag, instead of each `Student` needing their own `Tag` objects.<br>

<img src="images/BetterModelClassDiagram.png" width="450" />

Expand Down Expand Up @@ -173,19 +173,19 @@ Step 1. The user launches the application for the first time. The `VersionedAddr

![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.
Step 2. The user executes `delete 5` command to delete the 5th student 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`.
Step 3. The user executes `add n/David …​` to add a new student. The `add` command also calls `Model#commitAddressBook()`, causing another modified address book state to be saved into the `addressBookStateList`.

![UndoRedoState2](images/UndoRedoState2.png)

<div markdown="span" class="alert alert-info">: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`.

</div>

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.
Step 4. The user now decides that adding the student 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)

Expand Down Expand Up @@ -234,7 +234,7 @@ The following activity diagram summarizes what happens when a user executes a ne

* **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).
* Pros: Will use less memory (e.g. for `delete`, just save the student being deleted).
* Cons: We must ensure that the implementation of each individual command are correct.

_{more aspects and alternatives to be added}_
Expand Down Expand Up @@ -399,7 +399,7 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli

**MSS:**

1. User requests to delete a specific person in the list by index.
1. User requests to delete a specific student in the list by index.
2. TAHub verifies the given index.
3. TAHub deletes the student at the index in the list.
4. Use case ends.
Expand All @@ -415,7 +415,7 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli
### Non-Functional Requirements

1. Should work on any _mainstream OS_ as long as it has Java `17` or above installed.
2. Should be able to hold up to 1000 persons without a noticeable sluggishness in performance for typical usage.
2. Should be able to hold up to 1000 students without a noticeable sluggishness in performance for typical usage.
3. A user with above average typing speed for regular English text (i.e. not code, not system admin commands) should be able to accomplish most of the tasks faster using commands than using the mouse.
4. The system should be able to scale to accommodate a growing number of users (teachers, TAs, students) without requiring significant reengineering.
5. The platform should have a clean, intuitive user interface that allows new users to complete basic tasks (like searching for a student) with minimal training.
Expand Down Expand Up @@ -461,17 +461,17 @@ testers are expected to do more *exploratory* testing.

1. _{ more test cases …​ }_

### Deleting a person
### Deleting a student

1. Deleting a person while all persons are being shown
1. Deleting a student while all students are being shown

1. Prerequisites: List all persons using the `list` command. Multiple persons in the list.
1. Prerequisites: List all students using the `list` command. Multiple students in the list.

1. Test case: `delete 1`<br>
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`<br>
Expected: No person is deleted. Error details shown in the status message. Status bar remains the same.
Expected: No student 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)<br>
Expected: Similar to previous.
Expand Down
44 changes: 22 additions & 22 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,76 +72,76 @@ Shows a message explaning how to access the help page.
Format: `help`


### Adding a person: `add`
### Adding a student: `add`

Adds a person to the address book.
Adds a student to the address book.

Format: `add n/NAME p/PHONE_NUMBER e/EMAIL a/ADDRESS [t/TAG]…​`

<div markdown="span" class="alert alert-primary">:bulb: **Tip:**
A person can have any number of tags (including 0)
A student can have any number of tags (including 0)
</div>

Examples:
* `add n/John Doe p/98765432 e/johnd@example.com a/John street, block 123, #01-01`
* `add n/Betsy Crowe t/friend e/betsycrowe@example.com a/Newgate Prison p/1234567 t/criminal`

### Listing all persons : `list`
### Listing all students : `list`

Shows a list of all persons in the address book.
Shows a list of all students in the address book.

Format: `list`

### Editing a person : `edit`
### Editing a student : `edit`

Edits an existing person in the address book.
Edits an existing student in the address book.

Format: `edit INDEX [n/NAME] [p/PHONE] [e/EMAIL] [a/ADDRESS] [t/TAG]…​`

* 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, …​
* Edits the student at the specified `INDEX`. The index refers to the index number shown in the displayed student 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.
* When editing tags, the existing tags of the person will be removed i.e adding of tags is not cumulative.
* You can remove all the person’s tags by typing `t/` without
* When editing tags, the existing tags of the student will be removed i.e adding of tags is not cumulative.
* You can remove all the student’s tags by typing `t/` without
specifying any tags after it.

Examples:
* `edit 1 p/91234567 e/johndoe@example.com` Edits the phone number and email address of the 1st person to be `91234567` and `johndoe@example.com` respectively.
* `edit 2 n/Betsy Crower t/` Edits the name of the 2nd person to be `Betsy Crower` and clears all existing tags.
* `edit 1 p/91234567 e/johndoe@example.com` Edits the phone number and email address of the 1st student to be `91234567` and `johndoe@example.com` respectively.
* `edit 2 n/Betsy Crower t/` Edits the name of the 2nd student to be `Betsy Crower` and clears all existing tags.

### Locating persons by name: `find`
### Locating students by name: `find`

Finds persons whose names contain any of the given keywords.
Finds students whose names contain any of the given keywords.

Format: `find KEYWORD [MORE_KEYWORDS]`

* The search is case-insensitive. e.g `hans` will match `Hans`
* The order of the keywords does not matter. e.g. `Hans Bo` will match `Bo Hans`
* Only the name is searched.
* Only full words will be matched e.g. `Han` will not match `Hans`
* Persons matching at least one keyword will be returned (i.e. `OR` search).
* Students matching at least one keyword will be returned (i.e. `OR` search).
e.g. `Hans Bo` will return `Hans Gruber`, `Bo Yang`

Examples:
* `find John` returns `john` and `John Doe`
* `find alex david` returns `Alex Yeoh`, `David Li`<br>
![result for 'find alex david'](images/findAlexDavidResult.png)

### Deleting a person : `delete`
### Deleting a student : `delete`

Deletes the specified person from the address book.
Deletes the specified student from the address book.

Format: `delete i/INDEX...`

* Deletes the person at the specified `INDEX`.
* The index refers to the index number shown in the displayed person list.
* Deletes the student at the specified `INDEX`.
* The index refers to the index number shown in the displayed student list.
* The index **must be a positive integer** 1, 2, 3, …​
* Can delete multiple items at once

Examples:
* `list` followed by `delete i/2` deletes the 2nd person in the address book.
* `list` followed by `delete i/2 i/3` deletes the 2nd and 3rd person in the address book.
* `find Betsy` followed by `delete i/1` deletes the 1st person in the results of the `find` command.
* `list` followed by `delete i/2` deletes the 2nd student in the address book.
* `list` followed by `delete i/2 i/3` deletes the 2nd and 3rd student in the address book.
* `find Betsy` followed by `delete i/1` deletes the 1st student in the results of the `find` command.

### Clearing all entries : `clear`

Expand Down
2 changes: 1 addition & 1 deletion docs/diagrams/ArchitectureSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ activate ui UI_COLOR
ui -[UI_COLOR]> logic : execute("delete 1")
activate logic LOGIC_COLOR

logic -[LOGIC_COLOR]> model : deletePerson(p)
logic -[LOGIC_COLOR]> model : deleteStudent(p)
activate model MODEL_COLOR

model -[MODEL_COLOR]-> logic
Expand Down
18 changes: 9 additions & 9 deletions docs/diagrams/BetterModelClassDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ skinparam arrowThickness 1.1
skinparam arrowColor MODEL_COLOR
skinparam classBackgroundColor MODEL_COLOR

AddressBook *-right-> "1" UniquePersonList
AddressBook *-right-> "1" UniqueStudentList
AddressBook *-right-> "1" UniqueTagList
UniqueTagList -[hidden]down- UniquePersonList
UniqueTagList -[hidden]down- UniquePersonList
UniqueTagList -[hidden]down- UniqueStudentList
UniqueTagList -[hidden]down- UniqueStudentList

UniqueTagList -right-> "*" Tag
UniquePersonList -right-> Person
UniqueStudentList -right-> Student

Person -up-> "*" Tag
Student -up-> "*" Tag

Person *--> Name
Person *--> Phone
Person *--> Email
Person *--> Address
Student *--> Name
Student *--> Phone
Student *--> Email
Student *--> Address
@enduml
2 changes: 1 addition & 1 deletion docs/diagrams/DeleteSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ deactivate AddressBookParser
LogicManager -> DeleteCommand : execute(m)
activate DeleteCommand

DeleteCommand -> Model : deletePerson(1)
DeleteCommand -> Model : deleteStudent(1)
activate Model

Model --> DeleteCommand
Expand Down
24 changes: 12 additions & 12 deletions docs/diagrams/ModelClassDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Class AddressBook
Class ModelManager
Class UserPrefs

Class UniquePersonList
Class Person
Class UniqueStudentList
Class Student
Class Address
Class Email
Class Name
Expand All @@ -35,20 +35,20 @@ ModelManager -left-> "1" AddressBook
ModelManager -right-> "1" UserPrefs
UserPrefs .up.|> ReadOnlyUserPrefs

AddressBook *--> "1" UniquePersonList
UniquePersonList --> "~* all" Person
Person *--> Name
Person *--> Phone
Person *--> Email
Person *--> Address
Person *--> "*" Tag
AddressBook *--> "1" UniqueStudentList
UniqueStudentList --> "~* all" Student
Student *--> Name
Student *--> Phone
Student *--> Email
Student *--> Address
Student *--> "*" Tag

Person -[hidden]up--> I
UniquePersonList -[hidden]right-> I
Student -[hidden]up--> I
UniqueStudentList -[hidden]right-> I

Name -[hidden]right-> Phone
Phone -[hidden]right-> Address
Address -[hidden]right-> Email

ModelManager --> "~* filtered" Person
ModelManager --> "~* filtered" Student
@enduml
6 changes: 3 additions & 3 deletions docs/diagrams/StorageClassDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package "AddressBook Storage" #F4F6F6{
Class "<<interface>>\nAddressBookStorage" as AddressBookStorage
Class JsonAddressBookStorage
Class JsonSerializableAddressBook
Class JsonAdaptedPerson
Class JsonAdaptedStudent
Class JsonAdaptedTag
}

Expand All @@ -37,7 +37,7 @@ Storage -right-|> AddressBookStorage
JsonUserPrefsStorage .up.|> UserPrefsStorage
JsonAddressBookStorage .up.|> AddressBookStorage
JsonAddressBookStorage ..> JsonSerializableAddressBook
JsonSerializableAddressBook --> "*" JsonAdaptedPerson
JsonAdaptedPerson --> "*" JsonAdaptedTag
JsonSerializableAddressBook --> "*" JsonAdaptedStudent
JsonAdaptedStudent --> "*" JsonAdaptedTag

@enduml
16 changes: 8 additions & 8 deletions docs/diagrams/UiClassDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Class UiManager
Class MainWindow
Class HelpWindow
Class ResultDisplay
Class PersonListPanel
Class PersonCard
Class StudentListPanel
Class StudentCard
Class StatusBarFooter
Class CommandBox
}
Expand All @@ -32,26 +32,26 @@ UiManager .left.|> Ui
UiManager -down-> "1" MainWindow
MainWindow *-down-> "1" CommandBox
MainWindow *-down-> "1" ResultDisplay
MainWindow *-down-> "1" PersonListPanel
MainWindow *-down-> "1" StudentListPanel
MainWindow *-down-> "1" StatusBarFooter
MainWindow --> "0..1" HelpWindow

PersonListPanel -down-> "*" PersonCard
StudentListPanel -down-> "*" StudentCard

MainWindow -left-|> UiPart

ResultDisplay --|> UiPart
CommandBox --|> UiPart
PersonListPanel --|> UiPart
PersonCard --|> UiPart
StudentListPanel --|> UiPart
StudentCard --|> UiPart
StatusBarFooter --|> UiPart
HelpWindow --|> UiPart

PersonCard ..> Model
StudentCard ..> Model
UiManager -right-> Logic
MainWindow -left-> Logic

PersonListPanel -[hidden]left- HelpWindow
StudentListPanel -[hidden]left- HelpWindow
HelpWindow -[hidden]left- CommandBox
CommandBox -[hidden]left- ResultDisplay
ResultDisplay -[hidden]left- StatusBarFooter
Expand Down
2 changes: 1 addition & 1 deletion docs/diagrams/tracing/LogicSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ create ecp
abp -> ecp
abp -> ecp ++: parse(arguments)
create ec
ecp -> ec ++: index, editPersonDescriptor
ecp -> ec ++: index, editStudentDescriptor
ec --> ecp --
ecp --> abp --: command
abp --> logic --: command
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/seedu/address/logic/Logic.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public interface Logic {
*/
ReadOnlyAddressBook getAddressBook();

/** Returns an unmodifiable view of the filtered list of persons */
ObservableList<Student> getFilteredPersonList();
/** Returns an unmodifiable view of the filtered list of students */
ObservableList<Student> getFilteredStudentList();

/**
* Returns the user prefs' address book file path.
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/seedu/address/logic/LogicManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ public ReadOnlyAddressBook getAddressBook() {
}

@Override
public ObservableList<Student> getFilteredPersonList() {
return model.getFilteredPersonList();
public ObservableList<Student> getFilteredStudentList() {
return model.getFilteredStudentList();
}

@Override
Expand Down
Loading

0 comments on commit 05e1f98

Please sign in to comment.