package tars.logic;

import javafx.collections.ObservableList;
import tars.commons.core.ComponentManager;
import tars.commons.core.LogsCenter;
import tars.logic.commands.Command;
import tars.logic.commands.CommandResult;
import tars.logic.parser.Parser;
import tars.model.Model;
import tars.model.task.ReadOnlyTask;
import tars.model.task.rsv.RsvTask;
import tars.storage.Storage;

import java.util.logging.Logger;

/**
 * The main LogicManager of the app.
 */
public class LogicManager extends ComponentManager implements Logic {
    
    private final Logger logger = LogsCenter.getLogger(LogicManager.class);

    private final Model model;
    private final Parser parser;

    public LogicManager(Model model, Storage storage) {
        this.model = model;
        this.parser = new Parser();
    }

    @Override
    /** @@author A0139924W */
    public CommandResult execute(String commandText) {
        logger.info("----------------[USER COMMAND][" + commandText + "]");
        Command command = parser.parseCommand(commandText);
        command.setData(model);
        
        return command.execute();
    }

    @Override
    public ObservableList<ReadOnlyTask> getFilteredTaskList() {
        return model.getFilteredTaskList();
    }
    
    @Override
    public ObservableList<RsvTask> getFilteredRsvTaskList() {
        return model.getFilteredRsvTaskList();
    }
    
}

@@ -14,16 +14,50 @@
 logic;%0A%0A
+import java.util.logging.Logger;%0A%0A
 import j
@@ -90,16 +90,16 @@
 leList;%0A
-
 import t
@@ -248,16 +248,96 @@
 Result;%0A
+import tars.logic.commands.RedoCommand;%0Aimport tars.logic.commands.UndoCommand;%0A
 import t
@@ -493,42 +493,8 @@
 e;%0A%0A
-import java.util.logging.Logger;%0A%0A
 /**%0A
@@ -896,38 +896,8 @@
 ide%0A
-    /** @@author A0139924W */%0A
     
@@ -1136,33 +1136,486 @@
     
-return command.execute();
+if(!isReUndoAbleCommand(command)) %7B%0A            model.getRedoableCmdHist().clear();%0A        %7D%0A        %0A        return command.execute();%0A    %7D%0A    %0A    /**%0A     * Checks if the command is an instance of redo or undo command%0A     * %0A     * @param command%0A     */%0A    private boolean isReUndoAbleCommand(Command command) %7B%0A        if (command instanceof UndoCommand %7C%7C command instanceof RedoCommand) %7B%0A            return true;%0A        %7D else %7B%0A            return false;%0A        %7D
 %0A   

Fix bug for redo command