From 2804e7557dafa88ddb96d756c938476146f11f21 Mon Sep 17 00:00:00 2001 From: leyew <102467346+itsme-zeix@users.noreply.github.com> Date: Wed, 23 Oct 2024 18:30:55 +0800 Subject: [PATCH 1/3] Add filter command and predicate to ParserClasses diagram --- docs/diagrams/ParserClasses.puml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/diagrams/ParserClasses.puml b/docs/diagrams/ParserClasses.puml index ce4c5ce8c8d..e45a92e399a 100644 --- a/docs/diagrams/ParserClasses.puml +++ b/docs/diagrams/ParserClasses.puml @@ -6,11 +6,14 @@ skinparam classBackgroundColor LOGIC_COLOR Class "{abstract}\nCommand" as Command Class XYZCommand +Class FilterCommand +Class CombinedPredicate package "Parser classes"{ Class "<>\nParser" as Parser Class AddressBookParser Class XYZCommandParser +Class FilterCommandParser Class CliSyntax Class ParserUtil Class ArgumentMultimap @@ -22,17 +25,26 @@ Class HiddenOutside #FFFFFF HiddenOutside ..> AddressBookParser AddressBookParser .down.> XYZCommandParser: <> +AddressBookParser .down.> FilterCommandParser: <> XYZCommandParser ..> XYZCommand : <> +FilterCommandParser ..> FilterCommand : <> +FilterCommandParser ..> CombinedPredicate : <> AddressBookParser ..> Command : <> XYZCommandParser .up.|> Parser XYZCommandParser ..> ArgumentMultimap XYZCommandParser ..> ArgumentTokenizer +FilterCommandParser .up.|> Parser +FilterCommandParser ..> ArgumentMultimap +FilterCommandParser ..> ArgumentTokenizer ArgumentTokenizer .left.> ArgumentMultimap XYZCommandParser ..> CliSyntax +FilterCommandParser ..> CliSyntax CliSyntax ..> Prefix XYZCommandParser ..> ParserUtil +FilterCommandParser ..> ParserUtil ParserUtil .down.> Prefix ArgumentTokenizer .down.> Prefix XYZCommand -up-|> Command +FilterCommand -up-|> Command @enduml From 5997256b408dd1fa8f2584a458ced25dab7ef57a Mon Sep 17 00:00:00 2001 From: leyew <102467346+itsme-zeix@users.noreply.github.com> Date: Wed, 23 Oct 2024 18:40:27 +0800 Subject: [PATCH 2/3] Add FilterCommandParser into DG elaboration --- docs/DeveloperGuide.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index 082cef4ff07..3275f6e60be 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -114,7 +114,8 @@ Here are the other classes in `Logic` (omitted from the class diagram above) tha How the parsing works: * When called upon to parse a user command, the `AddressBookParser` class creates an `XYZCommandParser` (`XYZ` is a placeholder for the specific command name e.g., `AddCommandParser`) which uses the other classes shown above to parse the user command and create a `XYZCommand` object (e.g., `AddCommand`) which the `AddressBookParser` returns back as a `Command` object. -* 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. + * `FilterCommandParser` is explicitly shown as unlike other command parsers, `FilterCommandParser` performs an additional task: it creates multiple predicate classes, which are combined into a `CombinedPredicate`. +* All `XYZCommandParser` classes (e.g., `AddCommandParser`, `DeleteCommandParser`, ...) and `FilterCommandParser` 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) From 720d748efecb00fb14df74c067c46fe46ce6b778 Mon Sep 17 00:00:00 2001 From: leyew <102467346+itsme-zeix@users.noreply.github.com> Date: Wed, 23 Oct 2024 18:45:21 +0800 Subject: [PATCH 3/3] Add note for FilterCommand in ParserClasses Diagram --- docs/diagrams/ParserClasses.puml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/diagrams/ParserClasses.puml b/docs/diagrams/ParserClasses.puml index e45a92e399a..b7e04fc3fb1 100644 --- a/docs/diagrams/ParserClasses.puml +++ b/docs/diagrams/ParserClasses.puml @@ -47,4 +47,12 @@ ParserUtil .down.> Prefix ArgumentTokenizer .down.> Prefix XYZCommand -up-|> Command FilterCommand -up-|> Command + +note right of FilterCommandParser +Internally creates and combines multiple predicates +(e.g., NameContainsSubstringPredicate, +IncomeComparisonPredicate, etc.) into a +CombinedPredicate. +end note + @enduml