//@@author generated
package seedu.address.logic.commands;

import seedu.address.commons.core.EventsCenter;
import seedu.address.commons.core.Messages;
import seedu.address.commons.core.UnmodifiableObservableList;
import seedu.address.commons.events.ui.JumpToListRequestEvent;
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.model.task.ReadOnlyTask;

/**
 * Selects a person identified using it's last displayed index from the address book.
 */
public class SelectCommand extends Command {

    public final int targetIndex;

    public static final String COMMAND_WORD = "select";

    public static final String MESSAGE_USAGE = COMMAND_WORD
            + ": Selects the task identified by the index number used in the last person listing.\n"
            + "Parameters: INDEX (must be a positive integer)\n"
            + "Example: " + COMMAND_WORD + " 1";

    public static final String MESSAGE_SELECT_TASK_SUCCESS = "Selected task: %1$s";

    public SelectCommand(int targetIndex) {
        this.targetIndex = targetIndex;
    }

    @Override
    public CommandResult execute() throws CommandException {

        UnmodifiableObservableList<ReadOnlyTask> lastShownList = model.getFilteredTaskList();

        if (lastShownList.size() < targetIndex) {
            throw new CommandException(Messages.MESSAGE_INVALID_TASK_DISPLAYED_INDEX);
        }

        EventsCenter.getInstance().post(new JumpToListRequestEvent(targetIndex - 1));
<<<<<<< HEAD
        return new CommandResult(String.format(MESSAGE_SELECT_PERSON_SUCCESS, targetIndex));
=======
        return new CommandResult(String.format(MESSAGE_SELECT_TASK_SUCCESS, targetIndex));

>>>>>>> origin/master
    }

    @Override
    public boolean isUndoable() {
        return false;
    }
}

@@ -1475,122 +1475,8 @@
 ));%0A
-%3C%3C%3C%3C%3C%3C%3C HEAD%0A        return new CommandResult(String.format(MESSAGE_SELECT_PERSON_SUCCESS, targetIndex));%0A=======%0A
     
@@ -1565,31 +1565,8 @@
 x));
-%0A%0A%3E%3E%3E%3E%3E%3E%3E origin/master
 %0A   

Resolve conflict