package editor.util;

import java.util.function.Supplier;

/**
 * TODO
 */
public class UndoableAction<U, R>
{
    private final Supplier<R> forward;
    private final Supplier<U> reverse;

    public UndoableAction(final Supplier<R> f, final Supplier<U> r)
    {
        forward = f;
        reverse = r;
    }

    public U undo()
    {
        return reverse.get();
    }

    public R redo()
    {
        return forward.get();
    }
}
@@ -64,11 +64,342 @@
  * T
-ODO
+his class represents an action that can be undone, which is done by simply%0A * using two actions that are semantically supposed to be opposites.  Each%0A * action can optionally return a value.%0A * %0A * @param %3CR%3E information to be returned by the action%0A * @param %3CU%3E information to be returned by the undone action%0A * @author Alec Roelke
 %0A */
@@ -431,20 +431,20 @@
 ion%3C
-U, R
+R, U
 %3E%0A%7B%0A    
 priv
@@ -443,221 +443,743 @@
     
-private final Supplier%3CR%3E forward;%0A    private final Supplier%3CU%3E reverse;%0A%0A    public UndoableAction(final Supplier%3CR%3E f, final Supplier%3CU%3E r)%0A    %7B%0A        forward = f;%0A        reverse = r;%0A    %7D%0A%0A    public U un
+/**%0A     * %22Forward%22 action that represents what was done.%0A     */%0A    private final Supplier%3CR%3E forward;%0A    /**%0A     * %22Reverse%22 action that represents how to undo the forward action.%0A     */%0A    private final Supplier%3CU%3E reverse;%0A%0A    /**%0A     * Create a new UndoableAction.%0A     * %0A     * @param f %22forward%22 action representing what was done%0A     * @param r %22reverse%22 action representing how to undo it%0A     */%0A    public UndoableAction(final Supplier%3CR%3E f, final Supplier%3CU%3E r)%0A    %7B%0A        forward = f;%0A        reverse = r;%0A    %7D%0A%0A    /**%0A     * Perform the action (or redo it if it has been undone).%0A     * %0A     * @return a value containing information about the result of performing%0A     * the action.%0A     */%0A    public R re
 do()
@@ -1200,23 +1200,23 @@
  return 
-reverse
+forward
 .get();%0A
@@ -1218,24 +1218,155 @@
 t();%0A    %7D%0A%0A
+    /**%0A     * Undo the action.%0A     * %0A     * @return a value containing information about the result undoing the action.%0A     */%0A
     public R
@@ -1356,36 +1356,36 @@
   */%0A    public 
-R re
+U un
 do()%0A    %7B%0A     
@@ -1386,38 +1386,38 @@
 %0A        return 
-forward
+reverse
 .get();%0A    %7D%0A%7D

Add comments.