diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index 42e19fa2c44..dc9316e1771 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -236,9 +236,9 @@ This is to prevent `FilterCommand` from taking on more responsibilities (Separat `FilterCommand` having `setPersonPredicate()` method: This is so that `FilterCommand` has the required argument of type `Predicate` to be used in the `updateFilteredPersonList()` method. Since the `Predicate` object is created by chaining the multiple predicates, no parsing is involved to create this `Predicate`. -### Sort Feature +### Sort feature -##### Implementation +##### How the feature is implemented The sort mechanism is facilitated by JavaFX's `SortedList` within ModelManager, `SortCommand` and `SortCommandParser`. `SortCommandParser` extends the types of command parsers in StaffBookParser, and returns a `SortCommand` to be executed by the LogicManager. This execution also updates the `SortedList` in Model via ModelManager. Additionally, it implements the following operations: @@ -264,7 +264,7 @@ The following activity diagram summarizes what happens when a user executes a ne -#### Design considerations: +#### What designs were considered: **Aspect: Determining order of sorting of an attribute:** * **Current Design:** Get order of sorting from user, prompting for an input in the form of toCompare. @@ -320,6 +320,53 @@ Below are some explanations for the special considerations in the implementation `FindCommmandParser` parsing the `Predicate` objects: This is to prevent `FindCommand` from taking on more responsibilities (Separation of Concerns). +### Meeting feature + +Meeting is feature that allows the user to keep track of any events they may have with the particular contact. It contains the description of the meeting event with the date and time it would occur. + +#### How the feature is implemented + +Meeting contains two attributes ```MeetingDescription``` and ```MeetingDateTime``` class. ```MeetingDescription``` +is used to handle any valid description of the meeting with only alphanumeric values, while the ```MeetingDateTime``` +is used to handle any valid date time values. Each of this meeting are stored in a list data class ```MeetingList``` that +contains each of the meetings related to each other stored in an ```ObservableList```. The ``` MeetingManager ``` is +used to manage any operations that require viewing or sorting of meetings from the ```MeetingList``` class. + +#### What designs were considered: + +**Aspect: How the meetings are stored :** + +* **Alternative 1 (current choice):** Store meetings in an ObservableList. + * Pros: Better segregation of the OOP functionalities, and good integration with the UI ListView. + * Cons: Larger code complexity. + +* **Alternative 2:** Store meetings in a Set. + * Pros: Easier implementation. + * Cons: There is an efficiency gap as each element has to be placed into a list before it can be shown to the UI ListView. + +### Fav/unfav feature + +The feature enables us to sets/remove a particular contact using an index as favourite. + +#### How the feature is implemented + +The Fav/Unfav feature is implemented via the `FavCommand` and `UnfavCommand`, which is supported by the `FavCommandParser` and `UnfavCommandParser` respectively. +The `FavCommandParser` and `UnfavCommandParser` implements the `Parser` interface. + +1. `LogicManager` receives the user input which is parsed by the `StaffConnectParser`. +2. After splitting the user input into `commandWord` and `arguments` based on the regex pattern of the user input, the `StaffConnectParser` invokes the `FavCommandParser`/`UnfavCommandParser` based on the `commandWord`, calling the method `parse` with `arguments` as the method arguments +3. `FavCommandParser`/`UnfavCommandParser` takes in the `args` string and parse it into with the static `ParserUtil#parseIndex(args)` function. If the `INDEX` format is invalid, a `ParseException` will be thrown. +4. `FavCommandParser`/`UnfavCommandParser` then creates the `FavCommand`/`UnfavCommand` and returns it. +5. The `LogicManager` executes the `FavCommand`/`UnfavCommand`, which creates a `Person` with the `Favourite` attribute set as `true`/`false` respectively and updates the model with this new `Person`. + +The following sequence diagram shows how the `fav` command works: + +![Fav Command Sequence Diagram](images/FavSequenceDiagram.png) + +Similarly, how the `unfav` command works is shown below: + +![Unfav Command Sequence Diagram](images/UnfavSequenceDiagram.png) + ### \[Proposed\] Undo/redo feature #### Proposed Implementation @@ -402,60 +449,6 @@ The following activity diagram summarizes what happens when a user executes a ne * 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. -_{more aspects and alternatives to be added}_ - -### \[Proposed\] Data archiving - -_{Explain here how the data archiving feature will be implemented}_ - - -### Meeting - -Meeting is feature that allows the user to keep track of any events they may have with the particular contact. It contains the description of the meeting event with the date and time it would occur. - -#### Implementation - -Meeting contains two attributes ```MeetingDescription``` and ```MeetingDateTime``` class. ```MeetingDescription``` -is used to handle any valid description of the meeting with only alphanumeric values, while the ```MeetingDateTime``` -is used to handle any valid date time values. Each of this meeting are stored in a list data class ```MeetingList``` that -contains each of the meetings related to each other stored in an ```ObservableList```. The ``` MeetingManager ``` is -used to manage any operations that require viewing or sorting of meetings from the ```MeetingList``` class. - -#### Design considerations: - -**Aspect: How the meetings are stored :** - -* **Alternative 1 (current choice):** Store meetings in an ObservableList. - * Pros: Better segregation of the OOP functionalities, and good integration with the UI ListView. - * Cons: Larger code complexity. - -* **Alternative 2:** Store meetings in a Set. - * Pros: Easier implementation. - * Cons: There is an efficiency gap as each element has to be placed into a list before it can be shown to the UI ListView. - -### Fav/unfav feature - -The feature enables us to sets/remove a particular contact using an index as favourite. - -#### Implementation - -The Fav/Unfav feature is implemented via the `FavCommand` and `UnfavCommand`, which is supported by the `FavCommandParser` and `UnfavCommandParser` respectively. -The `FavCommandParser` and `UnfavCommandParser` implements the `Parser` interface. - -1. `LogicManager` receives the user input which is parsed by the `StaffConnectParser`. -2. After splitting the user input into `commandWord` and `arguments` based on the regex pattern of the user input, the `StaffConnectParser` invokes the `FavCommandParser`/`UnfavCommandParser` based on the `commandWord`, calling the method `parse` with `arguments` as the method arguments -3. `FavCommandParser`/`UnfavCommandParser` takes in the `args` string and parse it into with the static `ParserUtil#parseIndex(args)` function. If the `INDEX` format is invalid, a `ParseException` will be thrown. -4. `FavCommandParser`/`UnfavCommandParser` then creates the `FavCommand`/`UnfavCommand` and returns it. -5. The `LogicManager` executes the `FavCommand`/`UnfavCommand`, which creates a `Person` with the `Favourite` attribute set as `true`/`false` respectively and updates the model with this new `Person`. - -The following sequence diagram shows how the `fav` command works: - -![Fav Command Sequence Diagram](images/FavSequenceDiagram.png) - -Similarly, how the `unfav` command works is shown below: - -![Unfav Command Sequence Diagram](images/UnfavSequenceDiagram.png) - -------------------------------------------------------------------------------------------------------------------- ## **Documentation, logging, testing, configuration, dev-ops** diff --git a/docs/diagrams/SortActivityDiagram.puml b/docs/diagrams/SortActivityDiagram.puml index f1964bae42a..b637a607150 100644 --- a/docs/diagrams/SortActivityDiagram.puml +++ b/docs/diagrams/SortActivityDiagram.puml @@ -6,18 +6,21 @@ start :User enters a sort command; -if() then ([attributes are not sortable]) - :get person from list; - while (have person to compare) - while(attribute value with the next person in the list are equal or no more attributes) - :use next attribute to check; - endwhile - if() then ([person smaller]) - :shift front; - else([person bigger]) - :shift back; +if() then ([attributes are sortable]) + if () then ([list is not empty]) + repeat + :get next person in list + and adds to sorted list; + :compare with persons in sorted list; + if () then ([person smaller]) + :shift up; + else ([person bigger]) + :shift down; endif - endwhile + repeat while () is ([have next person to sort]) not ([no more person to sort]) + + else ([list is empty]) + endif :Shows sorted person list; else([any attribute is not sortable]) :displays Sort Usage message; diff --git a/docs/images/SortActivityDiagram.png b/docs/images/SortActivityDiagram.png index 95864c6f0be..7e1b1d375c0 100644 Binary files a/docs/images/SortActivityDiagram.png and b/docs/images/SortActivityDiagram.png differ