You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ps...@apache.org on 2009/09/05 19:37:05 UTC

svn commit: r811685 [24/24] - in /commons/proper/math/trunk: ./ src/main/java/org/apache/commons/math/ src/main/java/org/apache/commons/math/analysis/ src/main/java/org/apache/commons/math/analysis/integration/ src/main/java/org/apache/commons/math/ana...

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/MathUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/MathUtilsTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/MathUtilsTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/MathUtilsTest.java Sat Sep  5 17:36:48 2009
@@ -311,7 +311,7 @@
       assertTrue(MathUtils.compareTo(152.308, 152.32, .011) < 0);
       assertTrue(MathUtils.compareTo(152.33, 152.318, .011) > 0);
     }
-    
+
     public void testCosh() {
         double x = 3.0;
         double expected = 10.06766;
@@ -361,7 +361,7 @@
         assertFalse(MathUtils.equals(153, 153.00000000000006, 1));
         assertTrue(MathUtils.equals(153, 152.99999999999997, 1));
         assertFalse(MathUtils.equals(153, 152.99999999999994, 1));
-        
+
         assertTrue(MathUtils.equals(-128, -127.99999999999999, 1));
         assertFalse(MathUtils.equals(-128, -127.99999999999997, 1));
         assertTrue(MathUtils.equals(-128, -128.00000000000003, 1));
@@ -378,7 +378,7 @@
 
         assertFalse(MathUtils.equals(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, 100000));
     }
-    
+
     public void testArrayEquals() {
         assertFalse(MathUtils.equals(new double[] { 1d }, null));
         assertFalse(MathUtils.equals(null, new double[] { 1d }));
@@ -406,7 +406,7 @@
             assertEquals(i + "! ", factorial(i), MathUtils.factorialDouble(i), Double.MIN_VALUE);
             assertEquals(i + "! ", Math.log(factorial(i)), MathUtils.factorialLog(i), 10E-12);
         }
-        
+
         assertEquals("0", 1, MathUtils.factorial(0));
         assertEquals("0", 1.0d, MathUtils.factorialDouble(0), 1E-14);
         assertEquals("0", 0.0d, MathUtils.factorialLog(0), 1E-14);
@@ -529,7 +529,7 @@
         assertFalse(MathUtils.hash(new double[] { 1d }) ==
                     MathUtils.hash(new double[] { 1d, 1d }));
     }
-    
+
     /**
      * Make sure that permuted arrays do not hash to the same value.
      */
@@ -537,12 +537,12 @@
         double[] original = new double[10];
         double[] permuted = new double[10];
         RandomDataImpl random = new RandomDataImpl();
-        
+
         // Generate 10 distinct random values
         for (int i = 0; i < 10; i++) {
             original[i] = random.nextUniform(i + 0.5, i + 0.75);
         }
-        
+
         // Generate a random permutation, making sure it is not the identity
         boolean isIdentity = true;
         do {
@@ -554,7 +554,7 @@
                 permuted[i] = original[permutation[i]];
             }
         } while (isIdentity);
-        
+
         // Verify that permuted array has different hash
         assertFalse(MathUtils.hash(original) == MathUtils.hash(permuted));
     }
@@ -627,7 +627,7 @@
         } catch (ArithmeticException ex) {
             // expected
         }
-        
+
         try {
             // lcm == abs(MIN_VALUE) cannot be represented as a nonnegative int
             MathUtils.lcm(Integer.MIN_VALUE, 1<<20);
@@ -796,53 +796,53 @@
             }
         }
     }
-    
+
     public void testNormalizeArray() {
         double[] testValues1 = new double[] {1, 1, 2};
         TestUtils.assertEquals(
                 new double[] {.25, .25, .5},
                 MathUtils.normalizeArray(testValues1, 1),
                 Double.MIN_VALUE);
-     
+
         double[] testValues2 = new double[] {-1, -1, 1};
         TestUtils.assertEquals(
                 new double[] {1, 1, -1},
                 MathUtils.normalizeArray(testValues2, 1),
                 Double.MIN_VALUE);
-        
+
         // Ignore NaNs
         double[] testValues3 = new double[] {-1, -1, Double.NaN, 1, Double.NaN};
         TestUtils.assertEquals(
                 new double[] {1, 1,Double.NaN, -1, Double.NaN},
                 MathUtils.normalizeArray(testValues3, 1),
                 Double.MIN_VALUE);
-        
+
         // Zero sum -> ArithmeticException
         double[] zeroSum = new double[] {-1, 1};
         try {
             MathUtils.normalizeArray(zeroSum, 1);
             fail("expecting ArithmeticException");
         } catch (ArithmeticException ex) {}
-        
+
         // Infinite elements -> ArithmeticException
         double[] hasInf = new double[] {1, 2, 1, Double.NEGATIVE_INFINITY};
         try {
             MathUtils.normalizeArray(hasInf, 1);
             fail("expecting ArithmeticException");
         } catch (ArithmeticException ex) {}
-        
+
         // Infinite target -> IllegalArgumentException
         try {
             MathUtils.normalizeArray(testValues1, Double.POSITIVE_INFINITY);
             fail("expecting IllegalArgumentException");
         } catch (IllegalArgumentException ex) {}
-        
+
         // NaN target -> IllegalArgumentException
         try {
             MathUtils.normalizeArray(testValues1, Double.NaN);
             fail("expecting IllegalArgumentException");
-        } catch (IllegalArgumentException ex) {}  
-        
+        } catch (IllegalArgumentException ex) {}
+
     }
 
     public void testRoundDouble() {
@@ -1225,7 +1225,7 @@
         assertEquals(bigOne, MathUtils.pow(twentyOne, 103));
         assertEquals(bigOne, MathUtils.pow(twentyOne, 103l));
         assertEquals(bigOne, MathUtils.pow(twentyOne, BigInteger.valueOf(103l)));
-        
+
     }
 
     public void testL1DistanceDouble() {

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/OpenIntToDoubleHashMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/OpenIntToDoubleHashMapTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/OpenIntToDoubleHashMapTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/OpenIntToDoubleHashMapTest.java Sat Sep  5 17:36:48 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -68,12 +68,12 @@
         }
         return map;
     }
-    
+
     public void testPutAndGetWith0ExpectedSize() {
         OpenIntToDoubleHashMap map = new OpenIntToDoubleHashMap(0);
         assertPutAndGet(map);
     }
-    
+
     public void testPutAndGetWithExpectedSize() {
         OpenIntToDoubleHashMap map = new OpenIntToDoubleHashMap(500);
         assertPutAndGet(map);
@@ -122,7 +122,7 @@
     public void testGetAbsent() {
         Map<Integer, Double> generated = generateAbsent();
         OpenIntToDoubleHashMap map = createFromJavaMap();
-        
+
         for (Map.Entry<Integer, Double> mapEntry : generated.entrySet())
             assertTrue(Double.isNaN(map.get(mapEntry.getKey())));
     }
@@ -177,7 +177,7 @@
 
         OpenIntToDoubleHashMap map = createFromJavaMap();
         int mapSize = map.size();
-        
+
         for (Map.Entry<Integer, Double> mapEntry : generated.entrySet()) {
             map.remove(mapEntry.getKey());
             assertEquals(mapSize, map.size());
@@ -272,14 +272,14 @@
         map.put(key3, value1);
         assertEquals(value1, map.get(key3));
         assertEquals(3, map.size());
-        
+
         map.remove(key2);
         double value2 = 2.0;
         map.put(key3, value2);
         assertEquals(value2, map.get(key3));
         assertEquals(2, map.size());
     }
-    
+
     /**
      * Similar to testPutKeysWithCollisions() but exercises the codepaths in a slightly
      * different manner.
@@ -293,7 +293,7 @@
         map.put(key2, value1);
         assertEquals(2, map.size());
         assertEquals(value1, map.get(key2));
-        
+
         map.remove(key1);
         double value2 = 2.0;
         map.put(key2, value2);

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/OpenIntToFieldTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/OpenIntToFieldTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/OpenIntToFieldTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/OpenIntToFieldTest.java Sat Sep  5 17:36:48 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -62,7 +62,7 @@
         Random r = new Random();
         double dd=0;
         for (int i = 0; i < 2000; ++i)
-            dd = r.nextDouble(); 
+            dd = r.nextDouble();
             try {
                 map.put(r.nextInt(), new Fraction(dd));
             } catch (FractionConversionException e) {
@@ -78,12 +78,12 @@
         }
         return map;
     }
-    
+
     public void testPutAndGetWith0ExpectedSize() {
         OpenIntToFieldHashMap<Fraction> map = new OpenIntToFieldHashMap<Fraction>(field,0);
         assertPutAndGet(map);
     }
-    
+
     public void testPutAndGetWithExpectedSize() {
         OpenIntToFieldHashMap<Fraction> map = new OpenIntToFieldHashMap<Fraction>(field,500);
         assertPutAndGet(map);
@@ -132,7 +132,7 @@
     public void testGetAbsent() {
         Map<Integer, Fraction> generated = generateAbsent();
         OpenIntToFieldHashMap<Fraction> map = createFromJavaMap(field);
-        
+
         for (Map.Entry<Integer, Fraction> mapEntry : generated.entrySet())
             assertTrue(field.getZero().equals(map.get(mapEntry.getKey())));
     }
@@ -187,7 +187,7 @@
 
         OpenIntToFieldHashMap<Fraction> map = createFromJavaMap(field);
         int mapSize = map.size();
-        
+
         for (Map.Entry<Integer, Fraction> mapEntry : generated.entrySet()) {
             map.remove(mapEntry.getKey());
             assertEquals(mapSize, map.size());
@@ -282,14 +282,14 @@
         map.put(key3, value1);
         assertEquals(value1, map.get(key3));
         assertEquals(3, map.size());
-        
+
         map.remove(key2);
         Fraction value2 = new Fraction(2);
         map.put(key3, value2);
         assertEquals(value2, map.get(key3));
         assertEquals(2, map.size());
     }
-    
+
     /**
      * Similar to testPutKeysWithCollisions() but exercises the codepaths in a slightly
      * different manner.
@@ -303,7 +303,7 @@
         map.put(key2, value1);
         assertEquals(2, map.size());
         assertEquals(value1, map.get(key2));
-        
+
         map.remove(key1);
         Fraction value2 = new Fraction(2);
         map.put(key2, value2);

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/ResizableDoubleArrayTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/ResizableDoubleArrayTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/ResizableDoubleArrayTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/ResizableDoubleArrayTest.java Sat Sep  5 17:36:48 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,11 +21,11 @@
 
 /**
  * This class contains test cases for the ResizableDoubleArray.
- * 
+ *
  * @version $Revision$ $Date$
  */
 public class ResizableDoubleArrayTest extends DoubleArrayAbstractTest {
-    
+
     public ResizableDoubleArrayTest(String name) {
         super( name );
     }
@@ -35,18 +35,18 @@
         da = null;
         ra = null;
     }
-       
+
     @Override
     protected void setUp() throws Exception {
         da = new ResizableDoubleArray();
         ra = new ResizableDoubleArray();
     }
-    
+
     public void testConstructors() {
         float defaultExpansionFactor = 2.0f;
         float defaultContractionCriteria = 2.5f;
         int defaultMode = ResizableDoubleArray.MULTIPLICATIVE_MODE;
-        
+
         ResizableDoubleArray testDa = new ResizableDoubleArray(2);
         assertEquals(0, testDa.getNumElements());
         assertEquals(2, testDa.getInternalLength());
@@ -59,88 +59,88 @@
         } catch (IllegalArgumentException ex) {
             // expected
         }
-        
+
         testDa = new ResizableDoubleArray(2, 2.0f);
         assertEquals(0, testDa.getNumElements());
         assertEquals(2, testDa.getInternalLength());
         assertEquals(defaultExpansionFactor, testDa.getExpansionFactor(), 0);
         assertEquals(defaultContractionCriteria, testDa.getContractionCriteria(), 0);
         assertEquals(defaultMode, testDa.getExpansionMode());
-        
+
         try {
             da = new ResizableDoubleArray(2, 0.5f);
             fail("Expecting IllegalArgumentException");
         } catch (IllegalArgumentException ex) {
             // expected
         }
-        
+
         testDa = new ResizableDoubleArray(2, 3.0f);
         assertEquals(3.0f, testDa.getExpansionFactor(), 0);
         assertEquals(3.5f, testDa.getContractionCriteria(), 0);
-        
+
         testDa = new ResizableDoubleArray(2, 2.0f, 3.0f);
         assertEquals(0, testDa.getNumElements());
         assertEquals(2, testDa.getInternalLength());
         assertEquals(defaultExpansionFactor, testDa.getExpansionFactor(), 0);
         assertEquals(3.0f, testDa.getContractionCriteria(), 0);
         assertEquals(defaultMode, testDa.getExpansionMode());
-        
+
         try {
             da = new ResizableDoubleArray(2, 2.0f, 1.5f);
             fail("Expecting IllegalArgumentException");
         } catch (IllegalArgumentException ex) {
             // expected
         }
-        
-        testDa = new ResizableDoubleArray(2, 2.0f, 3.0f, 
+
+        testDa = new ResizableDoubleArray(2, 2.0f, 3.0f,
                 ResizableDoubleArray.ADDITIVE_MODE);
         assertEquals(0, testDa.getNumElements());
         assertEquals(2, testDa.getInternalLength());
         assertEquals(defaultExpansionFactor, testDa.getExpansionFactor(), 0);
         assertEquals(3.0f, testDa.getContractionCriteria(), 0);
-        assertEquals(ResizableDoubleArray.ADDITIVE_MODE, 
+        assertEquals(ResizableDoubleArray.ADDITIVE_MODE,
                 testDa.getExpansionMode());
-        
+
         try {
             da = new ResizableDoubleArray(2, 2.0f, 2.5f, -1);
             fail("Expecting IllegalArgumentException");
         } catch (IllegalArgumentException ex) {
             // expected
         }
-        
+
         // Copy constructor
-        testDa = new ResizableDoubleArray(2, 2.0f, 3.0f, 
+        testDa = new ResizableDoubleArray(2, 2.0f, 3.0f,
                 ResizableDoubleArray.ADDITIVE_MODE);
         testDa.addElement(2.0);
         testDa.addElement(3.2);
         ResizableDoubleArray copyDa = new ResizableDoubleArray(testDa);
         assertEquals(copyDa, testDa);
-        assertEquals(testDa, copyDa);   
+        assertEquals(testDa, copyDa);
     }
-    
-    
+
+
     public void testSetElementArbitraryExpansion() {
-        
-        // MULTIPLICATIVE_MODE 
+
+        // MULTIPLICATIVE_MODE
         da.addElement(2.0);
         da.addElement(4.0);
         da.addElement(6.0);
         da.setElement(1, 3.0);
-        
+
         // Expand the array arbitrarily to 1000 items
         da.setElement(1000, 3.4);
-        
-        assertEquals( "The number of elements should now be 1001, it isn't", 
+
+        assertEquals( "The number of elements should now be 1001, it isn't",
                 da.getNumElements(), 1001);
-        
+
         assertEquals( "Uninitialized Elements are default value of 0.0, index 766 wasn't", 0.0,
                 da.getElement( 760 ), Double.MIN_VALUE );
-        
-        assertEquals( "The 1000th index should be 3.4, it isn't", 3.4, da.getElement(1000), 
+
+        assertEquals( "The 1000th index should be 3.4, it isn't", 3.4, da.getElement(1000),
                 Double.MIN_VALUE );
-        assertEquals( "The 0th index should be 2.0, it isn't", 2.0, da.getElement(0), 
-                Double.MIN_VALUE); 
-        
+        assertEquals( "The 0th index should be 2.0, it isn't", 2.0, da.getElement(0),
+                Double.MIN_VALUE);
+
         // Make sure numElements and expansion work correctly for expansion boundary cases
         da.clear();
         da.addElement(2.0);
@@ -157,24 +157,24 @@
         da.setElement(9, 10.0);
         assertEquals(11, ((ResizableDoubleArray) da).getInternalLength());
         assertEquals(11, da.getNumElements());
-        
+
         try {
             da.setElement(-2, 3);
             fail("Expecting ArrayIndexOutOfBoundsException for negative index");
         } catch (ArrayIndexOutOfBoundsException ex) {
             // expected
         }
-        
+
         // ADDITIVE_MODE
-        
-        ResizableDoubleArray testDa = new ResizableDoubleArray(2, 2.0f, 3.0f, 
+
+        ResizableDoubleArray testDa = new ResizableDoubleArray(2, 2.0f, 3.0f,
                 ResizableDoubleArray.ADDITIVE_MODE);
         assertEquals(2, testDa.getInternalLength());
         testDa.addElement(1d);
         testDa.addElement(1d);
         assertEquals(2, testDa.getInternalLength());
         testDa.addElement(1d);
-        assertEquals(4, testDa.getInternalLength());         
+        assertEquals(4, testDa.getInternalLength());
     }
 
     @Override
@@ -188,7 +188,7 @@
     @Override
     public void testAddElementRolling() {
         super.testAddElementRolling();
-        
+
         // MULTIPLICATIVE_MODE
         da.clear();
         da.addElement(1);
@@ -203,10 +203,10 @@
         da.addElementRolling(6);
         assertEquals(4, da.getElement(0), 0);
         assertEquals(5, da.getElement(1), 0);
-        assertEquals(6, da.getElement(2), 0);   
-        
+        assertEquals(6, da.getElement(2), 0);
+
         // ADDITIVE_MODE  (x's are occupied storage locations, 0's are open)
-        ResizableDoubleArray testDa = new ResizableDoubleArray(2, 2.0f, 2.5f, 
+        ResizableDoubleArray testDa = new ResizableDoubleArray(2, 2.0f, 2.5f,
                 ResizableDoubleArray.ADDITIVE_MODE);
         assertEquals(2, testDa.getInternalLength());
         testDa.addElement(1d); // x,0
@@ -214,27 +214,27 @@
         testDa.addElement(3d); // x,x,x,0 -- expanded
         assertEquals(1d, testDa.getElement(0), 0);
         assertEquals(2d, testDa.getElement(1), 0);
-        assertEquals(3d, testDa.getElement(2), 0);   
-        assertEquals(4, testDa.getInternalLength());  // x,x,x,0 
+        assertEquals(3d, testDa.getElement(2), 0);
+        assertEquals(4, testDa.getInternalLength());  // x,x,x,0
         assertEquals(3, testDa.getNumElements());
         testDa.addElementRolling(4d);
         assertEquals(2d, testDa.getElement(0), 0);
         assertEquals(3d, testDa.getElement(1), 0);
-        assertEquals(4d, testDa.getElement(2), 0);   
+        assertEquals(4d, testDa.getElement(2), 0);
         assertEquals(4, testDa.getInternalLength());  // 0,x,x,x
         assertEquals(3, testDa.getNumElements());
         testDa.addElementRolling(5d);   // 0,0,x,x,x,0 -- time to contract
         assertEquals(3d, testDa.getElement(0), 0);
         assertEquals(4d, testDa.getElement(1), 0);
-        assertEquals(5d, testDa.getElement(2), 0);   
-        assertEquals(4, testDa.getInternalLength());  // contracted -- x,x,x,0     
+        assertEquals(5d, testDa.getElement(2), 0);
+        assertEquals(4, testDa.getInternalLength());  // contracted -- x,x,x,0
         assertEquals(3, testDa.getNumElements());
         try {
             testDa.getElement(4);
             fail("Expecting ArrayIndexOutOfBoundsException");
         } catch (ArrayIndexOutOfBoundsException ex) {
             // expected
-        }  
+        }
         try {
             testDa.getElement(-1);
             fail("Expecting ArrayIndexOutOfBoundsException");
@@ -242,7 +242,7 @@
             // expected
         }
     }
-    
+
     public void testSetNumberOfElements() {
         da.addElement( 1.0 );
         da.addElement( 1.0 );
@@ -251,64 +251,64 @@
         da.addElement( 1.0 );
         da.addElement( 1.0 );
         assertEquals( "Number of elements should equal 6", da.getNumElements(), 6);
-        
+
         ((ResizableDoubleArray) da).setNumElements( 3 );
         assertEquals( "Number of elements should equal 3", da.getNumElements(), 3);
-        
+
         try {
             ((ResizableDoubleArray) da).setNumElements( -3 );
             fail( "Setting number of elements to negative should've thrown an exception");
         } catch( IllegalArgumentException iae ) {
         }
-        
+
         ((ResizableDoubleArray) da).setNumElements(1024);
         assertEquals( "Number of elements should now be 1024", da.getNumElements(), 1024);
         assertEquals( "Element 453 should be a default double", da.getElement( 453 ), 0.0, Double.MIN_VALUE);
-        
+
     }
-    
+
     public void testWithInitialCapacity() {
-        
+
         ResizableDoubleArray eDA2 = new ResizableDoubleArray(2);
         assertEquals("Initial number of elements should be 0", 0, eDA2.getNumElements());
-        
+
         RandomData randomData = new RandomDataImpl();
         int iterations = randomData.nextInt(100, 1000);
-        
+
         for( int i = 0; i < iterations; i++) {
             eDA2.addElement( i );
         }
-        
+
         assertEquals("Number of elements should be equal to " + iterations, iterations, eDA2.getNumElements());
-        
+
         eDA2.addElement( 2.0 );
-        
+
         assertEquals("Number of elements should be equals to " + (iterations +1),
                 iterations + 1 , eDA2.getNumElements() );
     }
-    
+
     public void testWithInitialCapacityAndExpansionFactor() {
-        
+
         ResizableDoubleArray eDA3 = new ResizableDoubleArray(3, 3.0f, 3.5f);
         assertEquals("Initial number of elements should be 0", 0, eDA3.getNumElements() );
-        
+
         RandomData randomData = new RandomDataImpl();
         int iterations = randomData.nextInt(100, 3000);
-        
+
         for( int i = 0; i < iterations; i++) {
             eDA3.addElement( i );
         }
-        
+
         assertEquals("Number of elements should be equal to " + iterations, iterations,eDA3.getNumElements());
-        
+
         eDA3.addElement( 2.0 );
-        
+
         assertEquals("Number of elements should be equals to " + (iterations +1),
                 iterations +1, eDA3.getNumElements() );
-        
+
         assertEquals("Expansion factor should equal 3.0", 3.0f, eDA3.getExpansionFactor(), Double.MIN_VALUE);
     }
-    
+
     public void testDiscard() {
         da.addElement(2.0);
         da.addElement(2.0);
@@ -322,7 +322,7 @@
         da.addElement(2.0);
         da.addElement(2.0);
         assertEquals( "Number of elements should be 11", 11, da.getNumElements());
-        
+
         ((ResizableDoubleArray)da).discardFrontElements(5);
         assertEquals( "Number of elements should be 6", 6, da.getNumElements());
 
@@ -334,7 +334,7 @@
 
         ((ResizableDoubleArray)da).discardMostRecentElements(2);
         assertEquals( "Number of elements should be 8", 8, da.getNumElements());
-        
+
         try {
             ((ResizableDoubleArray)da).discardFrontElements(-1);
             fail( "Trying to discard a negative number of element is not allowed");
@@ -362,7 +362,7 @@
     }
 
     public void testSubstitute() {
-    
+
         da.addElement(2.0);
         da.addElement(2.0);
         da.addElement(2.0);
@@ -375,7 +375,7 @@
         da.addElement(2.0);
         da.addElement(2.0);
         assertEquals( "Number of elements should be 11", 11, da.getNumElements());
-        
+
         ((ResizableDoubleArray)da).substituteMostRecentElement(24);
 
         assertEquals( "Number of elements should be 11", 11, da.getNumElements());
@@ -391,11 +391,11 @@
         assertEquals( "Number of elements should be 1", 1, da.getNumElements());
 
     }
-    
+
     public void testMutators() {
         ((ResizableDoubleArray)da).setContractionCriteria(10f);
         assertEquals(10f, ((ResizableDoubleArray)da).getContractionCriteria(), 0);
-        ((ResizableDoubleArray)da).setExpansionFactor(8f);  
+        ((ResizableDoubleArray)da).setExpansionFactor(8f);
         assertEquals(8f, ((ResizableDoubleArray)da).getExpansionFactor(), 0);
         try {
             ((ResizableDoubleArray)da).setExpansionFactor(11f);  // greater than contractionCriteria
@@ -405,7 +405,7 @@
         }
         ((ResizableDoubleArray)da).setExpansionMode(
                 ResizableDoubleArray.ADDITIVE_MODE);
-        assertEquals(ResizableDoubleArray.ADDITIVE_MODE, 
+        assertEquals(ResizableDoubleArray.ADDITIVE_MODE,
                 ((ResizableDoubleArray)da).getExpansionMode());
         try {
             ((ResizableDoubleArray)da).setExpansionMode(-1);
@@ -414,25 +414,25 @@
             // expected
         }
     }
-    
+
     public void testEqualsAndHashCode() throws Exception {
-        
+
         // Wrong type
         ResizableDoubleArray first = new ResizableDoubleArray();
         Double other = new Double(2);
         assertFalse(first.equals(other));
-        
+
         // Null
         other = null;
         assertFalse(first.equals(other));
-        
+
         // Reflexive
         assertTrue(first.equals(first));
-        
+
         // Argumentless constructor
         ResizableDoubleArray second = new ResizableDoubleArray();
         verifyEquality(first, second);
-        
+
         // Equals iff same data, same properties
         ResizableDoubleArray third = new ResizableDoubleArray(3, 2.0f, 2.0f);
         verifyInequality(third, first);
@@ -447,7 +447,7 @@
         fourth.addElement(4.2);
         fourth.addElement(4.3);
         verifyEquality(third, fourth);
-        
+
         // expand
         fourth.addElement(4.4);
         verifyInequality(third, fourth);
@@ -460,47 +460,47 @@
         fourth.addElementRolling(4.5);
         third.addElementRolling(4.5);
         verifyEquality(third, fourth);
-        
+
         // discard
         third.discardFrontElements(1);
         verifyInequality(third, fourth);
         fourth.discardFrontElements(1);
         verifyEquality(third, fourth);
-        
+
         // discard recent
         third.discardMostRecentElements(2);
         fourth.discardMostRecentElements(2);
         verifyEquality(third, fourth);
-        
+
         // wrong order
         third.addElement(18);
         fourth.addElement(17);
         third.addElement(17);
         fourth.addElement(18);
         verifyInequality(third, fourth);
-        
+
         // copy
         ResizableDoubleArray.copy(fourth, fifth);
         verifyEquality(fourth, fifth);
-        
+
         // Copy constructor
         verifyEquality(fourth, new ResizableDoubleArray(fourth));
-        
+
         // Instance copy
-        verifyEquality(fourth, fourth.copy());   
-             
+        verifyEquality(fourth, fourth.copy());
+
     }
-    
+
     private void verifyEquality(ResizableDoubleArray a, ResizableDoubleArray b) {
         assertTrue(b.equals(a));
         assertTrue(a.equals(b));
-        assertEquals(a.hashCode(), b.hashCode());    
+        assertEquals(a.hashCode(), b.hashCode());
     }
-    
+
     private void verifyInequality(ResizableDoubleArray a, ResizableDoubleArray b) {
         assertFalse(b.equals(a));
         assertFalse(a.equals(b));
         assertFalse(a.hashCode() == b.hashCode());
     }
-    
+
 }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/TestBean.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/TestBean.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/TestBean.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/TestBean.java Sat Sep  5 17:36:48 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,42 +28,42 @@
     private String y = "1.0";
 
     /**
-     * 
+     *
      */
     public Double getX() {
         return x;
     }
 
     /**
-     * 
+     *
      */
     public String getY() {
         return y;
     }
 
     /**
-     * 
+     *
      */
     public void setX(Double double1) {
         x = double1;
     }
 
     /**
-     * 
+     *
      */
     public void setY(String string) {
         y = string;
     }
-    
+
     /**
-     * 
+     *
      */
     public Double getZ() {
         throw new MathRuntimeException("?");
     }
 
     /**
-     * 
+     *
      */
     public void setZ(Double double1) {
     }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/TransformerMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/TransformerMapTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/TransformerMapTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/TransformerMapTest.java Sat Sep  5 17:36:48 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,18 +26,18 @@
  */
 public class TransformerMapTest extends TestCase {
     /**
-     * 
+     *
      */
     public void testPutTransformer(){
         NumberTransformer expected = new DefaultTransformer();
-        
+
         TransformerMap map = new TransformerMap();
         map.putTransformer(TransformerMapTest.class, expected);
         assertEquals(expected, map.getTransformer(TransformerMapTest.class));
     }
-    
+
     /**
-     * 
+     *
      */
     public void testContainsClass(){
         NumberTransformer expected = new DefaultTransformer();
@@ -45,9 +45,9 @@
         map.putTransformer(TransformerMapTest.class, expected);
         assertTrue(map.containsClass(TransformerMapTest.class));
     }
-    
+
     /**
-     * 
+     *
      */
     public void testContainsTransformer(){
         NumberTransformer expected = new DefaultTransformer();
@@ -57,11 +57,11 @@
     }
 
     /**
-     * 
+     *
      */
     public void testRemoveTransformer(){
         NumberTransformer expected = new DefaultTransformer();
-        
+
         TransformerMap map = new TransformerMap();
         map.putTransformer(TransformerMapTest.class, expected);
         assertTrue(map.containsClass(TransformerMapTest.class));
@@ -72,20 +72,20 @@
     }
 
     /**
-     * 
+     *
      */
     public void testClear(){
         NumberTransformer expected = new DefaultTransformer();
-        
+
         TransformerMap map = new TransformerMap();
         map.putTransformer(TransformerMapTest.class, expected);
         assertTrue(map.containsClass(TransformerMapTest.class));
         map.clear();
         assertFalse(map.containsClass(TransformerMapTest.class));
     }
-    
+
     /**
-     * 
+     *
      */
     public void testClasses(){
         NumberTransformer expected = new DefaultTransformer();
@@ -93,9 +93,9 @@
         map.putTransformer(TransformerMapTest.class, expected);
         assertTrue(map.classes().contains(TransformerMapTest.class));
     }
-    
+
     /**
-     * 
+     *
      */
     public void testTransformers(){
         NumberTransformer expected = new DefaultTransformer();