forked from nus-cs2103-AY2324S2/tp
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into branch-remarks
- Loading branch information
Showing
29 changed files
with
781 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
@startuml | ||
!include style.puml | ||
skinparam arrowThickness 1.1 | ||
skinparam arrowColor LOGIC_COLOR_T4 | ||
skinparam classBackgroundColor LOGIC_COLOR | ||
|
||
class State1 as "FindCommandParser" | ||
class State2 as "FindCommand" | ||
class State3 as "<<interface>>\nPredicate<Person> " | ||
class State4 as "NameContainsKeywordsPredicate" | ||
class State5 as "IcContainsKeywordsPredicate" | ||
|
||
State1 .down.> "0..1" State2 | ||
State2 -right-> "1" State3 | ||
State4 .up.|> State3 | ||
State5 .up.|> State3 | ||
|
||
@enduml |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 14 additions & 8 deletions
22
src/main/java/seedu/address/logic/commands/FindCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/main/java/seedu/address/logic/parser/ListCommandParser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package seedu.address.logic.parser; | ||
|
||
import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_WARD; | ||
|
||
import java.util.List; | ||
|
||
import seedu.address.logic.commands.ListCommand; | ||
import seedu.address.logic.parser.exceptions.ParseException; | ||
import seedu.address.model.person.ListKeywordsPredicate; | ||
|
||
/** | ||
* Parses input arguments and creates a new DeleteCommand object | ||
*/ | ||
public class ListCommandParser implements Parser<ListCommand> { | ||
|
||
/** | ||
* Parses the given {@code String} of arguments in the context of the ListCommand | ||
* and returns a ListCommand object for execution. | ||
* @throws ParseException if the user input does not conform the expected format | ||
*/ | ||
public ListCommand parse(String args) throws ParseException { | ||
String trimmedArgs = args.trim(); | ||
if (trimmedArgs.isEmpty()) { | ||
return new ListCommand(); // return a ListCommand object with no predicate | ||
} | ||
|
||
ArgumentMultimap argMultimap = | ||
ArgumentTokenizer.tokenize(args, PREFIX_TAG, PREFIX_WARD); | ||
argMultimap.verifyNoDuplicatePrefixesFor(PREFIX_WARD); | ||
List<String> tagList = ParserUtil | ||
.parseTagsKeywords(argMultimap.getAllValues(PREFIX_TAG)); | ||
String ward = argMultimap.getValue(PREFIX_WARD).orElse(""); | ||
|
||
if (ward.isEmpty() && tagList.isEmpty()) { | ||
throw new ParseException( | ||
String.format(MESSAGE_INVALID_COMMAND_FORMAT, ListCommand.MESSAGE_USAGE)); | ||
} | ||
|
||
assert !tagList.isEmpty() || !ward.isEmpty(); | ||
|
||
return new ListCommand(new ListKeywordsPredicate(tagList, ward)); | ||
} | ||
} |
Oops, something went wrong.