@@ -0,0 +1,1599 @@
+package seedu.jimi.logic.commands;%0A%0Aimport seedu.jimi.commons.core.Messages;%0Aimport seedu.jimi.commons.core.UnmodifiableObservableList;%0Aimport seedu.jimi.model.task.ReadOnlyTask;%0Aimport seedu.jimi.model.task.UniqueTaskList.TaskNotFoundException;%0A%0A/**%0A * Marks an existing task as complete.%0A * @author zexuan%0A *%0A */%0Apublic class CompleteCommand extends Command%7B%0A    %0A    public static final String COMMAND_WORD = %22complete%22;%0A%0A    public static final String MESSAGE_USAGE = COMMAND_WORD%0A            + %22: Marks an existing task in Jimi as completed.%5Cn%22%0A            + %22You can specify the task/event by entering its index number given in the last listing. %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_COMPLETE_TASK_SUCCESS = %22You have completed this task: %251$s%22;%0A%0A    public final int targetIndex;%0A    %0A    public CompleteCommand(int targetIndex)%7B%0A        this.targetIndex = targetIndex;%0A    %7D%0A    %0A    @Override%0A    public CommandResult execute() %7B%0A        UnmodifiableObservableList%3CReadOnlyTask%3E lastShownList = model.getFilteredTaskList();%0A%0A        if (lastShownList.size() %3C targetIndex) %7B%0A            indicateAttemptToExecuteIncorrectCommand();%0A            return new CommandResult(Messages.MESSAGE_INVALID_TASK_DISPLAYED_INDEX);%0A        %7D%0A%0A        ReadOnlyTask taskToComplete = lastShownList.get(targetIndex - 1);%0A%0A        model.completeTask(taskToComplete, true);%0A        %0A        return new CommandResult(String.format(MESSAGE_COMPLETE_TASK_SUCCESS, taskToComplete));%0A    %7D%0A    %0A%7D%0A

Implement CompleteCommand