package seedu.taskboss.logic.commands;

import java.util.EmptyStackException;

import seedu.taskboss.commons.exceptions.IllegalValueException;

//@@author A0138961W
/**
 * Redoes the most recent undo operation done by the user.
 */
public class RedoCommand extends Command {
	
    public static final String COMMAND_WORD = "redo";
    public static final String COMMAND_WORD_SHORT = "r";
    
    public static final String MESSAGE_USAGE = COMMAND_WORD
    		+ ": Redoes the previous undo operation by the user\n"
        + "Example: " + COMMAND_WORD + " || " + COMMAND_WORD_SHORT;
    
    public static final String MESSAGE_SUCCESS = "The most recent operation has been redone!";
    
    public static final String MESSAGE_WITHOUT_PREVIOUS_OPERATION = "Cannot redo";

    public RedoCommand() {}

    @Override
    public CommandResult execute() {
        assert model != null;
        try {
            model.redoTaskboss();
            model.updateFilteredListToShowAll();
            return new CommandResult(MESSAGE_SUCCESS);
        } catch (EmptyStackException ese) {
            return new CommandResult(MESSAGE_WITHOUT_PREVIOUS_OPERATION);
        } catch (IllegalValueException e) {
            return new CommandResult(e.getMessage());
        }
    }
}

@@ -272,10 +272,9 @@
 d %7B%0A
-%09
 %0A
+
     
@@ -380,21 +380,17 @@
  = %22r%22;%0A
-    
 %0A
+
     publ
@@ -570,21 +570,17 @@
 _SHORT;%0A
-    
 %0A
+
     publ
@@ -666,20 +666,16 @@
 done!%22;%0A
-    
 %0A    pub

Update RedoCommand.java