add BitVector.set(BitVector)
authormegacz <adam@megacz.com>
Thu, 8 Jan 2009 06:06:26 +0000 (22:06 -0800)
committermegacz <adam@megacz.com>
Thu, 8 Jan 2009 06:06:26 +0000 (22:06 -0800)
src/edu/berkeley/fleet/api/BitVector.java

index 9c111b6..8b08fc6 100644 (file)
@@ -44,6 +44,14 @@ public class BitVector {
         return this;
     }
 
+    public BitVector set(BitVector bv) {
+        if (immutable) throw new RuntimeException("attempt to modify an immutable BitVector");
+        if (length()!=bv.length()) throw new RuntimeException("attempt to copy between BitVectors of unequal sizes");
+        for(int i=0; i<length(); i++)
+            set(i, bv.get(i));
+        return this;
+    }
+
     /** copy the low-order bits of the argument into this BitVector and sign extend; returns <tt>this</tt> */
     public BitVector setAndSignExtend(long value) {
         if (immutable) throw new RuntimeException("attempt to modify an immutable BitVector");