package seedu.tache.logic.commands;

import seedu.tache.commons.core.Messages;
import seedu.tache.logic.commands.exceptions.CommandException;
import seedu.tache.model.Model;

/**
 * Represents a command with hidden internal logic and the ability to be executed.
 */
public abstract class Command {
    protected Model model;

    /**
     * Constructs a feedback message to summarise an operation that displayed a listing of tasks.
     *
     * @param displaySize used to generate summary
     * @return summary message for tasks displayed
     */
    public static String getMessageForTaskListShownSummary(int displaySize) {
        return String.format(Messages.MESSAGE_TASKS_LISTED_OVERVIEW, displaySize);
    }

    public static String getMessageForDetailedTaskListShownSummary(int displaySize) {
        return String.format(Messages.MESSAGE_DETAILED_TASKS_LISTED_OVERVIEW, displaySize);
    }

    /**
     * Executes the command and returns the result message.
     *
     * @return feedback message of the operation result for display
     * @throws CommandException If an error occurs during command execution.
     */
    public abstract CommandResult execute() throws CommandException;

    /**
     * Provides any needed dependencies to the command.
     * Commands making use of any of these should override this method to gain
     * access to the dependencies.
     */
    public void setData(Model model) {
        this.model = model;
    }
}

@@ -30,16 +30,41 @@
 mands;%0A%0A
+import java.util.Stack;%0A%0A
 import s
@@ -342,16 +342,90 @@
 l model;
+%0A    protected static Stack%3CUndoable%3E undoHistory = new Stack%3CUndoable%3E();
 %0A%0A    /*
@@ -1550,11 +1550,182 @@
 l;%0A    %7D
+%0A%0A    //@@author A0150120H%0A    /**%0A     * Clears the undo history%0A     */%0A    protected static void clearUndoHistory() %7B%0A        undoHistory = new Stack%3CUndoable%3E();%0A    %7D
 %0A%7D%0A

Edit Command class to support Undo