package seedu.address.logic.commands;

import java.util.List;
import java.util.Set;

import seedu.address.model.task.ReadOnlyTask;

/**
 * Finds and lists all persons in address book whose name contains any of the argument keywords.
 * Keyword matching is case sensitive.
 */
public class FindCommand extends Command {

    public static final String COMMAND_WORD = "find";

    public static final String MESSAGE_USAGE = COMMAND_WORD + ": Finds all persons whose names contain any of "
            + "the specified keywords (case-sensitive) and displays them as a list with index numbers.\n"
            + "Parameters: KEYWORD [MORE_KEYWORDS]...\n"
            + "Example: " + COMMAND_WORD + " alice bob charlie";

    private final String keywords;

    public FindCommand(String keywords) {
        this.keywords = keywords;
    }

    @Override
    public CommandResult execute() {
/*        
        List<ReadOnlyTask> matchingTasks = model.getFilteredTaskListFromTaskName(keywords);
        Set<String> keywordList = model.getKeywordsFromList(matchingTasks);
        model.updateFilteredPersonList(keywordList);
        //model.updateFilteredPersonList(keywords);
        return new CommandResult(getMessageForPersonListShownSummary(model.getFilteredPersonList().size()));
*/
        return null;
    }

}

@@ -32,16 +32,42 @@
 mands;%0A%0A
+import java.util.HashSet;%0A
 import j
@@ -129,31 +129,165 @@
 ess.
-model.task.ReadOnlyTask
+commons.core.UnmodifiableObservableList;%0Aimport seedu.address.model.task.ReadOnlyTask;%0Aimport seedu.address.model.task.UniqueTaskList.PersonNotFoundException
 ;%0A%0A/
@@ -865,24 +865,110 @@
  charlie%22;%0A%0A
+    public static final String MESSAGE_FIND_TASK_FAILURE = %22No such task was found.%22;%0A
     private 
@@ -990,16 +990,20 @@
 ywords;%0A
+    
 %0A    pub
@@ -1133,18 +1133,16 @@
 ) %7B%0A
-/*
         
 %0A   
@@ -1141,69 +1141,120 @@
     
-%0A        List%3CReadOnlyTask%3E matchingTasks =
+Set%3CString%3E taskNameSet = new HashSet%3CString%3E();%0A        taskNameSet.add(keywords);%0A       
  model.
-get
+update
 Filtered
 Task
@@ -1253,162 +1253,498 @@
 ered
-TaskListFromTaskName(keywords);%0A        Set%3CString%3E keywordList = model.getKeywordsFromList(matchingTasks);%0A        model.updateFilteredPersonList
+PersonList(taskNameSet);%0A        UnmodifiableObservableList%3CReadOnlyTask%3E matchingTasks = model.getFilteredPersonList();%0A        %0A        // No tasks match string%0A        if (matchingTasks.isEmpty())%7B%0A            model.updateFilteredListToShowAll();%0A            return new CommandResult(String.format(MESSAGE_FIND_TASK_FAILURE));%0A        %7D%0A        %0A        // One or more tasks match string%0A        else %7B%0A            Set%3CString%3E words = new HashSet%3CString%3E();%0A            words.add
 (keyword
 List
@@ -1739,20 +1739,17 @@
 (keyword
-List
+s
 );%0A     
@@ -1751,18 +1751,20 @@
         
-//
+    
 model.up
@@ -1786,19 +1786,16 @@
 sonList(
-key
 words);%0A
@@ -1794,32 +1794,36 @@
 words);%0A        
+    
 return new Comma
@@ -1831,16 +1831,30 @@
 dResult(
+String.format(
 getMessa
@@ -1923,12 +1923,10 @@
 ()))
+)
 ;
-%0A*/
 %0A   
@@ -1934,20 +1934,9 @@
     
-return null;
+%7D
 %0A   

Change FindCommand.java to search through tasks using keywords