@Test public void testClear() { DoubleBag bag; bag = new DoubleBag(); bag.set(0, 1d); bag.set(1, 1d); bag.set(63, 1d); bag.clear(); assertEquals((Double) 0d, (Double) bag.get(0)); assertEquals((Double) 0d, (Double) bag.get(1)); assertEquals((Double) 0d, (Double) bag.get(63)); assertEquals(64, bag.buffer.length); Mask mask = new Mask(); bag = new DoubleBag(); bag.set(0, 1d); bag.set(1, 1d); bag.set(63, 1d); mask.set(63); mask.set(0); bag.clear(mask); assertEquals((Double) 0d, (Double) bag.get(0)); assertNotEquals((Double) 0d, (Double) bag.get(1)); assertEquals((Double) 0d, (Double) bag.get(63)); mask.set(1); mask.set(457); bag.clear(mask); assertEquals((Double) 0d, (Double) bag.get(0)); assertEquals((Double) 0d, (Double) bag.get(1)); assertEquals((Double) 0d, (Double) bag.get(63)); assertEquals(64, bag.buffer.length); }
@Override public void clear() { double[] buffer = this.buffer; for (int i = 0, n = buffer.length; i < n; ++i) buffer[i] = 0d; }
DoubleBag implements AnyBag<DoubleBag> { @Override public void clear() { double[] buffer = this.buffer; for (int i = 0, n = buffer.length; i < n; ++i) buffer[i] = 0d; } }
DoubleBag implements AnyBag<DoubleBag> { @Override public void clear() { double[] buffer = this.buffer; for (int i = 0, n = buffer.length; i < n; ++i) buffer[i] = 0d; } DoubleBag(); }
DoubleBag implements AnyBag<DoubleBag> { @Override public void clear() { double[] buffer = this.buffer; for (int i = 0, n = buffer.length; i < n; ++i) buffer[i] = 0d; } DoubleBag(); @Override void copyFrom(DoubleBag from); @Override void copyFrom(DoubleBag from, boolean clearExceeding); @Override void copyFrom(DoubleBag from, int length); @Override void copyFrom(DoubleBag from, int length, boolean clearExceeding); @Override void copyFrom(DoubleBag from, int fromOffset, int length); @Override void copyFrom(DoubleBag from, int fromOffset, int length, boolean clearExceeding); @Override void copyPartFrom(DoubleBag from, int fromOffset, int toOffset, int length); @Override void ensureCapacity(int capacity); double get(int index); void set(int index, double value); @Override void clear(); @Override void clear(Mask mask); }
DoubleBag implements AnyBag<DoubleBag> { @Override public void clear() { double[] buffer = this.buffer; for (int i = 0, n = buffer.length; i < n; ++i) buffer[i] = 0d; } DoubleBag(); @Override void copyFrom(DoubleBag from); @Override void copyFrom(DoubleBag from, boolean clearExceeding); @Override void copyFrom(DoubleBag from, int length); @Override void copyFrom(DoubleBag from, int length, boolean clearExceeding); @Override void copyFrom(DoubleBag from, int fromOffset, int length); @Override void copyFrom(DoubleBag from, int fromOffset, int length, boolean clearExceeding); @Override void copyPartFrom(DoubleBag from, int fromOffset, int toOffset, int length); @Override void ensureCapacity(int capacity); double get(int index); void set(int index, double value); @Override void clear(); @Override void clear(Mask mask); @Experimental
    public double[] buffer; }