-
Notifications
You must be signed in to change notification settings - Fork 252
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
383 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package command; | ||
|
||
import exception.DukeException; | ||
import storage.Storage; | ||
import task.Task; | ||
import task.TaskList; | ||
import ui.Ui; | ||
|
||
public class IgnoreCommand extends Command { | ||
private int indexOfTask; | ||
|
||
public IgnoreCommand(int index) { | ||
indexOfTask = index; | ||
} | ||
|
||
@Override | ||
public void execute(TaskList tasks, Storage storage) throws DukeException { | ||
if (indexOfTask < 0 || indexOfTask > (tasks.getSize() - 1)) { | ||
throw new DukeException(DukeException.taskDoesNotExist()); | ||
} | ||
|
||
Task task = tasks.markAsIgnorable(indexOfTask); | ||
storage.saveFile(tasks.getTasks()); | ||
|
||
Ui.printMessage("Noted. This task has been marked as ignored:"); | ||
Ui.printMessage(" " + task.toString()); | ||
} | ||
} |
Oops, something went wrong.