ResizableDoubleArray implements DoubleArray, Serializable { public synchronized void addElements(double[] values) { final double[] tempArray = new double[numElements + values.length + 1]; System.arraycopy(internalArray, startIndex, tempArray, 0, numElements); System.arraycopy(values, 0, tempArray, numElements, values.length); internalArray = tempArray; startIndex = 0; numElements += values.length; } ResizableDoubleArray();  ResizableDoubleArray(int initialCapacity);  ResizableDoubleArray(double[] initialArray); @Deprecated  ResizableDoubleArray(int initialCapacity,
                                float expansionFactor);  ResizableDoubleArray(int initialCapacity,
                                double expansionFactor); @Deprecated  ResizableDoubleArray(int initialCapacity,
                                float expansionFactor,
                                float contractionCriteria);  ResizableDoubleArray(int initialCapacity,
                                double expansionFactor,
                                double contractionCriterion); @Deprecated  ResizableDoubleArray(int initialCapacity, float expansionFactor,
            float contractionCriteria, int expansionMode);  ResizableDoubleArray(int initialCapacity,
                                double expansionFactor,
                                double contractionCriterion,
                                ExpansionMode expansionMode,
                                double ... data);  ResizableDoubleArray(ResizableDoubleArray original); synchronized void addElement(double value); synchronized void addElements(double[] values); synchronized double addElementRolling(double value); synchronized double substituteMostRecentElement(double value); synchronized void clear(); synchronized void contract(); synchronized void discardFrontElements(int i); synchronized void discardMostRecentElements(int i); @Deprecated float getContractionCriteria(); double getContractionCriterion(); synchronized double getElement(int index); synchronized double[] getElements(); @Deprecated float getExpansionFactor(); @Deprecated int getExpansionMode(); int getCapacity(); synchronized int getNumElements(); @Deprecated synchronized double[] getInternalValues(); @Deprecated void setContractionCriteria(float contractionCriteria); double compute(MathArrays.Function f); synchronized void setElement(int index, double value); @Deprecated void setExpansionFactor(float expansionFactor); @Deprecated void setExpansionMode(int expansionMode); @Deprecated void setExpansionMode(ExpansionMode expansionMode); synchronized void setNumElements(int i); @Deprecated synchronized int start(); static void copy(ResizableDoubleArray source,
                            ResizableDoubleArray dest); synchronized ResizableDoubleArray copy(); @Override boolean equals(Object object); @Override synchronized int hashCode(); @Deprecated
    static final int ADDITIVE_MODE; @Deprecated
    static final int MULTIPLICATIVE_MODE; }
@Test public void testAddElements() { ResizableDoubleArray testDa = new ResizableDoubleArray(); testDa.addElements(new double[] {4, 5, 6}); Assert.assertEquals(3, testDa.getNumElements(), 0); Assert.assertEquals(4, testDa.getElement(0), 0); Assert.assertEquals(5, testDa.getElement(1), 0); Assert.assertEquals(6, testDa.getElement(2), 0); testDa.addElements(new double[] {4, 5, 6}); Assert.assertEquals(6, testDa.getNumElements()); testDa = new ResizableDoubleArray(2, 2.0, 2.5, ResizableDoubleArray.ExpansionMode.ADDITIVE); Assert.assertEquals(2, testDa.getCapacity()); testDa.addElements(new double[] { 1d }); testDa.addElements(new double[] { 2d }); testDa.addElements(new double[] { 3d }); Assert.assertEquals(1d, testDa.getElement(0), 0); Assert.assertEquals(2d, testDa.getElement(1), 0); Assert.assertEquals(3d, testDa.getElement(2), 0); Assert.assertEquals(4, testDa.getCapacity()); Assert.assertEquals(3, testDa.getNumElements()); }