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.todo.ReadOnlyPerson;

/**
 * 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 person 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_PERSON_SUCCESS = "Selected Person: %1$s";

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

    @Override
    public CommandResult execute() throws CommandException {

        UnmodifiableObservableList<ReadOnlyPerson> lastShownList = model.getFilteredPersonList();

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

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

    }

}

@@ -354,22 +354,20 @@
 ReadOnly
-Person
+Todo
 ;%0A%0A/**%0A 
@@ -378,22 +378,20 @@
 lects a 
-person
+todo
  identif
@@ -680,22 +680,20 @@
 cts the 
-person
+todo
  identif
@@ -737,14 +737,12 @@
 ast 
-person
+todo
  lis
@@ -903,38 +903,36 @@
  MESSAGE_SELECT_
-PERSON
+TODO
 _SUCCESS = %22Sele
@@ -936,22 +936,20 @@
 elected 
-Person
+Todo
 : %251$s%22;
@@ -1160,22 +1160,20 @@
 ReadOnly
-Person
+Todo
 %3E lastSh
@@ -1203,14 +1203,12 @@
 ered
-Person
+Todo
 List
@@ -1326,22 +1326,20 @@
 INVALID_
-PERSON
+TODO
 _DISPLAY
@@ -1512,14 +1512,12 @@
 ECT_
-PERSON
+TODO
 _SUC

Refactor SelectCommand