forked from AY2425S1-CS2103T-F15-4/tp
-
Notifications
You must be signed in to change notification settings - Fork 0
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' of https://github.com/AY2425S1-CS2103T-F15-4/tp
- Loading branch information
Showing
69 changed files
with
2,808 additions
and
407 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
58 changes: 0 additions & 58 deletions
58
src/main/java/seedu/address/logic/commands/FilterCommand.java
This file was deleted.
Oops, something went wrong.
65 changes: 0 additions & 65 deletions
65
src/main/java/seedu/address/logic/commands/FindCommand.java
This file was deleted.
Oops, something went wrong.
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
52 changes: 52 additions & 0 deletions
52
src/main/java/seedu/address/logic/commands/findcommand/FindAddressCommand.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,52 @@ | ||
package seedu.address.logic.commands.findcommand; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
import seedu.address.logic.commands.CommandResult; | ||
import seedu.address.model.Model; | ||
import seedu.address.model.person.keywordspredicate.AddressContainsKeywordsPredicate; | ||
/** | ||
* Finds and lists all persons in address book whose address contains any of the argument keywords. | ||
* Keyword matching is case-insensitive and allows partial matching. | ||
*/ | ||
public class FindAddressCommand extends FindCommand { | ||
|
||
public static final String MESSAGE_FIND_ADDRESS_PERSON_SUCCESS = "Search for address containing \"%s\" " | ||
+ " was successful. Showing results:"; | ||
|
||
/** | ||
* Command to filter contacts in WedLinker based on phone numbers. | ||
* The search matches any parts of the phone numbers. | ||
* | ||
* @param predicate Keywords used to filter contacts by their phone number. | ||
*/ | ||
public FindAddressCommand(AddressContainsKeywordsPredicate predicate) { | ||
super(predicate); | ||
} | ||
|
||
@Override | ||
public CommandResult execute(Model model) { | ||
requireNonNull(model); | ||
model.updateFilteredPersonList((AddressContainsKeywordsPredicate) predicate); | ||
|
||
if (!model.getFilteredPersonList().isEmpty()) { | ||
return new CommandResult(String.format(MESSAGE_FIND_ADDRESS_PERSON_SUCCESS, predicate.getDisplayString())); | ||
} else { | ||
return new CommandResult(MESSAGE_FIND_PERSON_UNSUCCESSFUL); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean equals(Object other) { | ||
if (other == this) { | ||
return true; | ||
} | ||
|
||
// instanceof handles nulls | ||
if (!(other instanceof FindAddressCommand otherFindCommand)) { | ||
return false; | ||
} | ||
|
||
return predicate.equals(otherFindCommand.predicate); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
src/main/java/seedu/address/logic/commands/findcommand/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package seedu.address.logic.commands.findcommand; | ||
|
||
import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; | ||
|
||
import seedu.address.commons.util.ToStringBuilder; | ||
import seedu.address.logic.commands.Command; | ||
import seedu.address.logic.commands.CommandResult; | ||
import seedu.address.model.Model; | ||
import seedu.address.model.person.keywordspredicate.TraitContainsKeywordsPredicate; | ||
|
||
/** | ||
* Finds and lists all persons in address book whose name contains any of the argument keywords. | ||
* Keyword matching is case-insensitive and allows partial matching. | ||
*/ | ||
public abstract class FindCommand extends Command { | ||
|
||
public static final String COMMAND_WORD = "find"; | ||
|
||
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Finds all persons based on the specified keywords " | ||
+ "(case-insensitive) after the prefix representing the field, " | ||
+ "and displays them as a list with index numbers.\n" | ||
+ "Use 'n/' to search by name, 'a/' to search by address etc. \n" | ||
+ "Parameters: PREFIX/ KEYWORDS [MORE_KEYWORDS]...\n" | ||
+ "Example: " + COMMAND_WORD + " " + PREFIX_NAME + " alice charlie"; | ||
|
||
public static final String MESSAGE_FIND_PERSON_UNSUCCESSFUL = "No contacts found."; | ||
|
||
protected final TraitContainsKeywordsPredicate<?> predicate; | ||
|
||
public FindCommand(TraitContainsKeywordsPredicate<?> predicate) { | ||
this.predicate = predicate; | ||
} | ||
|
||
@Override | ||
public abstract CommandResult execute(Model model); | ||
|
||
@Override | ||
public abstract boolean equals(Object other); | ||
|
||
@Override | ||
public String toString() { | ||
return new ToStringBuilder(this) | ||
.add("predicate", predicate) | ||
.toString(); | ||
} | ||
} |
Oops, something went wrong.