Package amadeus.cognition
Class FindCommand
java.lang.Object
amadeus.cognition.Command
amadeus.cognition.FindCommand
Command to search for tasks in the task list that match a keyword.
This command parses the user input to identify the keyword and filters tasks whose descriptions contain the keyword (case-insensitive).
-
Constructor Summary
ConstructorsConstructorDescriptionFindCommand(String argument) Constructs a newFindCommandby parsing the user input for the keyword. -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()Executes the command by displaying the tasks that match the keyword.
-
Constructor Details
-
FindCommand
Constructs a newFindCommandby parsing the user input for the keyword.The input is expected to contain a non-empty keyword. If the input is empty, an
AmadeusExceptionis thrown.- Parameters:
argument- the user input containing the keyword to search for; must not benullor empty.- Throws:
AmadeusException- if the input is empty or invalid.
-
-
Method Details
-
execute
public void execute()Executes the command by displaying the tasks that match the keyword.If no tasks match the keyword, a message is displayed to inform the user. Otherwise, the matching tasks are displayed using
Speech.sayList(java.util.ArrayList).
-