Class FindCommand

java.lang.Object
amadeus.cognition.Command
amadeus.cognition.FindCommand

public class FindCommand extends Command
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 Details

    • FindCommand

      public FindCommand(String argument) throws AmadeusException
      Constructs a new FindCommand by parsing the user input for the keyword.

      The input is expected to contain a non-empty keyword. If the input is empty, an AmadeusException is thrown.

      Parameters:
      argument - the user input containing the keyword to search for; must not be null or 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).

      Specified by:
      execute in class Command