Skip to content

Commit

Permalink
Change message usage and other methods
Browse files Browse the repository at this point in the history
Temporarily correct until we implement the sub-categories of find
  • Loading branch information
KrashKart committed Oct 9, 2024
1 parent c483bc1 commit a44950e
Showing 1 changed file with 37 additions and 37 deletions.
74 changes: 37 additions & 37 deletions src/main/java/seedu/address/logic/commands/FindCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import seedu.address.commons.util.ToStringBuilder;
import seedu.address.logic.Messages;
import seedu.address.model.Model;
import seedu.address.model.person.NameContainsKeywordsPredicate;
import seedu.address.model.person.ContainsKeywordsPredicate;

/**
* Finds and lists all persons in address book whose name contains any of the argument keywords.
Expand All @@ -15,44 +15,44 @@ abstract public class FindCommand extends Command {

public static final String COMMAND_WORD = "find";

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Finds all persons whose names contain any of "
+ "the specified keywords (case-insensitive) and displays them as a list with index numbers.\n"
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Finds all persons whose names, contacts or emails "
+ "contain any of the specified keywords (case-insensitive) and displays them as a list with indices.\n"
+ "Parameters: KEYWORD [MORE_KEYWORDS]...\n"
+ "Example: " + COMMAND_WORD + " alice bob charlie";

// private final NameContainsKeywordsPredicate predicate;
//
// public FindCommand(NameContainsKeywordsPredicate predicate) {
// this.predicate = predicate;
// }
//
// @Override
private final ContainsKeywordsPredicate predicate;

public FindCommand(ContainsKeywordsPredicate predicate) {
this.predicate = predicate;
}

@Override
public CommandResult execute(Model model) {
// requireNonNull(model);
model.updateFilteredPersonList(predicate);
// return new CommandResult(
// String.format(Messages.MESSAGE_PERSONS_LISTED_OVERVIEW, model.getFilteredPersonList().size()));
// }

// @Override
// public boolean equals(Object other) {
// if (other == this) {
// return true;
// }
//
// // instanceof handles nulls
// if (!(other instanceof FindCommand)) {
// return false;
// }
//
// FindCommand otherFindCommand = (FindCommand) other;
// return predicate.equals(otherFindCommand.predicate);
// }
//
// @Override
// public String toString() {
// return new ToStringBuilder(this)
// .add("predicate", predicate)
// .toString();
// }
requireNonNull(model);
model.updateFilteredPersonList(this.predicate);
return new CommandResult(
String.format(Messages.MESSAGE_PERSONS_LISTED_OVERVIEW, model.getFilteredPersonList().size()));
}

@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}

// instanceof handles nulls
if (!(other instanceof FindCommand)) {
return false;
}

FindCommand otherFindCommand = (FindCommand) other;
return this.predicate.equals(otherFindCommand.predicate);
}

@Override
public String toString() {
return new ToStringBuilder(this)
.add("predicate", this.predicate)
.toString();
}
}

0 comments on commit a44950e

Please sign in to comment.