package seedu.malitio.logic.commands;

import seedu.malitio.commons.core.UnmodifiableObservableList;
import seedu.malitio.commons.exceptions.IllegalValueException;
import seedu.malitio.model.task.*;

/**
 * Lists all tasks in Malitio to the user.
 */
public class ListCommand extends Command {

    public static final String COMMAND_WORD = "list";

    public static final String MESSAGE_USAGE = COMMAND_WORD + ": Lists specified type of task to Malitio\n" +
            "Parameters: [events|deadlines|tasks] [DATETIME]\n" +
            "Example: " + COMMAND_WORD + " deadlines " + "22102016 0000";

    public static final String ALL_MESSAGE_SUCCESS = "Listed all tasks";
    public static final String TASK_MESSAGE_SUCCESS = "Listed floating tasks";
    public static final String DEADLINE_MESSAGE_SUCCESS = "Listed deadlines";
    public static final String EVENT_MESSAGE_SUCCESS = "Listed events";

    private String taskType = "";
    private DateTime timeKeyWord = null;
    UnmodifiableObservableList<ReadOnlyDeadline> filteredDeadlines;

    public ListCommand() {}

    public ListCommand(String args) throws IllegalValueException {
        if (args.matches("(floating)? tasks?")) {
            this.taskType = "tasks";
            return;
        }
        else if (args.matches("deadlines?.*")) {
            this.taskType = "deadlines";
            args = args.replaceAll("deadlines?\\s*", "");
        }
        else if (args.matches("events?.*")) {
            this.taskType = "events";
            args = args.replaceAll("events?\\s*", "");
        }
        if (!args.isEmpty()) {
            timeKeyWord = new DateTime(args);
        }
    }

    @Override
    public CommandResult execute() {
        if (taskType.equals("tasks")) {
            model.updateFilteredTaskListToShowAll();
            return new CommandResult(TASK_MESSAGE_SUCCESS);
        } else if (taskType.equals("deadlines")) {
            if (timeKeyWord != null) {
                model.updateFilteredDeadlineList(timeKeyWord);
            } else {
                model.updateFilteredDeadlineListToShowAll();
            }
            return new CommandResult(DEADLINE_MESSAGE_SUCCESS);
        } else if (taskType.equals("events")) {
            if (timeKeyWord != null) {
                model.updateFilteredEventList(timeKeyWord);
            } else { 
                model.updateFilteredEventListToShowAll();
            }
            return new CommandResult(EVENT_MESSAGE_SUCCESS);
        } else {
            model.updateFilteredTaskListToShowAll();
            model.updateFilteredDeadlineListToShowAll();
            model.updateFilteredEventListToShowAll();
            return new CommandResult(ALL_MESSAGE_SUCCESS);
        }
    }
}

@@ -975,76 +975,8 @@
 ull;
-%0A    UnmodifiableObservableList%3CReadOnlyDeadline%3E filteredDeadlines;
 %0A%0A  
@@ -2415,32 +2415,219 @@
        %7D else %7B%0A
+            if (timeKeyWord != null) %7B%0A                model.updateFilteredDeadlineList(timeKeyWord);%0A                model.updateFilteredEventList(timeKeyWord);%0A            %7D else %7B%0A    
             mode
@@ -2667,32 +2667,36 @@
 ();%0A            
+   
+ 
 model.updateFilt
@@ -2728,32 +2728,36 @@
 ();%0A            
+    
 model.updateFilt
@@ -2774,32 +2774,46 @@
 istToShowAll();%0A
+            %7D%0A
             retu

Update list to search both list/deadlines with just datetime parameter