Removed unused import
[Mograsim.git] / era.mi / src / era / mi / logic / wires / WireArray.java
index 29b3575..b7a83fa 100644 (file)
@@ -26,7 +26,7 @@ public class WireArray
        public WireArray(int length, int travelTime)\r
        {\r
                if (length < 1)\r
-                       throw new IllegalArgumentException(String.format("Tried to create an array of wires with length %o, but a length of less than 1 makes no sense.", length));\r
+                       throw new IllegalArgumentException(String.format("Tried to create an array of wires with length %d, but a length of less than 1 makes no sense.", length));\r
                this.length = length;\r
                this.travelTime = travelTime;\r
                initValues();\r
@@ -42,8 +42,9 @@ public class WireArray
                WireArrayInput input = inputs.get(0);\r
                if (!Arrays.equals(input.getValues(), values))\r
                {\r
+                       Bit[] oldValues = values.clone();\r
                        System.arraycopy(input.getValues(), 0, values, 0, length);\r
-                       notifyObservers();\r
+                       notifyObservers(oldValues);\r
                }\r
        }\r
 \r
@@ -69,8 +70,9 @@ public class WireArray
 \r
                if (!Arrays.equals(newValues, values))\r
                {\r
-                       notifyObservers();\r
+                       Bit[] oldValues = values;\r
                        values = newValues;\r
+                       notifyObservers(oldValues);\r
                }\r
        }\r
 \r
@@ -217,10 +219,10 @@ public class WireArray
                return observers.add(ob);\r
        }\r
 \r
-       private void notifyObservers()\r
+       private void notifyObservers(Bit[] oldValues)\r
        {\r
                for (WireArrayObserver o : observers)\r
-                       o.update(this);\r
+                       o.update(this, oldValues);\r
        }\r
 \r
        /**\r