DoubleBag implements AnyBag<DoubleBag> { @Override public void copyFrom(DoubleBag from) { copyFrom(from, true); } 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; }
@Test public void testCopyFrom() { DoubleBag bag0, bag1; double e0 = 1d, e1 = 1d, e2 = 1d, e3 = 1d; bag0 = new DoubleBag(); bag0.set(0, e0); bag0.set(3, e1); bag0.set(9, e2); bag1 = new DoubleBag(); bag1.copyFrom(bag0); assertEquals((Double) e0, (Double) bag1.get(0)); assertEquals((Double) e1, (Double) bag1.get(3)); assertEquals((Double) e2, (Double) bag1.get(9)); bag1 = new DoubleBag(); bag1.set(53, e3); bag1.copyFrom(bag0, false); assertEquals((Double) e0, (Double) bag1.get(0)); assertEquals((Double) e1, (Double) bag1.get(3)); assertEquals((Double) e2, (Double) bag1.get(9)); assertEquals((Double) e3, (Double) bag1.get(53)); bag1 = new DoubleBag(); bag1.set(53, e3); bag1.copyFrom(bag0, true); assertEquals((Double) e0, (Double) bag1.get(0)); assertEquals((Double) e1, (Double) bag1.get(3)); assertEquals((Double) e2, (Double) bag1.get(9)); assertEquals((Double) 0d, (Double) bag1.get(53)); bag0 = new DoubleBag(); bag0.set(4, e0); bag0.set(7, e1); bag1 = new DoubleBag(); bag1.copyFrom(bag0, 3); assertEquals((Double) 0d, (Double) bag1.get(0)); assertEquals((Double) 0d, (Double) bag1.get(1)); assertEquals((Double) 0d, (Double) bag1.get(2)); assertEquals((Double) 0d, (Double) bag1.get(3)); assertEquals((Double) 0d, (Double) bag1.get(4)); assertEquals((Double) 0d, (Double) bag1.get(5)); assertEquals((Double) 0d, (Double) bag1.get(6)); assertEquals((Double) 0d, (Double) bag1.get(7)); bag1 = new DoubleBag(); bag1.copyFrom(bag0, 5); assertEquals((Double) 0d, (Double) bag1.get(0)); assertEquals((Double) 0d, (Double) bag1.get(1)); assertEquals((Double) 0d, (Double) bag1.get(2)); assertEquals((Double) 0d, (Double) bag1.get(3)); assertEquals((Double) e0, (Double) bag1.get(4)); assertEquals((Double) 0d, (Double) bag1.get(5)); assertEquals((Double) 0d, (Double) bag1.get(6)); assertEquals((Double) 0d, (Double) bag1.get(7)); bag1 = new DoubleBag(); bag1.set(8, e2); bag1.copyFrom(bag0, 8, true); assertEquals((Double) 0d, (Double) bag1.get(0)); assertEquals((Double) 0d, (Double) bag1.get(1)); assertEquals((Double) 0d, (Double) bag1.get(2)); assertEquals((Double) 0d, (Double) bag1.get(3)); assertEquals((Double) e0, (Double) bag1.get(4)); assertEquals((Double) 0d, (Double) bag1.get(5)); assertEquals((Double) 0d, (Double) bag1.get(6)); assertEquals((Double) e1, (Double) bag1.get(7)); assertEquals((Double) 0d, (Double) bag1.get(8)); assertEquals((Double) 0d, (Double) bag1.get(9)); bag0 = new DoubleBag(); bag0.set(0, e0); bag0.set(4, e1); bag0.set(6, e2); bag1 = new DoubleBag(); bag1.copyFrom(bag0, 3, 2); assertEquals((Double) 0d, (Double) bag1.get(0)); assertEquals((Double) e1, (Double) bag1.get(1)); assertEquals((Double) 0d, (Double) bag1.get(2)); assertEquals((Double) 0d, (Double) bag1.get(3)); assertEquals((Double) 0d, (Double) bag1.get(4)); assertEquals((Double) 0d, (Double) bag1.get(5)); assertEquals((Double) 0d, (Double) bag1.get(6)); assertEquals((Double) 0d, (Double) bag1.get(7)); assertEquals((Double) 0d, (Double) bag1.get(8)); bag0 = new DoubleBag(); bag0.set(0, e0); bag0.set(4, e1); bag0.set(10, e2); bag1 = new DoubleBag(); bag1.set(7, e3); bag1.copyFrom(bag0, 3, 2, false); assertEquals((Double) 0d, (Double) bag1.get(0)); assertEquals((Double) e1, (Double) bag1.get(1)); assertEquals((Double) 0d, (Double) bag1.get(2)); assertEquals((Double) 0d, (Double) bag1.get(3)); assertEquals((Double) 0d, (Double) bag1.get(4)); assertEquals((Double) 0d, (Double) bag1.get(5)); assertEquals((Double) 0d, (Double) bag1.get(6)); assertEquals((Double) e3, (Double) bag1.get(7)); assertEquals((Double) 0d, (Double) bag1.get(8)); assertEquals((Double) 0d, (Double) bag1.get(9)); assertEquals((Double) 0d, (Double) bag1.get(10)); }