@Test public void testCopyPartFrom() { BooleanBag b0, b1; boolean e0 = true, e1 = true, e2 = true, e3 = true; b0 = new BooleanBag(); b0.set(5, e0); b0.set(14, e1); b0.set(21, e2); b1 = new BooleanBag(); b1.set(0, e3); b1.set(33, e0); b1.copyPartFrom(b0, 14, 1, 33); assertEquals((Boolean) e1, (Boolean) b1.get(1)); assertEquals((Boolean) e2, (Boolean) b1.get(8)); assertEquals((Boolean) e3, (Boolean) b1.get(0)); assertEquals((Boolean) false, (Boolean) b1.get(32)); assertEquals((Boolean) false, (Boolean) b1.get(33)); assertEquals((Boolean) false, (Boolean) b1.get(34)); assertEquals((Boolean) false, (Boolean) b1.get(35)); b0 = new BooleanBag(); b0.set(5, e0); b0.set(14, e1); b0.set(21, e2); b1 = new BooleanBag(); b1.set(0, e3); b1.copyPartFrom(b0, 14, 1, 8); assertEquals((Boolean) e1, (Boolean) b1.get(1)); assertEquals((Boolean) e2, (Boolean) b1.get(8)); assertEquals((Boolean) e3, (Boolean) b1.get(0)); assertEquals((Boolean) false, (Boolean) b1.get(32)); assertEquals((Boolean) false, (Boolean) b1.get(33)); assertEquals((Boolean) false, (Boolean) b1.get(34)); assertEquals((Boolean) false, (Boolean) b1.get(35)); }
@Override public void copyPartFrom(BooleanBag from, int fromOffset, int toOffset, int length) { ensureCapacity(toOffset + length); int maxLength = from.buffer.length - fromOffset; System.arraycopy(from.buffer, fromOffset, buffer, toOffset, Math.min(length, maxLength)); if (maxLength < length) { boolean[] buffer = this.buffer; for (int i = toOffset + maxLength, n = toOffset + length; i < n; i++) buffer[i] = false; } }
BooleanBag implements AnyBag<BooleanBag> { @Override public void copyPartFrom(BooleanBag from, int fromOffset, int toOffset, int length) { ensureCapacity(toOffset + length); int maxLength = from.buffer.length - fromOffset; System.arraycopy(from.buffer, fromOffset, buffer, toOffset, Math.min(length, maxLength)); if (maxLength < length) { boolean[] buffer = this.buffer; for (int i = toOffset + maxLength, n = toOffset + length; i < n; i++) buffer[i] = false; } } }
BooleanBag implements AnyBag<BooleanBag> { @Override public void copyPartFrom(BooleanBag from, int fromOffset, int toOffset, int length) { ensureCapacity(toOffset + length); int maxLength = from.buffer.length - fromOffset; System.arraycopy(from.buffer, fromOffset, buffer, toOffset, Math.min(length, maxLength)); if (maxLength < length) { boolean[] buffer = this.buffer; for (int i = toOffset + maxLength, n = toOffset + length; i < n; i++) buffer[i] = false; } } BooleanBag(); }
BooleanBag implements AnyBag<BooleanBag> { @Override public void copyPartFrom(BooleanBag from, int fromOffset, int toOffset, int length) { ensureCapacity(toOffset + length); int maxLength = from.buffer.length - fromOffset; System.arraycopy(from.buffer, fromOffset, buffer, toOffset, Math.min(length, maxLength)); if (maxLength < length) { boolean[] buffer = this.buffer; for (int i = toOffset + maxLength, n = toOffset + length; i < n; i++) buffer[i] = false; } } BooleanBag(); @Override void copyFrom(BooleanBag from); @Override void copyFrom(BooleanBag from, boolean clearExceeding); @Override void copyFrom(BooleanBag from, int length); @Override void copyFrom(BooleanBag from, int length, boolean clearExceeding); @Override void copyFrom(BooleanBag from, int fromOffset, int length); @Override void copyFrom(BooleanBag from, int fromOffset, int length, boolean clearExceeding); @Override void copyPartFrom(BooleanBag from, int fromOffset, int toOffset, int length); @Override void ensureCapacity(int capacity); boolean get(int index); void set(int index, boolean value); @Override void clear(); @Override void clear(Mask mask); }
BooleanBag implements AnyBag<BooleanBag> { @Override public void copyPartFrom(BooleanBag from, int fromOffset, int toOffset, int length) { ensureCapacity(toOffset + length); int maxLength = from.buffer.length - fromOffset; System.arraycopy(from.buffer, fromOffset, buffer, toOffset, Math.min(length, maxLength)); if (maxLength < length) { boolean[] buffer = this.buffer; for (int i = toOffset + maxLength, n = toOffset + length; i < n; i++) buffer[i] = false; } } BooleanBag(); @Override void copyFrom(BooleanBag from); @Override void copyFrom(BooleanBag from, boolean clearExceeding); @Override void copyFrom(BooleanBag from, int length); @Override void copyFrom(BooleanBag from, int length, boolean clearExceeding); @Override void copyFrom(BooleanBag from, int fromOffset, int length); @Override void copyFrom(BooleanBag from, int fromOffset, int length, boolean clearExceeding); @Override void copyPartFrom(BooleanBag from, int fromOffset, int toOffset, int length); @Override void ensureCapacity(int capacity); boolean get(int index); void set(int index, boolean value); @Override void clear(); @Override void clear(Mask mask); @Experimental
    public boolean[] buffer; }