Author: erans
Date: Tue Nov 13 14:13:46 2012
New Revision: 1408735
URL: http://svn.apache.org/viewvc?rev=1408735&view=rev
Log:
MATH-894
Removed the reallocation in method "clear()".
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/ResizableDoubleArray.java
commons/proper/math/trunk/src/test/java/org/apache/commons/math3/util/ResizableDoubleArrayTest.java
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/ResizableDoubleArray.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/ResizableDoubleArray.java?rev=1408735&r1=1408734&r2=1408735&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/ResizableDoubleArray.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/ResizableDoubleArray.java
Tue Nov 13 14:13:46 2012
@@ -415,7 +415,6 @@ public class ResizableDoubleArray implem
public synchronized void clear() {
numElements = 0;
startIndex = 0;
- internalArray = new double[initialCapacity];
}
/**
Modified:
commons/proper/math/trunk/src/test/java/org/apache/commons/math3/util/ResizableDoubleArrayTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/util/ResizableDoubleArrayTest.java?rev=1408735&r1=1408734&r2=1408735&view=diff
==============================================================================
---
commons/proper/math/trunk/src/test/java/org/apache/commons/math3/util/ResizableDoubleArrayTest.java
(original)
+++
commons/proper/math/trunk/src/test/java/org/apache/commons/math3/util/ResizableDoubleArrayTest.java
Tue Nov 13 14:13:46 2012
@@ -130,7 +130,7 @@ public class ResizableDoubleArrayTest ex
@Test
- public void testSetElementArbitraryExpansion() {
+ public void testSetElementArbitraryExpansion1() {
// MULTIPLICATIVE_MODE
da.addElement(2.0);
@@ -151,9 +151,11 @@ public class ResizableDoubleArrayTest ex
Double.MIN_VALUE );
Assert.assertEquals( "The 0th index should be 2.0, it isn't", 2.0,
da.getElement(0),
Double.MIN_VALUE);
+ }
+ @Test
+ public void testSetElementArbitraryExpansion2() {
// Make sure numElements and expansion work correctly for expansion
boundary cases
- da.clear();
da.addElement(2.0);
da.addElement(4.0);
da.addElement(6.0);