package seedu.address.logic.commands;

public class FinishCommand {

}

@@ -36,36 +36,1879 @@
 s;%0A%0A
-public class FinishCommand %7B%0A%0A%7D
+import seedu.address.commons.core.Messages;%0Aimport seedu.address.commons.core.UnmodifiableObservableList;%0Aimport seedu.address.logic.commands.exceptions.CommandException;%0Aimport seedu.address.model.task.ReadOnlyTask;%0Aimport seedu.address.model.task.UniqueTaskList.TaskNotFoundException;%0A%0A%0A/**%0A * Deletes a person identified using it's last displayed index from the address book.%0A */%0Apublic class FinishCommand extends Command %7B%0A%0A    public static final String COMMAND_WORD = %22finish%22;%0A%0A    public static final String MESSAGE_USAGE = COMMAND_WORD%0A            + %22: Marks the task identified by the index number used in the last task listing as finished.%5Cn%22%0A            + %22Parameters: INDEX (must be a positive integer)%5Cn%22%0A            + %22Example: %22 + COMMAND_WORD + %22 1%22;%0A%0A    public static final String MESSAGE_FINISH_TASK_SUCCESS = %22Mark finished task: %251$s%22;%0A    public static final String MESSAGE_FINISH_TASK_MARKED = %22Task had been finished: %251$s%22;%0A%0A    public final int targetIndex;%0A%0A    public FinishCommand(int targetIndex) %7B%0A        this.targetIndex = targetIndex;%0A    %7D%0A%0A%0A    @Override%0A    public CommandResult execute() throws CommandException %7B%0A%0A        UnmodifiableObservableList%3CReadOnlyTask%3E lastShownList = model.getFilteredTaskList();%0A%0A        if (lastShownList.size() %3C targetIndex) %7B%0A            throw new CommandException(Messages.MESSAGE_INVALID_TASK_DISPLAYED_INDEX);%0A        %7D%0A%0A        ReadOnlyTask taskToMark = lastShownList.get(targetIndex - 1);%0A%0A        try %7B%0A        %09if(taskToMark.isFinished())%7B%0A        %09%09throw new CommandException(MESSAGE_FINISH_TASK_MARKED) ;%0A        %09%7D%0A        %09else%7B%0A        %09%09taskToMark.%0A        %09%7D%0A        %7D catch (TaskNotFoundException pnfe) %7B%0A            assert false : %22The target person cannot be missing%22;%0A        %7D%0A%0A        return new CommandResult(String.format(MESSAGE_FINISH_TASK_SUCCESS, personToDelete));%0A    %7D%0A%0A%7D%0A
 %0A

add an finish command