From c483bc18d519cb82fa647883a482b20388a329d0 Mon Sep 17 00:00:00 2001 From: KrashKart Date: Wed, 9 Oct 2024 23:58:19 +0800 Subject: [PATCH] Make FindCommand abstract This is so that we can use this as a template for the sub-commands for Find --- .../address/logic/commands/FindCommand.java | 68 +++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/src/main/java/seedu/address/logic/commands/FindCommand.java b/src/main/java/seedu/address/logic/commands/FindCommand.java index 72b9eddd3a7..73989d93799 100644 --- a/src/main/java/seedu/address/logic/commands/FindCommand.java +++ b/src/main/java/seedu/address/logic/commands/FindCommand.java @@ -11,7 +11,7 @@ * Finds and lists all persons in address book whose name contains any of the argument keywords. * Keyword matching is case insensitive. */ -public class FindCommand extends Command { +abstract public class FindCommand extends Command { public static final String COMMAND_WORD = "find"; @@ -20,39 +20,39 @@ public class FindCommand extends Command { + "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 NameContainsKeywordsPredicate predicate; +// +// public FindCommand(NameContainsKeywordsPredicate predicate) { +// this.predicate = predicate; +// } +// +// @Override public CommandResult execute(Model model) { - requireNonNull(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(); - } +// 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(); +// } }