package tars.logic.commands;

import java.util.ArrayList;
import tars.model.task.TaskQuery;

/**
 * Finds and lists all tasks 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 tasks whose names contain any of "
            + "the specified keywords (case-insensitive) and displays them as a list with index numbers.\n"
            + "Parameters: KEYWORD [MORE_KEYWORDS]...\n" + "Example: " + COMMAND_WORD + " CS2103 projects";

    private TaskQuery taskQuery = null;
    private ArrayList<String> lazySearchKeywords = null;
    private String searchKeywords = "";

    public FindCommand(TaskQuery taskQuery) {
        this.taskQuery = taskQuery;
    }

    public FindCommand(ArrayList<String> lazySearchKeywords) {
        this.lazySearchKeywords = lazySearchKeywords;
    }
    
    
    @Override
    public CommandResult execute() {
        if (taskQuery != null) {
            model.updateFilteredTaskListUsingFlags(taskQuery);
            searchKeywords = "\n" + taskQuery.toString();
        }

        if (lazySearchKeywords != null) {
            model.updateFilteredTaskListUsingLazySearch(lazySearchKeywords);
            searchKeywords = "\nQuick Search Keywords: " + lazySearchKeywords.toString();
        }
        return new CommandResult(
                getMessageForTaskListShownSummary(model.getFilteredTaskList().size()) + searchKeywords);
    }

}

@@ -402,45 +402,35 @@
 nds 
-all tasks whose names contain any of 
+task based on the specified
 %22%0A  
@@ -446,22 +446,8 @@
  + %22
-the specified 
 keyw
@@ -546,16 +546,36 @@
 rameters
+ (Quick Search Mode)
 : KEYWOR
@@ -601,57 +601,350 @@
 .%5Cn%22
- + %22Example: %22 + COMMAND_WORD + %22 CS2103 projects
+%0A            + %22Parameters (Filter Search Mode): -n NAME -dt DATETIME -p PRIORITY -t TAGS -do %5Bor -ud%5D %5Cn%22%0A            + %22Examples (Quick Serach Mode): %22 + COMMAND_WORD + %22 CS2103 projects%22 + %22Examples (Filter Search Mode): %22%0A            + COMMAND_WORD + %22 -n CS2103 projects -dt 10/09/2016 1000 to %22 + %2220/09/2016 0100 -t school projects -do
 %22;%0A%0A
@@ -1293,25 +1293,16 @@
 ;%0A    %7D%0A
-    %0A    
 %0A    @Ov

Update Find Command MESSAGE_USAGE