Package amadeus.cognition
Class DeleteCommand
java.lang.Object
amadeus.cognition.Command
amadeus.cognition.DeleteCommand
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 Summary
ConstructorsConstructorDescriptionDeleteCommand(String input) Constructs a newDeleteCommandby parsing the user input. -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()Executes the command by deleting the task at the specified index from the task list.
-
Constructor Details
-
DeleteCommand
Constructs a newDeleteCommandby 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
AmadeusExceptionis thrown.- Parameters:
input- the user input containing the task index; must not benullor empty.- Throws:
AmadeusException- if the input is empty or the index is invalid.
-
-
Method Details
-
execute
Executes the command by deleting the task at the specified index from the task list.- Specified by:
executein classCommand- Throws:
AmadeusException- if an error occurs while deleting the task.
-