Class DeleteCommand

java.lang.Object
amadeus.cognition.Command
amadeus.cognition.DeleteCommand

public class DeleteCommand extends Command
Command to delete a task from the task list.

This command parses the user input to identify the task index and removes the task. The input is expected to contain a valid task index.

  • Constructor Details

    • DeleteCommand

      public DeleteCommand(String input) throws AmadeusException
      Constructs a new DeleteCommand by parsing the user input.

      The input is expected to contain a valid task index. If the input is empty or the index is invalid, an AmadeusException is thrown.

      Parameters:
      input - the user input containing the task index; must not be null or empty.
      Throws:
      AmadeusException - if the input is empty or the index is invalid.
  • Method Details

    • execute

      public void execute() throws AmadeusException
      Executes the command by deleting the task at the specified index from the task list.
      Specified by:
      execute in class Command
      Throws:
      AmadeusException - if an error occurs while deleting the task.