Use the first set value as original.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 18 Apr 2012 04:37:38 +0000 (06:37 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 18 Apr 2012 04:37:38 +0000 (06:37 +0200)
src/main/java/net/pterodactylus/demoscenemusic/data/AbstractBase.java

index 4a35db1..6a21081 100644 (file)
@@ -51,6 +51,8 @@ public class AbstractBase {
 
                private T original;
 
+               private boolean originalSet;
+
                private T current;
 
                public T get() {
@@ -58,6 +60,10 @@ public class AbstractBase {
                }
 
                public Value<T> set(T value) {
+                       if (!originalSet) {
+                               original = value;
+                               originalSet = true;
+                       }
                        current = value;
                        return this;
                }