Skip to content

Commit

Permalink
amend sort implemented this way
Browse files Browse the repository at this point in the history
  • Loading branch information
whitesnowx committed Apr 13, 2024
1 parent fe61fe5 commit bd1f6bb
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,13 +305,14 @@ The main operation for the sort feature is the `updateSortedPersonList(Comparato
The following are some explanations for decisions made in the implementation of the sort feature.

Need for multiple `Comparator` objects:
This is to keep in view for when other commands or enhancements may need the separate attribute predicates.
This is to keep in view for when other commands or enhancements may need the separate attribute predicates.

`SortCommmandParser` parsing the `Predicate` objects:
This is to prevent `SortCommand` from taking on more responsibilities (Separation of Concerns).
Need for `MultiComparator` object:
This is to map the 1 or more comparator objects and act as a layer of abstraction where `SortCommmand` does need to know how many attributes are used in sorting.
This also w

`SortCommand` having `setPersonPredicate()` method:
This is so that `SortCommand` has the required argument of type `Comparator<Person>` to be used in the `updateSortedPersonList()` method. Since the `Comparator<Person>` object is created by chaining the multiple predicates, no parsing is involved to create this `Predicate`.
`SortCommmandParser` parsing the `Comparator` objects:
This is to prevent `SortCommand` from taking on more responsibilities (Separation of Concerns).

#### What designs were considered:
**Aspect: Determining order of sorting of an attribute:**
Expand Down

0 comments on commit bd1f6bb

Please sign in to comment.