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 [17/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/fraction/BigFractionFormatTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/BigFractionFormatTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/BigFractionFormatTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/BigFractionFormatTest.java Sat Sep  5 17:36:48 2009
@@ -26,7 +26,7 @@
 import junit.framework.TestCase;
 
 public class BigFractionFormatTest extends TestCase {
- 
+
     BigFractionFormat properFormat = null;
     BigFractionFormat improperFormat = null;
 
@@ -39,12 +39,12 @@
         properFormat = BigFractionFormat.getProperInstance(getLocale());
         improperFormat = BigFractionFormat.getImproperInstance(getLocale());
     }
-   
+
     public void testFormat() {
         BigFraction c = new BigFraction(1, 2);
         String expected = "1 / 2";
-        
-        String actual = properFormat.format(c); 
+
+        String actual = properFormat.format(c);
         assertEquals(expected, actual);
 
         actual = improperFormat.format(c);
@@ -55,10 +55,10 @@
         BigFraction c = new BigFraction(-1, 2);
         String expected = "-1 / 2";
 
-        String actual = properFormat.format(c); 
+        String actual = properFormat.format(c);
         assertEquals(expected, actual);
 
-        actual = improperFormat.format(c); 
+        actual = improperFormat.format(c);
         assertEquals(expected, actual);
     }
 
@@ -66,33 +66,33 @@
         BigFraction c = new BigFraction(0, 1);
         String expected = "0 / 1";
 
-        String actual = properFormat.format(c); 
+        String actual = properFormat.format(c);
         assertEquals(expected, actual);
 
-        actual = improperFormat.format(c); 
+        actual = improperFormat.format(c);
         assertEquals(expected, actual);
     }
-    
+
     public void testFormatImproper() {
         BigFraction c = new BigFraction(5, 3);
 
-        String actual = properFormat.format(c); 
+        String actual = properFormat.format(c);
         assertEquals("1 2 / 3", actual);
 
-        actual = improperFormat.format(c); 
+        actual = improperFormat.format(c);
         assertEquals("5 / 3", actual);
     }
-    
+
     public void testFormatImproperNegative() {
         BigFraction c = new BigFraction(-5, 3);
 
-        String actual = properFormat.format(c); 
+        String actual = properFormat.format(c);
         assertEquals("-1 2 / 3", actual);
 
-        actual = improperFormat.format(c); 
+        actual = improperFormat.format(c);
         assertEquals("-5 / 3", actual);
     }
-    
+
     public void testParse() {
         String source = "1 / 2";
 
@@ -101,7 +101,7 @@
             assertNotNull(c);
             assertEquals(BigInteger.ONE, c.getNumerator());
             assertEquals(BigInteger.valueOf(2l), c.getDenominator());
-            
+
             c = improperFormat.parse(source);
             assertNotNull(c);
             assertEquals(BigInteger.ONE, c.getNumerator());
@@ -110,7 +110,7 @@
             fail(ex.getMessage());
         }
     }
-    
+
     public void testParseInteger() {
         String source = "10";
         try {
@@ -130,7 +130,7 @@
             fail(ex.getMessage());
         }
     }
-    
+
     public void testParseInvalid() {
         String source = "a";
         String msg = "should not be able to parse '10 / a'.";
@@ -147,7 +147,7 @@
             // success
         }
     }
-    
+
     public void testParseInvalidDenominator() {
         String source = "10 / a";
         String msg = "should not be able to parse '10 / a'.";
@@ -164,7 +164,7 @@
             // success
         }
     }
-    
+
     public void testParseNegative() {
 
         try {
@@ -173,7 +173,7 @@
             assertNotNull(c);
             assertEquals(-1, c.getNumeratorAsInt());
             assertEquals(2, c.getDenominatorAsInt());
-            
+
             c = improperFormat.parse(source);
             assertNotNull(c);
             assertEquals(-1, c.getNumeratorAsInt());
@@ -184,7 +184,7 @@
             assertNotNull(c);
             assertEquals(-1, c.getNumeratorAsInt());
             assertEquals(2, c.getDenominatorAsInt());
-            
+
             c = improperFormat.parse(source);
             assertNotNull(c);
             assertEquals(-1, c.getNumeratorAsInt());
@@ -193,7 +193,7 @@
             fail(ex.getMessage());
         }
     }
-    
+
     public void testParseProper() {
         String source = "1 2 / 3";
 
@@ -205,7 +205,7 @@
         } catch (ParseException ex) {
             fail(ex.getMessage());
         }
-        
+
         try {
             improperFormat.parse(source);
             fail("invalid improper fraction.");
@@ -213,7 +213,7 @@
             // success
         }
     }
-    
+
     public void testParseProperNegative() {
         String source = "-1 2 / 3";
         try {
@@ -224,7 +224,7 @@
         } catch (ParseException ex) {
             fail(ex.getMessage());
         }
-        
+
         try {
             improperFormat.parse(source);
             fail("invalid improper fraction.");
@@ -232,7 +232,7 @@
             // success
         }
     }
-    
+
     public void testParseProperInvalidMinus() {
         String source = "2 -2 / 3";
         try {
@@ -267,7 +267,7 @@
             new BigDecimal("3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117068");
         assertEquals(pi, f1.bigDecimalValue(99, BigDecimal.ROUND_HALF_EVEN));
     }
-    
+
     public void testNumeratorFormat() {
         NumberFormat old = properFormat.getNumeratorFormat();
         NumberFormat nf = NumberFormat.getInstance();
@@ -283,7 +283,7 @@
         assertEquals(nf, improperFormat.getNumeratorFormat());
         improperFormat.setNumeratorFormat(old);
     }
-    
+
     public void testDenominatorFormat() {
         NumberFormat old = properFormat.getDenominatorFormat();
         NumberFormat nf = NumberFormat.getInstance();
@@ -299,10 +299,10 @@
         assertEquals(nf, improperFormat.getDenominatorFormat());
         improperFormat.setDenominatorFormat(old);
     }
-    
+
     public void testWholeFormat() {
         ProperBigFractionFormat format = (ProperBigFractionFormat)properFormat;
-        
+
         NumberFormat old = format.getWholeFormat();
         NumberFormat nf = NumberFormat.getInstance();
         nf.setParseIntegerOnly(true);
@@ -310,11 +310,11 @@
         assertEquals(nf, format.getWholeFormat());
         format.setWholeFormat(old);
     }
-    
+
     public void testLongFormat() {
         assertEquals("10 / 1", improperFormat.format(10l));
     }
-    
+
     public void testDoubleFormat() {
         assertEquals("1 / 16", improperFormat.format(0.0625));
     }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/FractionFormatTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/FractionFormatTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/FractionFormatTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/FractionFormatTest.java Sat Sep  5 17:36:48 2009
@@ -24,7 +24,7 @@
 import junit.framework.TestCase;
 
 public class FractionFormatTest extends TestCase {
- 
+
     FractionFormat properFormat = null;
     FractionFormat improperFormat = null;
 
@@ -37,12 +37,12 @@
         properFormat = FractionFormat.getProperInstance(getLocale());
         improperFormat = FractionFormat.getImproperInstance(getLocale());
     }
-   
+
     public void testFormat() {
         Fraction c = new Fraction(1, 2);
         String expected = "1 / 2";
-        
-        String actual = properFormat.format(c); 
+
+        String actual = properFormat.format(c);
         assertEquals(expected, actual);
 
         actual = improperFormat.format(c);
@@ -53,10 +53,10 @@
         Fraction c = new Fraction(-1, 2);
         String expected = "-1 / 2";
 
-        String actual = properFormat.format(c); 
+        String actual = properFormat.format(c);
         assertEquals(expected, actual);
 
-        actual = improperFormat.format(c); 
+        actual = improperFormat.format(c);
         assertEquals(expected, actual);
     }
 
@@ -64,33 +64,33 @@
         Fraction c = new Fraction(0, 1);
         String expected = "0 / 1";
 
-        String actual = properFormat.format(c); 
+        String actual = properFormat.format(c);
         assertEquals(expected, actual);
 
-        actual = improperFormat.format(c); 
+        actual = improperFormat.format(c);
         assertEquals(expected, actual);
     }
-    
+
     public void testFormatImproper() {
         Fraction c = new Fraction(5, 3);
 
-        String actual = properFormat.format(c); 
+        String actual = properFormat.format(c);
         assertEquals("1 2 / 3", actual);
 
-        actual = improperFormat.format(c); 
+        actual = improperFormat.format(c);
         assertEquals("5 / 3", actual);
     }
-    
+
     public void testFormatImproperNegative() {
         Fraction c = new Fraction(-5, 3);
 
-        String actual = properFormat.format(c); 
+        String actual = properFormat.format(c);
         assertEquals("-1 2 / 3", actual);
 
-        actual = improperFormat.format(c); 
+        actual = improperFormat.format(c);
         assertEquals("-5 / 3", actual);
     }
-    
+
     public void testParse() {
         String source = "1 / 2";
 
@@ -99,7 +99,7 @@
             assertNotNull(c);
             assertEquals(1, c.getNumerator());
             assertEquals(2, c.getDenominator());
-            
+
             c = improperFormat.parse(source);
             assertNotNull(c);
             assertEquals(1, c.getNumerator());
@@ -108,7 +108,7 @@
             fail(ex.getMessage());
         }
     }
-    
+
     public void testParseInteger() {
         String source = "10";
         try {
@@ -128,7 +128,7 @@
             fail(ex.getMessage());
         }
     }
-    
+
     public void testParseInvalid() {
         String source = "a";
         String msg = "should not be able to parse '10 / a'.";
@@ -145,7 +145,7 @@
             // success
         }
     }
-    
+
     public void testParseInvalidDenominator() {
         String source = "10 / a";
         String msg = "should not be able to parse '10 / a'.";
@@ -162,7 +162,7 @@
             // success
         }
     }
-    
+
     public void testParseNegative() {
 
         try {
@@ -171,7 +171,7 @@
             assertNotNull(c);
             assertEquals(-1, c.getNumerator());
             assertEquals(2, c.getDenominator());
-            
+
             c = improperFormat.parse(source);
             assertNotNull(c);
             assertEquals(-1, c.getNumerator());
@@ -182,7 +182,7 @@
             assertNotNull(c);
             assertEquals(-1, c.getNumerator());
             assertEquals(2, c.getDenominator());
-            
+
             c = improperFormat.parse(source);
             assertNotNull(c);
             assertEquals(-1, c.getNumerator());
@@ -191,7 +191,7 @@
             fail(ex.getMessage());
         }
     }
-    
+
     public void testParseProper() {
         String source = "1 2 / 3";
 
@@ -203,7 +203,7 @@
         } catch (ParseException ex) {
             fail(ex.getMessage());
         }
-        
+
         try {
             improperFormat.parse(source);
             fail("invalid improper fraction.");
@@ -211,7 +211,7 @@
             // success
         }
     }
-    
+
     public void testParseProperNegative() {
         String source = "-1 2 / 3";
         try {
@@ -222,7 +222,7 @@
         } catch (ParseException ex) {
             fail(ex.getMessage());
         }
-        
+
         try {
             improperFormat.parse(source);
             fail("invalid improper fraction.");
@@ -230,7 +230,7 @@
             // success
         }
     }
-    
+
     public void testParseProperInvalidMinus() {
         String source = "2 -2 / 3";
         try {
@@ -247,7 +247,7 @@
             // expected
         }
     }
-    
+
     public void testNumeratorFormat() {
         NumberFormat old = properFormat.getNumeratorFormat();
         NumberFormat nf = NumberFormat.getInstance();
@@ -263,7 +263,7 @@
         assertEquals(nf, improperFormat.getNumeratorFormat());
         improperFormat.setNumeratorFormat(old);
     }
-    
+
     public void testDenominatorFormat() {
         NumberFormat old = properFormat.getDenominatorFormat();
         NumberFormat nf = NumberFormat.getInstance();
@@ -279,10 +279,10 @@
         assertEquals(nf, improperFormat.getDenominatorFormat());
         improperFormat.setDenominatorFormat(old);
     }
-    
+
     public void testWholeFormat() {
         ProperFractionFormat format = (ProperFractionFormat)properFormat;
-        
+
         NumberFormat old = format.getWholeFormat();
         NumberFormat nf = NumberFormat.getInstance();
         nf.setParseIntegerOnly(true);
@@ -290,11 +290,11 @@
         assertEquals(nf, format.getWholeFormat());
         format.setWholeFormat(old);
     }
-    
+
     public void testLongFormat() {
         assertEquals("10 / 1", improperFormat.format(10l));
     }
-    
+
     public void testDoubleFormat() {
         assertEquals("355 / 113", improperFormat.format(Math.PI));
     }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/FractionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/FractionTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/FractionTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/FractionTest.java Sat Sep  5 17:36:48 2009
@@ -30,7 +30,7 @@
         assertEquals(expectedNumerator, actual.getNumerator());
         assertEquals(expectedDenominator, actual.getDenominator());
     }
-    
+
     public void testConstructor() {
         assertFraction(0, 1, new Fraction(0, 1));
         assertFraction(0, 1, new Fraction(0, 2));
@@ -41,7 +41,7 @@
         assertFraction(-1, 2, new Fraction(1, -2));
         assertFraction(-1, 2, new Fraction(-2, 4));
         assertFraction(-1, 2, new Fraction(2, -4));
-        
+
         // overflow
         try {
             new Fraction(Integer.MIN_VALUE, -1);
@@ -55,11 +55,11 @@
         } catch (ArithmeticException ex) {
             // success
         }
-        try {        
+        try {
             assertFraction(0, 1, new Fraction(0.00000000000001));
             assertFraction(2, 5, new Fraction(0.40000000000001));
             assertFraction(15, 1, new Fraction(15.0000000000001));
-            
+
         } catch (ConvergenceException ex) {
             fail(ex.getMessage());
         }
@@ -165,7 +165,7 @@
         Fraction first = new Fraction(1, 2);
         Fraction second = new Fraction(1, 3);
         Fraction third = new Fraction(1, 2);
-        
+
         assertEquals(0, first.compareTo(first));
         assertEquals(0, first.compareTo(third));
         assertEquals(1, first.compareTo(second));
@@ -180,7 +180,7 @@
         assertEquals( 1, pi2.compareTo(pi1));
         assertEquals(0.0, pi1.doubleValue() - pi2.doubleValue(), 1.0e-20);
     }
-    
+
     public void testDoubleValue() {
         Fraction first = new Fraction(1, 2);
         Fraction second = new Fraction(1, 3);
@@ -188,7 +188,7 @@
         assertEquals(0.5, first.doubleValue(), 0.0);
         assertEquals(1.0 / 3.0, second.doubleValue(), 0.0);
     }
-    
+
     public void testFloatValue() {
         Fraction first = new Fraction(1, 2);
         Fraction second = new Fraction(1, 3);
@@ -196,7 +196,7 @@
         assertEquals(0.5f, first.floatValue(), 0.0f);
         assertEquals((float)(1.0 / 3.0), second.floatValue(), 0.0f);
     }
-    
+
     public void testIntValue() {
         Fraction first = new Fraction(1, 2);
         Fraction second = new Fraction(3, 2);
@@ -204,7 +204,7 @@
         assertEquals(0, first.intValue());
         assertEquals(1, second.intValue());
     }
-    
+
     public void testLongValue() {
         Fraction first = new Fraction(1, 2);
         Fraction second = new Fraction(3, 2);
@@ -212,7 +212,7 @@
         assertEquals(0L, first.longValue());
         assertEquals(1L, second.longValue());
     }
-    
+
     public void testConstructorDouble() {
         try {
             assertFraction(1, 2, new Fraction(0.5));
@@ -227,35 +227,35 @@
             fail(ex.getMessage());
         }
     }
-    
+
     public void testAbs() {
         Fraction a = new Fraction(10, 21);
         Fraction b = new Fraction(-10, 21);
         Fraction c = new Fraction(10, -21);
-        
+
         assertFraction(10, 21, a.abs());
         assertFraction(10, 21, b.abs());
         assertFraction(10, 21, c.abs());
     }
-    
+
     public void testReciprocal() {
         Fraction f = null;
-        
+
         f = new Fraction(50, 75);
         f = f.reciprocal();
         assertEquals(3, f.getNumerator());
         assertEquals(2, f.getDenominator());
-        
+
         f = new Fraction(4, 3);
         f = f.reciprocal();
         assertEquals(3, f.getNumerator());
         assertEquals(4, f.getDenominator());
-        
+
         f = new Fraction(-15, 47);
         f = f.reciprocal();
         assertEquals(-47, f.getNumerator());
         assertEquals(15, f.getDenominator());
-        
+
         f = new Fraction(0, 3);
         try {
             f = f.reciprocal();
@@ -268,15 +268,15 @@
         assertEquals(1, f.getNumerator());
         assertEquals(Integer.MAX_VALUE, f.getDenominator());
     }
-    
+
     public void testNegate() {
         Fraction f = null;
-        
+
         f = new Fraction(50, 75);
         f = f.negate();
         assertEquals(-2, f.getNumerator());
         assertEquals(3, f.getDenominator());
-        
+
         f = new Fraction(-50, 75);
         f = f.negate();
         assertEquals(2, f.getNumerator());
@@ -294,16 +294,16 @@
             fail("expecting ArithmeticException");
         } catch (ArithmeticException ex) {}
     }
-    
+
     public void testAdd() {
         Fraction a = new Fraction(1, 2);
         Fraction b = new Fraction(2, 3);
-        
+
         assertFraction(1, 1, a.add(a));
         assertFraction(7, 6, a.add(b));
         assertFraction(7, 6, b.add(a));
         assertFraction(4, 3, b.add(b));
-        
+
         Fraction f1 = new Fraction(Integer.MAX_VALUE - 1, 1);
         Fraction f2 = Fraction.ONE;
         Fraction f = f1.add(f2);
@@ -312,18 +312,18 @@
         f = f1.add(1);
         assertEquals(Integer.MAX_VALUE, f.getNumerator());
         assertEquals(1, f.getDenominator());
-        
+
         f1 = new Fraction(-1, 13*13*2*2);
         f2 = new Fraction(-2, 13*17*2);
         f = f1.add(f2);
         assertEquals(13*13*17*2*2, f.getDenominator());
         assertEquals(-17 - 2*13*2, f.getNumerator());
-        
+
         try {
             f.add(null);
             fail("expecting IllegalArgumentException");
         } catch (IllegalArgumentException ex) {}
-        
+
         // if this fraction is added naively, it will overflow.
         // check that it doesn't.
         f1 = new Fraction(1,32768*3);
@@ -337,18 +337,18 @@
         f = f1.add(f2);
         assertEquals(Integer.MIN_VALUE+1, f.getNumerator());
         assertEquals(3, f.getDenominator());
-        
+
         f1 = new Fraction(Integer.MAX_VALUE - 1, 1);
         f2 = Fraction.ONE;
         f = f1.add(f2);
         assertEquals(Integer.MAX_VALUE, f.getNumerator());
         assertEquals(1, f.getDenominator());
-        
+
         try {
             f = f.add(Fraction.ONE); // should overflow
             fail("expecting ArithmeticException but got: " + f.toString());
         } catch (ArithmeticException ex) {}
-        
+
         // denominator should not be a multiple of 2 or 3 to trigger overflow
         f1 = new Fraction(Integer.MIN_VALUE, 5);
         f2 = new Fraction(-1,5);
@@ -356,19 +356,19 @@
             f = f1.add(f2); // should overflow
             fail("expecting ArithmeticException but got: " + f.toString());
         } catch (ArithmeticException ex) {}
-        
+
         try {
             f= new Fraction(-Integer.MAX_VALUE, 1);
             f = f.add(f);
             fail("expecting ArithmeticException");
         } catch (ArithmeticException ex) {}
-        
+
         try {
             f= new Fraction(-Integer.MAX_VALUE, 1);
             f = f.add(f);
             fail("expecting ArithmeticException");
         } catch (ArithmeticException ex) {}
-        
+
         f1 = new Fraction(3,327680);
         f2 = new Fraction(2,59049);
         try {
@@ -376,39 +376,39 @@
             fail("expecting ArithmeticException but got: " + f.toString());
         } catch (ArithmeticException ex) {}
     }
-    
+
     public void testDivide() {
         Fraction a = new Fraction(1, 2);
         Fraction b = new Fraction(2, 3);
-        
+
         assertFraction(1, 1, a.divide(a));
         assertFraction(3, 4, a.divide(b));
         assertFraction(4, 3, b.divide(a));
         assertFraction(1, 1, b.divide(b));
-        
+
         Fraction f1 = new Fraction(3, 5);
         Fraction f2 = Fraction.ZERO;
         try {
             f1.divide(f2);
             fail("expecting ArithmeticException");
         } catch (ArithmeticException ex) {}
-        
+
         f1 = new Fraction(0, 5);
         f2 = new Fraction(2, 7);
         Fraction f = f1.divide(f2);
         assertSame(Fraction.ZERO, f);
-        
+
         f1 = new Fraction(2, 7);
         f2 = Fraction.ONE;
         f = f1.divide(f2);
         assertEquals(2, f.getNumerator());
         assertEquals(7, f.getDenominator());
-        
+
         f1 = new Fraction(1, Integer.MAX_VALUE);
-        f = f1.divide(f1);  
+        f = f1.divide(f1);
         assertEquals(1, f.getNumerator());
         assertEquals(1, f.getDenominator());
-        
+
         f1 = new Fraction(Integer.MIN_VALUE, Integer.MAX_VALUE);
         f2 = new Fraction(1, Integer.MAX_VALUE);
         f = f1.divide(f2);
@@ -419,7 +419,7 @@
             f.divide(null);
             fail("IllegalArgumentException");
         } catch (IllegalArgumentException ex) {}
-        
+
         try {
             f1 = new Fraction(1, Integer.MAX_VALUE);
             f = f1.divide(f1.reciprocal());  // should overflow
@@ -437,16 +437,16 @@
         assertEquals(175, f.getDenominator());
 
     }
-    
+
     public void testMultiply() {
         Fraction a = new Fraction(1, 2);
         Fraction b = new Fraction(2, 3);
-        
+
         assertFraction(1, 4, a.multiply(a));
         assertFraction(1, 3, a.multiply(b));
         assertFraction(1, 3, b.multiply(a));
         assertFraction(4, 9, b.multiply(b));
-        
+
         Fraction f1 = new Fraction(Integer.MAX_VALUE, 1);
         Fraction f2 = new Fraction(Integer.MIN_VALUE, Integer.MAX_VALUE);
         Fraction f = f1.multiply(f2);
@@ -463,22 +463,22 @@
         assertEquals(18, f.getNumerator());
         assertEquals(7, f.getDenominator());
     }
-    
+
     public void testSubtract() {
         Fraction a = new Fraction(1, 2);
         Fraction b = new Fraction(2, 3);
-        
+
         assertFraction(0, 1, a.subtract(a));
         assertFraction(-1, 6, a.subtract(b));
         assertFraction(1, 6, b.subtract(a));
         assertFraction(0, 1, b.subtract(b));
-        
+
         Fraction f = new Fraction(1,1);
         try {
             f.subtract(null);
             fail("expecting IllegalArgumentException");
         } catch (IllegalArgumentException ex) {}
-        
+
         // if this fraction is subtracted naively, it will overflow.
         // check that it doesn't.
         Fraction f1 = new Fraction(1,32768*3);
@@ -492,7 +492,7 @@
         f = f1.subtract(f2);
         assertEquals(Integer.MIN_VALUE+1, f.getNumerator());
         assertEquals(3, f.getDenominator());
-        
+
         f1 = new Fraction(Integer.MAX_VALUE, 1);
         f2 = Fraction.ONE;
         f = f1.subtract(f2);
@@ -508,7 +508,7 @@
             f = f1.subtract(f2);
             fail("expecting ArithmeticException");  //should overflow
         } catch (ArithmeticException ex) {}
-        
+
         // denominator should not be a multiple of 2 or 3 to trigger overflow
         f1 = new Fraction(Integer.MIN_VALUE, 5);
         f2 = new Fraction(1,5);
@@ -516,19 +516,19 @@
             f = f1.subtract(f2); // should overflow
             fail("expecting ArithmeticException but got: " + f.toString());
         } catch (ArithmeticException ex) {}
-        
+
         try {
             f= new Fraction(Integer.MIN_VALUE, 1);
             f = f.subtract(Fraction.ONE);
             fail("expecting ArithmeticException");
         } catch (ArithmeticException ex) {}
-        
+
         try {
             f= new Fraction(Integer.MAX_VALUE, 1);
             f = f.subtract(Fraction.ONE.negate());
             fail("expecting ArithmeticException");
         } catch (ArithmeticException ex) {}
-        
+
         f1 = new Fraction(3,327680);
         f2 = new Fraction(2,59049);
         try {
@@ -536,7 +536,7 @@
             fail("expecting ArithmeticException but got: " + f.toString());
         } catch (ArithmeticException ex) {}
     }
-    
+
     public void testEqualsAndHashCode() {
         Fraction zero  = new Fraction(0,1);
         Fraction nullFraction = null;
@@ -549,7 +549,7 @@
         Fraction one = new Fraction(1,1);
         assertFalse((one.equals(zero) ||zero.equals(one)));
     }
-    
+
     public void testGetReducedFraction() {
         Fraction threeFourths = new Fraction(3, 4);
         assertTrue(threeFourths.equals(Fraction.getReducedFraction(6, 8)));

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/BinaryChromosomeTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/BinaryChromosomeTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/BinaryChromosomeTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/BinaryChromosomeTest.java Sat Sep  5 17:36:48 2009
@@ -23,31 +23,31 @@
 import org.junit.Test;
 
 public class BinaryChromosomeTest {
-    
+
     @Test
-    public void testInvalidConstructor() {        
+    public void testInvalidConstructor() {
         Integer[][] reprs = new Integer[][] {
                 new Integer[] {0,1,0,1,2},
                 new Integer[] {0,1,0,1,-1}
         };
-        
+
         for (Integer[] repr : reprs) {
             try {
                 new DummyBinaryChromosome(repr);
                 fail("Exception not caught");
             } catch (IllegalArgumentException e) {
-                
+
             }
         }
     }
-    
+
     @Test
     public void testRandomConstructor() {
         for (int i=0; i<20; i++) {
             new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(10));
         }
     }
-    
+
     @Test
     public void testIsSame() {
         Chromosome c1 = new DummyBinaryChromosome(new Integer[] {0,1,0,1,0,1});
@@ -56,7 +56,7 @@
         Chromosome c4 = new DummyBinaryChromosome(new Integer[] {1,1,0,1,0,1});
         Chromosome c5 = new DummyBinaryChromosome(new Integer[] {0,1,0,1,0,0});
         Chromosome c6 = new DummyBinaryChromosome(new Integer[] {0,1,0,1,0,1});
-        
+
         assertFalse(c1.isSame(c2));
         assertFalse(c1.isSame(c3));
         assertFalse(c1.isSame(c4));

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/BinaryMutationTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/BinaryMutationTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/BinaryMutationTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/BinaryMutationTest.java Sat Sep  5 17:36:48 2009
@@ -25,12 +25,12 @@
     @Test
     public void testMutate() {
         BinaryMutation mutation = new BinaryMutation();
-        
+
         // stochastic testing :)
         for (int i=0; i<20; i++) {
-            DummyBinaryChromosome original = new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(10));            
+            DummyBinaryChromosome original = new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(10));
             DummyBinaryChromosome mutated = (DummyBinaryChromosome) mutation.mutate(original);
-            
+
             // one gene should be different
             int numDifferent = 0;
             for (int j=0; j<original.getRepresentation().size(); j++) {

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/ChromosomeTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/ChromosomeTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/ChromosomeTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/ChromosomeTest.java Sat Sep  5 17:36:48 2009
@@ -28,27 +28,27 @@
     @Test
     public void testCompareTo() {
         Chromosome c1 = new Chromosome() {
-            public double fitness() {                
+            public double fitness() {
                 return 0;
             }
         };
         Chromosome c2 = new Chromosome() {
-            public double fitness() {                
+            public double fitness() {
                 return 10;
             }
         };
         Chromosome c3 = new Chromosome() {
-            public double fitness() {                
+            public double fitness() {
                 return 10;
             }
         };
-        
+
         assertTrue(c1.compareTo(c2) < 0);
         assertTrue(c2.compareTo(c1) > 0);
         assertEquals(0,c3.compareTo(c2));
         assertEquals(0,c2.compareTo(c3));
     }
-    
+
     private abstract static class DummyChromosome extends Chromosome {
         private final int repr;
 
@@ -60,7 +60,7 @@
             return ((DummyChromosome) another).repr == repr;
         }
     }
-    
+
     @Test
     public void testFindSameChromosome() {
         Chromosome c1 = new DummyChromosome(1) {
@@ -88,7 +88,7 @@
                 return 15;
             }
         };
-        
+
         List<Chromosome> popChr = new ArrayList<Chromosome>();
         popChr.add(c1);
         popChr.add(c2);
@@ -99,10 +99,10 @@
                 return null;
             }
         };
-        
+
         assertNull(c5.findSameChromosome(pop));
         assertEquals(c1, c4.findSameChromosome(pop));
-        
+
         c4.searchForFitnessUpdate(pop);
         assertEquals(1, c4.getFitness(),0);
     }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/DummyBinaryChromosome.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/DummyBinaryChromosome.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/DummyBinaryChromosome.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/DummyBinaryChromosome.java Sat Sep  5 17:36:48 2009
@@ -26,7 +26,7 @@
     public DummyBinaryChromosome(List<Integer> representation) {
         super(representation);
     }
-    
+
     public DummyBinaryChromosome(Integer[] representation) {
         super(representation);
     }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/DummyRandomKey.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/DummyRandomKey.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/DummyRandomKey.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/DummyRandomKey.java Sat Sep  5 17:36:48 2009
@@ -26,7 +26,7 @@
     public DummyRandomKey(List<Double> representation) {
         super(representation);
     }
-    
+
     public DummyRandomKey(Double[] representation) {
         super(representation);
     }
@@ -40,5 +40,5 @@
         // unimportant
         return 0;
     }
-    
+
 }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/ElitisticListPopulationTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/ElitisticListPopulationTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/ElitisticListPopulationTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/ElitisticListPopulationTest.java Sat Sep  5 17:36:48 2009
@@ -21,31 +21,31 @@
 import org.junit.Test;
 
 public class ElitisticListPopulationTest {
-    
+
     private static int counter = 0;
 
     @Test
     public void testNextGeneration() {
         ElitisticListPopulation pop = new ElitisticListPopulation(100, 0.203);
-        
+
         for (int i=0; i<pop.getPopulationLimit(); i++) {
             pop.addChromosome(new DummyChromosome());
         }
-        
+
         Population nextGeneration = pop.nextGeneration();
-        
+
         assertEquals(20, nextGeneration.getPopulationSize());
     }
-    
+
     private static class DummyChromosome extends Chromosome {
         private final int fitness;
-        
+
         public DummyChromosome() {
             this.fitness = counter;
             counter++;
         }
-        
-        public double fitness() {            
+
+        public double fitness() {
             return this.fitness;
         }
     }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/FitnessCachingTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/FitnessCachingTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/FitnessCachingTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/FitnessCachingTest.java Sat Sep  5 17:36:48 2009
@@ -24,13 +24,13 @@
 
 
 public class FitnessCachingTest {
-    
+
     // parameters for the GA
-    private static final int DIMENSION = 50; 
+    private static final int DIMENSION = 50;
     private static final double CROSSOVER_RATE = 1;
     private static final double MUTATION_RATE = 0.1;
     private static final int TOURNAMENT_ARITY = 5;
-    
+
     private static final int POPULATION_SIZE = 10;
     private static final int NUM_GENERATIONS = 50;
     private static final double ELITISM_RATE = 0.2;
@@ -49,15 +49,15 @@
                 MUTATION_RATE, // no mutation
                 new TournamentSelection(TOURNAMENT_ARITY)
         );
-        
+
         // initial population
         Population initial = randomPopulation();
         // stopping conditions
         StoppingCondition stopCond = new FixedGenerationCount(NUM_GENERATIONS);
-        
+
         // run the algorithm
         ga.evolve(initial, stopCond);
-        
+
         int neededCalls =
             POPULATION_SIZE /*initial population*/ +
             (NUM_GENERATIONS - 1) /*for each population*/ * (int)(POPULATION_SIZE * (1.0 - ELITISM_RATE)) /*some chromosomes are copied*/
@@ -71,19 +71,19 @@
      */
     private static ElitisticListPopulation randomPopulation() {
         List<Chromosome> popList = new LinkedList<Chromosome>();
-        
+
         for (int i=0; i<POPULATION_SIZE; i++) {
             BinaryChromosome randChrom = new DummyCountingBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(DIMENSION));
             popList.add(randChrom);
-        }        
+        }
         return new ElitisticListPopulation(popList, popList.size(), ELITISM_RATE);
     }
-    
+
     private static class DummyCountingBinaryChromosome extends DummyBinaryChromosome {
 
         public DummyCountingBinaryChromosome(List<Integer> representation) {
             super(representation);
-        }        
+        }
 
         @Override
         public double fitness() {

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/FixedGenerationCountTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/FixedGenerationCountTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/FixedGenerationCountTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/FixedGenerationCountTest.java Sat Sep  5 17:36:48 2009
@@ -27,7 +27,7 @@
     @Test
     public void testIsSatisfied() {
         FixedGenerationCount fgc = new FixedGenerationCount(20);
-        
+
         int cnt = 0;
         Population pop = new Population() {
             public void addChromosome(Chromosome chromosome) {
@@ -54,7 +54,7 @@
                 return null;
             }
         };
-        
+
         while (!fgc.isSatisfied(pop))
             cnt++;
         assertEquals(20, cnt);

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/GeneticAlgorithmTestBinary.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/GeneticAlgorithmTestBinary.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/GeneticAlgorithmTestBinary.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/GeneticAlgorithmTestBinary.java Sat Sep  5 17:36:48 2009
@@ -26,10 +26,10 @@
  * This is also an example of usage.
  */
 public class GeneticAlgorithmTestBinary {
-    
+
     // parameters for the GA
-    private static final int DIMENSION = 50;    
-    private static final int POPULATION_SIZE = 50; 
+    private static final int DIMENSION = 50;
+    private static final int POPULATION_SIZE = 50;
     private static final int NUM_GENERATIONS = 50;
     private static final double ELITISM_RATE = 0.2;
     private static final double CROSSOVER_RATE = 1;
@@ -39,7 +39,7 @@
     @Test
     public void test() {
         // to test a stochastic algorithm is hard, so this will rather be an usage example
-        
+
         // initialize a new genetic algorithm
         GeneticAlgorithm ga = new GeneticAlgorithm(
                 new OnePointCrossover<Integer>(),
@@ -48,49 +48,49 @@
                 MUTATION_RATE,
                 new TournamentSelection(TOURNAMENT_ARITY)
         );
-        
+
         // initial population
         Population initial = randomPopulation();
         // stopping conditions
         StoppingCondition stopCond = new FixedGenerationCount(NUM_GENERATIONS);
-        
+
         // best initial chromosome
         Chromosome bestInitial = initial.getFittestChromosome();
-        
+
         // run the algorithm
         Population finalPopulation = ga.evolve(initial, stopCond);
-        
+
         // best chromosome from the final population
         Chromosome bestFinal = finalPopulation.getFittestChromosome();
-        
+
         // the only thing we can test is whether the final solution is not worse than the initial one
         // however, for some implementations of GA, this need not be true :)
-        
+
         assertTrue(bestFinal.compareTo(bestInitial) > 0);
-        
+
         //System.out.println(bestInitial);
         //System.out.println(bestFinal);
     }
-    
-    
-    
-    
+
+
+
+
     /**
      * Initializes a random population.
      */
     private static ElitisticListPopulation randomPopulation() {
         List<Chromosome> popList = new LinkedList<Chromosome>();
-        
+
         for (int i=0; i<POPULATION_SIZE; i++) {
             BinaryChromosome randChrom = new FindOnes(BinaryChromosome.randomBinaryRepresentation(DIMENSION));
             popList.add(randChrom);
-        }        
+        }
         return new ElitisticListPopulation(popList, popList.size(), ELITISM_RATE);
     }
-    
+
     /**
      * Chromosomes represented by a binary chromosome.
-     * 
+     *
      * The goal is to set all bits (genes) to 1.
      */
     private static class FindOnes extends BinaryChromosome {

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/GeneticAlgorithmTestPermutations.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/GeneticAlgorithmTestPermutations.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/GeneticAlgorithmTestPermutations.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/GeneticAlgorithmTestPermutations.java Sat Sep  5 17:36:48 2009
@@ -25,21 +25,21 @@
 
 /**
  * This is also an example of usage.
- * 
+ *
  * This algorithm does "stochastic sorting" of a sequence 0,...,N.
- * 
+ *
  */
 public class GeneticAlgorithmTestPermutations {
-    
+
     // parameters for the GA
-    private static final int DIMENSION = 20;    
-    private static final int POPULATION_SIZE = 80; 
+    private static final int DIMENSION = 20;
+    private static final int POPULATION_SIZE = 80;
     private static final int NUM_GENERATIONS = 200;
     private static final double ELITISM_RATE = 0.2;
     private static final double CROSSOVER_RATE = 1;
     private static final double MUTATION_RATE = 0.08;
     private static final int TOURNAMENT_ARITY = 2;
-    
+
     // numbers from 0 to N-1
     private static List<Integer> sequence = new ArrayList<Integer>();
     static {
@@ -51,7 +51,7 @@
     @Test
     public void test() {
         // to test a stochastic algorithm is hard, so this will rather be an usage example
-        
+
         // initialize a new genetic algorithm
         GeneticAlgorithm ga = new GeneticAlgorithm(
                 new OnePointCrossover<Integer>(),
@@ -60,31 +60,31 @@
                 MUTATION_RATE,
                 new TournamentSelection(TOURNAMENT_ARITY)
         );
-        
+
         // initial population
         Population initial = randomPopulation();
         // stopping conditions
         StoppingCondition stopCond = new FixedGenerationCount(NUM_GENERATIONS);
-        
+
         // best initial chromosome
         Chromosome bestInitial = initial.getFittestChromosome();
-        
+
         // run the algorithm
         Population finalPopulation = ga.evolve(initial, stopCond);
-        
+
         // best chromosome from the final population
         Chromosome bestFinal = finalPopulation.getFittestChromosome();
-        
+
         // the only thing we can test is whether the final solution is not worse than the initial one
         // however, for some implementations of GA, this need not be true :)
-        
+
         assertTrue(bestFinal.compareTo(bestInitial) > 0);
-        
+
         //System.out.println(bestInitial);
         //System.out.println(bestFinal);
     }
-    
-    
+
+
     /**
      * Initializes a random population
      */
@@ -96,10 +96,10 @@
         }
         return new ElitisticListPopulation(popList, popList.size(), ELITISM_RATE);
     }
-    
+
     /**
      * Chromosomes representing a permutation of (0,1,2,...,DIMENSION-1).
-     * 
+     *
      * The goal is to sort the sequence.
      */
     private static class MinPermutations extends RandomKey<Integer> {
@@ -120,7 +120,7 @@
             }
             // the most fitted chromosome is the one with minimal error
             // therefore we must return negative value
-            return -res; 
+            return -res;
         }
 
         @Override

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/ListPopulationTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/ListPopulationTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/ListPopulationTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/ListPopulationTest.java Sat Sep  5 17:36:48 2009
@@ -27,26 +27,26 @@
     @Test
     public void testGetFittestChromosome() {
         Chromosome c1 = new Chromosome() {
-            public double fitness() {                
+            public double fitness() {
                 return 0;
             }
         };
         Chromosome c2 = new Chromosome() {
-            public double fitness() {                
+            public double fitness() {
                 return 10;
             }
         };
         Chromosome c3 = new Chromosome() {
-            public double fitness() {                
+            public double fitness() {
                 return 15;
             }
         };
-        
+
         ArrayList<Chromosome> chromosomes = new ArrayList<Chromosome> ();
         chromosomes.add(c1);
         chromosomes.add(c2);
         chromosomes.add(c3);
-        
+
         ListPopulation population = new ListPopulation(chromosomes,10) {
 
             public Population nextGeneration() {
@@ -54,7 +54,7 @@
                 return null;
             }
         };
-        
+
         assertEquals(c3, population.getFittestChromosome());
     }
 

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/OnePointCrossoverTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/OnePointCrossoverTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/OnePointCrossoverTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/OnePointCrossoverTest.java Sat Sep  5 17:36:48 2009
@@ -25,22 +25,22 @@
     public void testCrossover() {
         Integer[] p1 = new Integer[] {1,0,1,0,0,1,0,1,1};
         Integer[] p2 = new Integer[] {0,1,1,0,1,0,1,1,1};
-        
+
         BinaryChromosome p1c = new DummyBinaryChromosome(p1);
         BinaryChromosome p2c = new DummyBinaryChromosome(p2);
-        
+
         OnePointCrossover<Integer> opc = new OnePointCrossover<Integer>();
-        
+
         // how to test a stochastic method?
         for (int i=0; i<20; i++) {
             ChromosomePair pair = opc.crossover(p1c,p2c);
-            
+
             Integer[] c1 = new Integer[p1.length];
             Integer[] c2 = new Integer[p2.length];
-            
+
             c1 = ((BinaryChromosome) pair.getFirst()).getRepresentation().toArray(c1);
             c2 = ((BinaryChromosome) pair.getSecond()).getRepresentation().toArray(c2);
-            
+
             // first and last values will be the same
             assertEquals((int) p1[0], (int) c1[0]);
             assertEquals((int) p2[0], (int) c2[0]);

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/RandomKeyMutationTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/RandomKeyMutationTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/RandomKeyMutationTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/RandomKeyMutationTest.java Sat Sep  5 17:36:48 2009
@@ -30,7 +30,7 @@
             DummyRandomKey origRk = new DummyRandomKey(RandomKey.randomPermutation(l));
             Chromosome mutated = mutation.mutate(origRk);
             DummyRandomKey mutatedRk = (DummyRandomKey) mutated;
-            
+
             int changes = 0;
             for (int j=0; j<origRk.getLength(); j++) {
                 if (origRk.getRepresentation().get(j) != mutatedRk.getRepresentation().get(j)) {

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/RandomKeyTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/RandomKeyTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/RandomKeyTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/RandomKeyTest.java Sat Sep  5 17:36:48 2009
@@ -30,7 +30,7 @@
     public void testConstructor1() {
         new DummyRandomKey(new Double[] {0.2, 0.3, 1.2});
     }
-    
+
     @Test(expected=IllegalArgumentException.class)
     public void testConstructor2() {
         new DummyRandomKey(new Double[] {0.2, 0.3, -0.2});
@@ -43,7 +43,7 @@
         DummyRandomKey drk3 = new DummyRandomKey(new Double[] {0.4, 0.15, 0.5, 0.8, 0.2});
         DummyRandomKey drk4 = new DummyRandomKey(new Double[] {0.4, 0.25, 0.5, 0.8, 0.2});
         DummyRandomKey drk5 = new DummyRandomKey(new Double[] {0.4, 0.25, 0.5, 0.8, 0.2, 0.5});
-        
+
         assertTrue(drk1.isSame(drk2));
         assertTrue(drk2.isSame(drk3));
         assertFalse(drk3.isSame(drk4));
@@ -54,7 +54,7 @@
     public void testDecode() {
         DummyRandomKey drk = new DummyRandomKey(new Double[] {0.4, 0.1, 0.5, 0.8, 0.2});
         List<String> decoded = drk.decode(Arrays.asList(new String[] {"a", "b", "c", "d", "e"}));
-        
+
         assertEquals("b", decoded.get(0));
         assertEquals("e", decoded.get(1));
         assertEquals("a", decoded.get(2));
@@ -75,7 +75,7 @@
     public void testIdentityPermutation() {
         DummyRandomKey drk = new DummyRandomKey(RandomKey.identityPermutation(5));
         List<String> decoded = drk.decode(Arrays.asList(new String[] {"a", "b", "c", "d", "e"}));
-        
+
         assertEquals("a", decoded.get(0));
         assertEquals("b", decoded.get(1));
         assertEquals("c", decoded.get(2));
@@ -86,7 +86,7 @@
     @Test
     public void testComparatorPermutation() {
         List<String> data = Arrays.asList(new String[] {"x", "b", "c", "z", "b"});
-        
+
         List<Double> permutation = RandomKey.comparatorPermutation(data, new Comparator<String>() {
             public int compare(String o1, String o2) {
                 return o1.compareTo(o2);
@@ -101,7 +101,7 @@
         assertEquals("c", decodedData.get(2));
         assertEquals("x", decodedData.get(3));
         assertEquals("z", decodedData.get(4));
-        
+
         permutation = RandomKey.comparatorPermutation(data, new Comparator<String>() {
             public int compare(String o1, String o2) {
                 return o2.compareTo(o1);
@@ -117,15 +117,15 @@
         assertEquals("b", decodedData.get(3));
         assertEquals("b", decodedData.get(4));
     }
-    
+
     @Test
     public void testInducedPermutation() {
         List<String> origData = Arrays.asList(new String[] {"a", "b", "c", "d", "d"});
         List<String> permutedData = Arrays.asList(new String[] {"d", "b", "c", "a", "d"});
-        
+
         DummyRandomKey drk = new DummyRandomKey(RandomKey.inducedPermutation(origData, permutedData));
         List<String> decoded = drk.decode(origData);
-        
+
         assertEquals("d", decoded.get(0));
         assertEquals("b", decoded.get(1));
         assertEquals("c", decoded.get(2));
@@ -160,5 +160,5 @@
         assertEquals("b", decodedData.get(1));
         assertEquals("c", decodedData.get(2));
     }
-    
+
 }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/TournamentSelectionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/TournamentSelectionTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/TournamentSelectionTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/TournamentSelectionTest.java Sat Sep  5 17:36:48 2009
@@ -20,14 +20,14 @@
 import org.junit.Test;
 
 public class TournamentSelectionTest {
-    
+
     private static int counter = 0;
 
     @Test
     public void testSelect() {
         TournamentSelection ts = new TournamentSelection(2);
         ElitisticListPopulation pop = new ElitisticListPopulation(100, 0.203);
-        
+
         for (int i=0; i<pop.getPopulationLimit(); i++) {
             pop.addChromosome(new DummyChromosome());
         }
@@ -39,16 +39,16 @@
             assertTrue(pair.getSecond().getFitness() > 0);
         }
     }
-    
+
     private static class DummyChromosome extends Chromosome {
         private final int fitness;
-        
+
         public DummyChromosome() {
             this.fitness = counter;
             counter++;
         }
-        
-        public double fitness() {            
+
+        public double fitness() {
             return this.fitness;
         }
     }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/FrenchVector3DFormatTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/FrenchVector3DFormatTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/FrenchVector3DFormatTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/FrenchVector3DFormatTest.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.

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/Vector3DFormatAbstractTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/Vector3DFormatAbstractTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/Vector3DFormatAbstractTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/Vector3DFormatAbstractTest.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.
@@ -27,7 +27,7 @@
 import org.apache.commons.math.util.CompositeFormat;
 
 public abstract class Vector3DFormatAbstractTest extends TestCase {
- 
+
     Vector3DFormat vector3DFormat = null;
     Vector3DFormat vector3DFormatSquare = null;
 
@@ -42,11 +42,11 @@
         nf.setMaximumFractionDigits(2);
         vector3DFormatSquare = new Vector3DFormat("[", "]", " : ", nf);
     }
-   
+
     public void testSimpleNoDecimals() {
         Vector3D c = new Vector3D(1, 1, 1);
         String expected = "{1; 1; 1}";
-        String actual = vector3DFormat.format(c); 
+        String actual = vector3DFormat.format(c);
         assertEquals(expected, actual);
     }
 
@@ -57,7 +57,7 @@
             "23; 1" + getDecimalCharacter() +
             "43; 1" + getDecimalCharacter() +
             "63}";
-        String actual = vector3DFormat.format(c); 
+        String actual = vector3DFormat.format(c);
         assertEquals(expected, actual);
     }
 
@@ -68,7 +68,7 @@
             "23; 1" + getDecimalCharacter() +
             "43; 1" + getDecimalCharacter() +
             "63}";
-        String actual = vector3DFormat.format(c); 
+        String actual = vector3DFormat.format(c);
         assertEquals(expected, actual);
     }
 
@@ -79,7 +79,7 @@
             "23; 1" + getDecimalCharacter() +
             "43; 1" + getDecimalCharacter() +
             "63}";
-        String actual = vector3DFormat.format(c); 
+        String actual = vector3DFormat.format(c);
         assertEquals(expected, actual);
     }
 
@@ -90,7 +90,7 @@
             "23; -1" + getDecimalCharacter() +
             "43; 1" + getDecimalCharacter() +
             "63}";
-        String actual = vector3DFormat.format(c); 
+        String actual = vector3DFormat.format(c);
         assertEquals(expected, actual);
     }
 
@@ -101,51 +101,51 @@
             "23; 1" + getDecimalCharacter() +
             "43; -1" + getDecimalCharacter() +
             "63}";
-        String actual = vector3DFormat.format(c); 
+        String actual = vector3DFormat.format(c);
         assertEquals(expected, actual);
     }
 
     public void testNonDefaultSetting() {
         Vector3D c = new Vector3D(1, 1, 1);
         String expected = "[1 : 1 : 1]";
-        String actual = vector3DFormatSquare.format(c); 
+        String actual = vector3DFormatSquare.format(c);
         assertEquals(expected, actual);
     }
-    
+
     public void testStaticFormatVector3D() {
         Locale defaultLocal = Locale.getDefault();
         Locale.setDefault(getLocale());
-        
+
         Vector3D c = new Vector3D(232.222, -342.33, 432.444);
         String expected =
             "{232"    + getDecimalCharacter() +
             "22; -342" + getDecimalCharacter() +
             "33; 432" + getDecimalCharacter() +
             "44}";
-        String actual = Vector3DFormat.formatVector3D(c); 
+        String actual = Vector3DFormat.formatVector3D(c);
         assertEquals(expected, actual);
-        
+
         Locale.setDefault(defaultLocal);
     }
 
     public void testNan() {
         Vector3D c = Vector3D.NaN;
         String expected = "{(NaN); (NaN); (NaN)}";
-        String actual = vector3DFormat.format(c); 
+        String actual = vector3DFormat.format(c);
         assertEquals(expected, actual);
     }
 
     public void testPositiveInfinity() {
         Vector3D c = Vector3D.POSITIVE_INFINITY;
         String expected = "{(Infinity); (Infinity); (Infinity)}";
-        String actual = vector3DFormat.format(c); 
+        String actual = vector3DFormat.format(c);
         assertEquals(expected, actual);
     }
 
     public void tesNegativeInfinity() {
         Vector3D c = Vector3D.NEGATIVE_INFINITY;
         String expected = "{(-Infinity); (-Infinity); (-Infinity)}";
-        String actual = vector3DFormat.format(c); 
+        String actual = vector3DFormat.format(c);
         assertEquals(expected, actual);
     }
 
@@ -153,7 +153,7 @@
         String source = "{1; 1; 1}";
         Vector3D expected = new Vector3D(1, 1, 1);
         try {
-            Vector3D actual = (Vector3D) vector3DFormat.parseObject(source); 
+            Vector3D actual = (Vector3D) vector3DFormat.parseObject(source);
             assertEquals(expected, actual);
         } catch (ParseException ex) {
             fail(ex.getMessage());
@@ -180,7 +180,7 @@
             "63}";
         Vector3D expected = new Vector3D(1.23, 1.43, 1.63);
         try {
-            Vector3D actual = (Vector3D) vector3DFormat.parseObject(source); 
+            Vector3D actual = (Vector3D) vector3DFormat.parseObject(source);
             assertEquals(expected, actual);
         } catch (ParseException ex) {
             fail(ex.getMessage());
@@ -195,7 +195,7 @@
             "6333}";
         Vector3D expected = new Vector3D(1.2323, 1.4343, 1.6333);
         try {
-            Vector3D actual = (Vector3D) vector3DFormat.parseObject(source); 
+            Vector3D actual = (Vector3D) vector3DFormat.parseObject(source);
             assertEquals(expected, actual);
         } catch (ParseException ex) {
             fail(ex.getMessage());
@@ -210,7 +210,7 @@
             "6333}";
         Vector3D expected = new Vector3D(-1.2323, 1.4343, 1.6333);
         try {
-            Vector3D actual = (Vector3D) vector3DFormat.parseObject(source); 
+            Vector3D actual = (Vector3D) vector3DFormat.parseObject(source);
             assertEquals(expected, actual);
         } catch (ParseException ex) {
             fail(ex.getMessage());
@@ -225,7 +225,7 @@
             "6333}";
         Vector3D expected = new Vector3D(1.2323, -1.4343, 1.6333);
         try {
-            Vector3D actual = (Vector3D) vector3DFormat.parseObject(source); 
+            Vector3D actual = (Vector3D) vector3DFormat.parseObject(source);
             assertEquals(expected, actual);
         } catch (ParseException ex) {
             fail(ex.getMessage());
@@ -240,7 +240,7 @@
             "6333}";
         Vector3D expected = new Vector3D(1.2323, 1.4343, -1.6333);
         try {
-            Vector3D actual = (Vector3D) vector3DFormat.parseObject(source); 
+            Vector3D actual = (Vector3D) vector3DFormat.parseObject(source);
             assertEquals(expected, actual);
         } catch (ParseException ex) {
             fail(ex.getMessage());
@@ -255,7 +255,7 @@
             "6333}";
         Vector3D expected = new Vector3D(-1.2323, -1.4343, -1.6333);
         try {
-            Vector3D actual = (Vector3D) vector3DFormat.parseObject(source); 
+            Vector3D actual = (Vector3D) vector3DFormat.parseObject(source);
             assertEquals(expected, actual);
         } catch (ParseException ex) {
             fail(ex.getMessage());
@@ -270,7 +270,7 @@
             "6333}";
         Vector3D expected = new Vector3D(0.0, -1.4343, 1.6333);
         try {
-            Vector3D actual = (Vector3D) vector3DFormat.parseObject(source); 
+            Vector3D actual = (Vector3D) vector3DFormat.parseObject(source);
             assertEquals(expected, actual);
         } catch (ParseException ex) {
             fail(ex.getMessage());
@@ -285,17 +285,17 @@
             "6333]";
         Vector3D expected = new Vector3D(1.2323, 1.4343, 1.6333);
         try {
-            Vector3D actual = (Vector3D) vector3DFormatSquare.parseObject(source); 
+            Vector3D actual = (Vector3D) vector3DFormatSquare.parseObject(source);
             assertEquals(expected, actual);
         } catch (ParseException ex) {
             fail(ex.getMessage());
         }
     }
-    
+
     public void testParseNan() {
         String source = "{(NaN); (NaN); (NaN)}";
         try {
-            Vector3D actual = (Vector3D) vector3DFormat.parseObject(source); 
+            Vector3D actual = (Vector3D) vector3DFormat.parseObject(source);
             assertEquals(Vector3D.NaN, actual);
         } catch (ParseException ex) {
             fail(ex.getMessage());
@@ -305,7 +305,7 @@
     public void testParsePositiveInfinity() {
         String source = "{(Infinity); (Infinity); (Infinity)}";
         try {
-            Vector3D actual = (Vector3D)vector3DFormat.parseObject(source); 
+            Vector3D actual = (Vector3D)vector3DFormat.parseObject(source);
             assertEquals(Vector3D.POSITIVE_INFINITY, actual);
         } catch (ParseException ex) {
             fail(ex.getMessage());
@@ -315,7 +315,7 @@
     public void testParseNegativeInfinity() {
         String source = "{(-Infinity); (-Infinity); (-Infinity)}";
         try {
-            Vector3D actual = (Vector3D)vector3DFormat.parseObject(source); 
+            Vector3D actual = (Vector3D)vector3DFormat.parseObject(source);
             assertEquals(Vector3D.NEGATIVE_INFINITY, actual);
         } catch (ParseException ex) {
             fail(ex.getMessage());
@@ -328,7 +328,7 @@
         assertNotNull(cf);
         assertEquals(nf, cf.getFormat());
     }
-    
+
     public void testFormatObject() {
         try {
             CompositeFormat cf = new Vector3DFormat();

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/Vector3DFormatTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/Vector3DFormatTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/Vector3DFormatTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/Vector3DFormatTest.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.

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/Vector3DTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/Vector3DTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/Vector3DTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/Vector3DTest.java Sat Sep  5 17:36:48 2009
@@ -52,7 +52,7 @@
     assertTrue(Math.abs(v.getY() - 2) < 1.0e-12);
     assertTrue(Math.abs(v.getZ() - 3) < 1.0e-12);
   }
-  
+
   public void testNorm1() {
     assertEquals(0.0, Vector3D.ZERO.getNorm1());
     assertEquals(6.0, new Vector3D(1, -2, 3).getNorm1(), 0);
@@ -203,13 +203,13 @@
   }
 
   public void testAngle() {
-     assertEquals(0.22572612855273393616, 
+     assertEquals(0.22572612855273393616,
                   Vector3D.angle(new Vector3D(1, 2, 3), new Vector3D(4, 5, 6)),
                   1.0e-12);
-     assertEquals(7.98595620686106654517199e-8, 
+     assertEquals(7.98595620686106654517199e-8,
                   Vector3D.angle(new Vector3D(1, 2, 3), new Vector3D(2, 4, 6.000001)),
                   1.0e-12);
-     assertEquals(3.14159257373023116985197793156, 
+     assertEquals(3.14159257373023116985197793156,
                   Vector3D.angle(new Vector3D(1, 2, 3), new Vector3D(-2, -4, -6.000001)),
                   1.0e-12);
      try {
@@ -227,7 +227,7 @@
       assertEquals(y, v.getY(), 1.0e-12);
       assertEquals(z, v.getZ(), 1.0e-12);
   }
-  
+
   public static Test suite() {
     return new TestSuite(Vector3DTest.class);
   }