From bd1f6bb2ff9da576dcc392daff9c342cd4775c9c Mon Sep 17 00:00:00 2001 From: whitesnowx Date: Sat, 13 Apr 2024 22:22:10 +0800 Subject: [PATCH] amend sort implemented this way --- docs/DeveloperGuide.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index 1571e7f9548..8d272ddc481 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -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` to be used in the `updateSortedPersonList()` method. Since the `Comparator` 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:**