package seedu.address.logic.parser;

import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.parser.CliSyntax.PREFIX_DEADLINE;

import java.util.Date;
import java.util.List;

import seedu.address.logic.commands.Command;
import seedu.address.logic.commands.IncorrectCommand;
import seedu.address.logic.commands.ListCommand;

public class ListCommandParser {

    /**
     * Parses the given {@code String} of arguments in the context of the
     * FindCommand and returns an FindCommand object for execution.
     */
    public Command parse(String args) {
        try {
            if (!args.isEmpty() && args.contains("by ")) {
                ArgumentTokenizer argsTokenizer = new ArgumentTokenizer(PREFIX_DEADLINE);
                argsTokenizer.tokenize(args);
                List<Date> endDateList = new DateTimeParser().parse(
                        argsTokenizer.getValue(PREFIX_DEADLINE).get()).get(0).getDates();
                List<Date> startDateList = new DateTimeParser().parse("now").get(0).getDates();
                return new ListCommand(startDateList.get(0), endDateList.get(0));
            }
        } catch (Exception e) {
            return new IncorrectCommand(String.format(MESSAGE_INVALID_COMMAND_FORMAT, ListCommand.MESSAGE_USAGE));
        }

        return new ListCommand();
    }

}

@@ -184,53 +184,160 @@
 NE;%0A
-%0A
 import 
-java.util.Date;%0Aimport java.util.List
+static seedu.address.logic.parser.CliSyntax.PREFIX_TIMEINTERVAL_END;%0Aimport static seedu.address.logic.parser.CliSyntax.PREFIX_TIMEINTERVAL_START
 ;%0A%0Ai
@@ -734,71 +734,8 @@
 y %7B%0A
-            if (!args.isEmpty() && args.contains(%22by %22)) %7B%0A    
     
@@ -813,18 +813,17 @@
 DEADLINE
-);
+,
 %0A       
@@ -835,292 +835,518 @@
     
-argsTokenizer.tokenize(args);%0A                List%3CDate%3E endDateList = new DateTimeParser().parse(%0A                        argsTokenizer.getValue(PREFIX_DEADLINE).get()).get(0).getDates();%0A                List%3CDate%3E startDateList = new DateTimeParser().parse(%22now%22).get(0).getDates();
+    PREFIX_TIMEINTERVAL_START, PREFIX_TIMEINTERVAL_END);%0A            argsTokenizer.tokenize(args);%0A            if (args.trim().contains(PREFIX_TIMEINTERVAL_START.getPrefix())%0A                    && args.trim().contains(PREFIX_TIMEINTERVAL_END.getPrefix())) %7B%0A                return new ListCommand(argsTokenizer.getValue(PREFIX_TIMEINTERVAL_START).get(),%0A                        argsTokenizer.getValue(PREFIX_TIMEINTERVAL_END).get());%0A            %7D else if (args.trim().contains(PREFIX_DEADLINE.getPrefix())) %7B
 %0A   
@@ -1385,47 +1385,52 @@
 and(
-startDateList.get(0), endDateList
+argsTokenizer.getValue(PREFIX_DEADLINE)
 .get(
-0
 ));%0A
@@ -1471,24 +1471,57 @@
 eption e) %7B%0A
+            e.printStackTrace();%0A
             

Rename edit task descriptor set address method to set deadline