//@@author A0150120H
package seedu.tache.logic.commands;

import java.util.Stack;

/*
 * Class to handle the Undo history. Uses a First-In-Last-Out data structure
 * This class follows the Singleton Pattern
 */
public class UndoHistory {

    private Stack<Undoable> data;
    private static UndoHistory currentInstance;

    /*
     * Creates a new UndoHistory object.
     * This should only be called once in the entire exectution
     */
    private UndoHistory() {
        data = new Stack<Undoable>();
    }

    /*
     * Adds an Undoable Command onto the stack
     * @param
     */
    public void push(Undoable target) {
        data.push(target);
    }

    public Undoable pop() {
        if (data.isEmpty()) {
            return null;
        } else {
            return data.pop();
        }
    }

    public void clear() {
        data = new Stack<Undoable>();
    }

    public static UndoHistory getInstance() {
        if (currentInstance == null) {
            currentInstance = new UndoHistory();
        }
        return currentInstance;
    }

}

@@ -313,32 +313,33 @@
 nstance;%0A%0A    /*
+*
 %0A     * Creates 
@@ -515,24 +515,25 @@
 %0A%0A    /*
+*
 %0A     * 
 Adds an 
@@ -528,11 +528,12 @@
   * 
-Add
+Save
 s an
@@ -554,22 +554,20 @@
 and 
-o
+i
 nto 
-the stack
+history
 %0A   
@@ -576,16 +576,52 @@
 * @param
+ target Undoable Command to be saved
 %0A     */
@@ -687,32 +687,188 @@
 target);%0A    %7D%0A%0A
+    /**%0A     * Removes and returns the latest Undoable Command from history.%0A     * @return Undoable object if history is populated, null otherwise%0A     */%0A
     public Undoa
@@ -991,32 +991,74 @@
        %7D%0A    %7D%0A%0A
+    /**%0A     * Clears all history%0A     */%0A
     public void 
@@ -1108,24 +1108,183 @@
 %3E();%0A    %7D%0A%0A
+    /**%0A     * Returns an instance of this class. It is guaranteed to be the same instance throughout execution.%0A     * @return instance of this class%0A     */%0A
     public s

Update Documentation for UndoHistory