public void testEnsureCapacity() { assertSame(EMPTY, Doubles.ensureCapacity(EMPTY, 0, 1)); assertSame(ARRAY1, Doubles.ensureCapacity(ARRAY1, 0, 1)); assertSame(ARRAY1, Doubles.ensureCapacity(ARRAY1, 1, 1)); assertTrue( Arrays.equals( new double[] {(double) 1, (double) 0, (double) 0}, Doubles.ensureCapacity(ARRAY1, 2, 1))); }
public void testEnsureCapacity_fail() { try { Doubles.ensureCapacity(ARRAY1, -1, 1); fail(); } catch (IllegalArgumentException expected) { } try { // notice that this should even fail when no growth was needed Doubles.ensureCapacity(ARRAY1, 1, -1); fail(); } catch (IllegalArgumentException expected) { } }
public void setValue(int index, double value) { if (index >= doubleArray.length) { this.doubleArray = Doubles.ensureCapacity(this.doubleArray, index + 1, 0); } this.doubleArray[index] = value; }
public void addToValue(int index, double value) { if (index >= doubleArray.length) { this.doubleArray = Doubles.ensureCapacity(this.doubleArray, index + 1, 0); } this.doubleArray[index] += value; }
public void addToValue(int index, double value) { if (index >= doubleArray.length) { this.doubleArray = Doubles.ensureCapacity(this.doubleArray, index + 1, 0); } this.doubleArray[index] += value; }
public void addToValue(int index, double value) { if (index >= doubleArray.length) { this.doubleArray = Doubles.ensureCapacity(this.doubleArray, index + 1, 0); } this.doubleArray[index] += value; }
public void setValue(int index, double value) { if (index >= doubleArray.length) { this.doubleArray = Doubles.ensureCapacity(this.doubleArray, index + 1, 0); } this.doubleArray[index] = value; }
public void setValue(int index, double value) { if (index >= doubleArray.length) { this.doubleArray = Doubles.ensureCapacity(this.doubleArray, index + 1, 0); } this.doubleArray[index] = value; }
public void setValue(int index, double value) { if (index >= doubleArray.length) { this.doubleArray = Doubles.ensureCapacity(this.doubleArray, index + 1, 0); } this.doubleArray[index] = value; }
public void addToValue(int index, double value) { if (index >= doubleArray.length) { this.doubleArray = Doubles.ensureCapacity(this.doubleArray, index + 1, 0); } this.doubleArray[index] += value; }
public void testEnsureCapacity_fail() { try { Doubles.ensureCapacity(ARRAY1, -1, 1); fail(); } catch (IllegalArgumentException expected) { } try { // notice that this should even fail when no growth was needed Doubles.ensureCapacity(ARRAY1, 1, -1); fail(); } catch (IllegalArgumentException expected) { } }
public void testEnsureCapacity() { assertSame(EMPTY, Doubles.ensureCapacity(EMPTY, 0, 1)); assertSame(ARRAY1, Doubles.ensureCapacity(ARRAY1, 0, 1)); assertSame(ARRAY1, Doubles.ensureCapacity(ARRAY1, 1, 1)); assertTrue(Arrays.equals( new double[] {(double) 1, (double) 0, (double) 0}, Doubles.ensureCapacity(ARRAY1, 2, 1))); }