]> gitweb.fperrin.net Git - GpsPrune.git/blobdiff - tim/prune/undo/UndoStack.java
Version 16.3, July 2014
[GpsPrune.git] / tim / prune / undo / UndoStack.java
diff --git a/tim/prune/undo/UndoStack.java b/tim/prune/undo/UndoStack.java
new file mode 100644 (file)
index 0000000..bca92b1
--- /dev/null
@@ -0,0 +1,24 @@
+package tim.prune.undo;
+
+import java.util.Stack;
+
+/**
+ * Stack of undo operations
+ * which also remembers how many times it's been cleared
+ */
+public class UndoStack extends Stack<UndoOperation>
+{
+       private int _numTimesDeleted = 0;
+
+       /** @return number of times this stack has been deleted */
+       public int getNumTimesDeleted() {
+               return _numTimesDeleted;
+       }
+
+       @Override
+       public void clear()
+       {
+               _numTimesDeleted++;
+               super.clear();
+       }
+}