added more doc to Timeline; added functionality to Bit
[Mograsim.git] / era.mi / src / era / mi / logic / Util.java
index 6bca6d0..3ca16b7 100644 (file)
@@ -84,6 +84,22 @@ public final class Util
        }
        return out;
     }
+    
+    /**
+     * uses the {@link Bit#combineWith(Bit)} method, does not create a new array,
+     * the result is stored in the first array.
+     * 
+     * @author Christian Femers
+     */
+    public static Bit[] combineInto(Bit[] dest, Bit[] addition)
+    {
+    if (dest.length != addition.length)
+        throw new IllegalArgumentException("Bit Arrays were not of equal length.");
+    for (int i = 0; i < addition.length; i++) {
+           dest[i] = dest[i].combineWith(addition[i]);
+       }
+    return dest;
+    }
 
     interface BitOp
     {