@@ -0,0 +1,2684 @@
+package tars.logic.commands;%0A%0Aimport java.time.DateTimeException;%0Aimport java.util.HashSet;%0Aimport java.util.Set;%0A%0Aimport tars.commons.core.Messages;%0Aimport tars.commons.exceptions.DuplicateTaskException;%0Aimport tars.commons.exceptions.IllegalValueException;%0Aimport tars.model.task.DateTime;%0Aimport tars.model.task.Name;%0Aimport tars.model.task.Priority;%0Aimport tars.model.task.rsv.RsvTask;%0A%0A/**%0A * Adds a reserved task which has a list of reserved datetimes that can%0A * confirmed later on.%0A * %0A * @@author A0124333U%0A */%0A%0Apublic class RsvCommand extends UndoableCommand %7B%0A%0A    public static final String COMMAND_WORD = %22rsv%22;%0A%0A    public static final String MESSAGE_USAGE = COMMAND_WORD + %22: Reserves one or more timeslot for a task.%5Cn%22%0A            + %22Parameters: TASK %5B-dt DATETIME%5D %5BADDITIONAL DATETIME%5D%5Cn%22 + %22Example: %22 + COMMAND_WORD%0A            + %22 Meet John Doe -dt 26/09/2016 0900 to 1030, 28/09/2016 1000 to 1130%22;%0A    %0A    public static final String MESSAGE_DATETIME_NOTFOUND = %22At least one DateTime is required!%5Cn%22 + MESSAGE_USAGE;%0A%0A    public static final String MESSAGE_SUCCESS = %22New task reserved: %251$s%22;%0A    public static final String MESSAGE_UNDO = %22Removed %251$s%22;%0A    public static final String MESSAGE_REDO = %22Reserved %251$s%22;%0A%0A    private final RsvTask toReserve;%0A%0A    /**%0A     * Convenience constructor using raw values.%0A     *%0A     * @throws IllegalValueException%0A     *             if any of the raw values are invalid%0A     * @throws DateTimeException%0A     *             if given dateTime string is invalid.%0A     */%0A%0A    public RsvCommand(String name, Set%3CString%5B%5D%3E dateTimeStringSet, String priority, Set%3CString%3E tags)%0A            throws IllegalValueException %7B%0A%0A        Set%3CDateTime%3E dateTimeSet = new HashSet%3C%3E();%0A        for (String%5B%5D dateTimeStringArray : dateTimeStringSet) %7B%0A            dateTimeSet.add(new DateTime(dateTimeStringArray%5B0%5D, dateTimeStringArray%5B1%5D));%0A        %7D%0A%0A        this.toReserve = new RsvTask(new Name(name), dateTimeSet, new Priority(priority), new HashSet%3CString%3E(tags));%0A%0A    %7D%0A%0A    @Override%0A    public CommandResult undo() %7B%0A        // TODO Auto-generated method stub%0A        return null;%0A    %7D%0A%0A    @Override%0A    public CommandResult redo() %7B%0A        // TODO Auto-generated method stub%0A        return null;%0A    %7D%0A%0A    @Override%0A    public CommandResult execute() %7B%0A        assert model != null;%0A        try %7B%0A            model.addRsvTask(toReserve);%0A            model.getUndoableCmdHist().push(this);%0A            return new CommandResult(String.format(MESSAGE_SUCCESS, toReserve.toString()));%0A        %7D catch (DuplicateTaskException e) %7B%0A            return new CommandResult(Messages.MESSAGE_DUPLICATE_TASK);%0A        %7D%0A%0A    %7D%0A%0A%7D%0A

Add RsvCommand to allow users to add reserved tasks