<commit_before>package edu.dynamic.dynamiz.controller;

import java.util.EmptyStackException;
import java.util.Stack;

import edu.dynamic.dynamiz.structure.ToDoItem;

/**
 * Defines the command class that undoes the previously executed command.
 * 
 * Constructor
 * CommandUndo()	//Creates a new instance of this command.
 * 
 * Public Methods
 * ToDoItem[] getAffectedItems()	//Gets the list of ToDoItems affected by this command.
 * String getCommandName()		//Gets the string representation of this command's type
 * void execute()	//Executes this command
 * void setStacks(Stack<Command> undoStack, Stack<Command> redoStack)	//Assigns the appropriate stacks to this command for execution
 * 
 * @author zixian
 */
public class CommandUndo extends Command {
    //String representation of this command's type
    private static final String COMMAND_TYPE = "undo";
    
    //Main data members
    private Stack<Undoable> undoStack, redoStack;
    private Undoable command;	//The command to be undone
    
    /**
     * Creates a new instance of this undo command
     */
    public CommandUndo(){
	
    }
    
    /**
     * Passes the past and undone command history to this command.
     * @param undoStack The stack of commands to retrieve the command from.
     * @param redoStack The stack of commands to place the undone command into.
     */
    public void setStacks(Stack<Undoable> undoStack, Stack<Undoable> redoStack){
	assert undoStack!=null && redoStack!=null;
	this.undoStack = undoStack;
	this.redoStack = redoStack;
    }
    
    @Override
    public void execute() throws EmptyStackException {
	assert undoStack!=null && redoStack!=null;
	command = undoStack.pop();
	redoStack.push(command);
	command.undo();
    }

    @Override
    /**
     * Gets the string representation of this command's type.
     * @return The String representation of this command's type.
     */
    public String getCommandName() {<commit_msg>Updates CommandUndo documentation<commit_after>package edu.dynamic.dynamiz.controller;

import java.util.EmptyStackException;
import java.util.Stack;

import edu.dynamic.dynamiz.structure.ToDoItem;

/**
 * Defines the command class that undoes the previously executed command.
 * 
 * Constructor
 * CommandUndo()	//Creates a new instance of this command.
 * 
 * Public Methods
 * ToDoItem[] getAffectedItems()	//Gets the list of ToDoItems affected by this command.
 * String getCommandName()		//Gets the string representation of this command's type
 * void execute()	//Executes this command
 * void setStacks(Stack<Command> undoStack, Stack<Command> redoStack)	//Assigns the appropriate stacks to this command for execution
 * 
 * @author zixian
 */
public class CommandUndo extends Command {
    //String representation of this command's type
    private static final String COMMAND_TYPE = "undo";
    
    //Main data members
    private Stack<Undoable> undoStack, redoStack;
    private Undoable command;	//The command to be undone
    
    /**
     * Creates a new instance of this undo command
     */
    public CommandUndo(){
	
    }
    
    /**
     * Passes the past and undone command history to this command.
     * @param undoStack The stack of commands to retrieve the command from.
     * @param redoStack The stack of commands to place the undone command into.
     */
    public void setStacks(Stack<Undoable> undoStack, Stack<Undoable> redoStack){
	assert undoStack!=null && redoStack!=null;
	this.undoStack = undoStack;
	this.redoStack = redoStack;
    }
    
    @Override
    /**
     * Executes this command.
     * @throws EmptyStackException if the undo stack is empty.
     */
    public void execute() throws EmptyStackException {
	assert undoStack!=null && redoStack!=null;
	command = undoStack.pop();
	redoStack.push(command);
	command.undo();
    }

    @Override
    /**
     * Gets the string representation of this command's type.
     * @return The String representation of this command's type.
     */
    public String getCommandName() {
{'fraction_non_alphanumeric': 0.08717310087173101, 'fraction_numerical': 0.0, 'mean_word_length': 3.3604777415852336, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5006750', 'n_tokens_mistral': 1165, 'n_tokens_neox': 1112, 'n_words': 397}