Return-Path: Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: (qmail 3100 invoked from network); 1 Jul 2009 16:03:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 1 Jul 2009 16:03:53 -0000 Received: (qmail 69070 invoked by uid 500); 1 Jul 2009 16:04:03 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 68984 invoked by uid 500); 1 Jul 2009 16:04:03 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 68975 invoked by uid 99); 1 Jul 2009 16:04:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Jul 2009 16:04:03 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Jul 2009 16:03:51 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 56EAF23888C5; Wed, 1 Jul 2009 16:03:31 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r790243 - in /commons/proper/math/trunk: ./ src/java/org/apache/commons/math/genetics/ src/java/org/apache/commons/math/linear/ src/java/org/apache/commons/math/transform/ src/java/org/apache/commons/math/util/ src/test/org/apache/commons/m... Date: Wed, 01 Jul 2009 16:03:29 -0000 To: commits@commons.apache.org From: luc@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090701160331.56EAF23888C5@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: luc Date: Wed Jul 1 16:03:28 2009 New Revision: 790243 URL: http://svn.apache.org/viewvc?rev=790243&view=rev Log: fixed a number of warnings identified by findbugs eclipse plugin version 1.3.9 Modified: commons/proper/math/trunk/findbugs-exclude-filter.xml commons/proper/math/trunk/src/java/org/apache/commons/math/genetics/RandomKey.java commons/proper/math/trunk/src/java/org/apache/commons/math/genetics/RandomKeyMutation.java commons/proper/math/trunk/src/java/org/apache/commons/math/linear/SparseFieldVector.java commons/proper/math/trunk/src/java/org/apache/commons/math/transform/FastFourierTransformer.java commons/proper/math/trunk/src/java/org/apache/commons/math/util/ResizableDoubleArray.java commons/proper/math/trunk/src/test/org/apache/commons/math/estimation/LevenbergMarquardtEstimatorTest.java commons/proper/math/trunk/src/test/org/apache/commons/math/genetics/RandomKeyTest.java commons/proper/math/trunk/src/test/org/apache/commons/math/linear/BlockFieldMatrixTest.java commons/proper/math/trunk/src/test/org/apache/commons/math/linear/BlockRealMatrixTest.java commons/proper/math/trunk/src/test/org/apache/commons/math/linear/EigenDecompositionImplTest.java commons/proper/math/trunk/src/test/org/apache/commons/math/linear/FieldMatrixImplTest.java commons/proper/math/trunk/src/test/org/apache/commons/math/linear/SparseFieldMatrixTest.java commons/proper/math/trunk/src/test/org/apache/commons/math/linear/SparseRealMatrixTest.java commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem1.java commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem2.java commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem3.java commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem4.java commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem5.java commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem6.java commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblemAbstract.java commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/ClassicalRungeKuttaIntegratorTest.java commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/DormandPrince853IntegratorTest.java commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/EulerIntegratorTest.java commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/GillIntegratorTest.java commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/MidpointIntegratorTest.java commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/ThreeEighthesIntegratorTest.java commons/proper/math/trunk/src/test/org/apache/commons/math/ode/sampling/DummyStepInterpolatorTest.java commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/MultiStartMultivariateRealOptimizerTest.java commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/direct/NelderMeadTest.java commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizerTest.java commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizerTest.java commons/proper/math/trunk/src/test/org/apache/commons/math/stat/ranking/NaturalRankingTest.java commons/proper/math/trunk/src/test/org/apache/commons/math/util/MathUtilsTest.java Modified: commons/proper/math/trunk/findbugs-exclude-filter.xml URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/findbugs-exclude-filter.xml?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/findbugs-exclude-filter.xml (original) +++ commons/proper/math/trunk/findbugs-exclude-filter.xml Wed Jul 1 16:03:28 2009 @@ -43,6 +43,23 @@ + + + + + + + + + + + + + + + + + Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/genetics/RandomKey.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/genetics/RandomKey.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/java/org/apache/commons/math/genetics/RandomKey.java (original) +++ commons/proper/math/trunk/src/java/org/apache/commons/math/genetics/RandomKey.java Wed Jul 1 16:03:28 2009 @@ -148,7 +148,7 @@ @Override protected boolean isSame(Chromosome another) { // type check - if (! (another instanceof RandomKey)) + if (! (another instanceof RandomKey)) return false; RandomKey anotherRk = (RandomKey) another; // size check Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/genetics/RandomKeyMutation.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/genetics/RandomKeyMutation.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/java/org/apache/commons/math/genetics/RandomKeyMutation.java (original) +++ commons/proper/math/trunk/src/java/org/apache/commons/math/genetics/RandomKeyMutation.java Wed Jul 1 16:03:28 2009 @@ -37,7 +37,7 @@ * {@link RandomKey} instance */ public Chromosome mutate(Chromosome original) { - if (!(original instanceof RandomKey)) { + if (!(original instanceof RandomKey)) { throw MathRuntimeException.createIllegalArgumentException( "RandomKeyMutation works only with RandomKeys, got " + original.getClass().getSimpleName()); Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/SparseFieldVector.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/SparseFieldVector.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/SparseFieldVector.java (original) +++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/SparseFieldVector.java Wed Jul 1 16:03:28 2009 @@ -181,7 +181,7 @@ /** {@inheritDoc} */ public FieldVector append(FieldVector v) { - if (v instanceof SparseFieldVector) { + if (v instanceof SparseFieldVector) { return append((SparseFieldVector) v); } else { return append(v.toArray()); @@ -438,7 +438,7 @@ /** {@inheritDoc} */ public FieldMatrix outerProduct(FieldVector v) throws IllegalArgumentException { - if(v instanceof SparseFieldVector) + if(v instanceof SparseFieldVector) return outerProduct((SparseFieldVector)v); else return outerProduct(v.toArray()); @@ -513,7 +513,7 @@ /** {@inheritDoc} */ public FieldVector subtract(FieldVector v) throws IllegalArgumentException { - if(v instanceof SparseFieldVector) + if(v instanceof SparseFieldVector) return subtract((SparseFieldVector)v); else return subtract(v.toArray()); @@ -573,7 +573,7 @@ /** {@inheritDoc} */ public FieldVector add(FieldVector v) throws IllegalArgumentException { - if (v instanceof SparseFieldVector) { + if (v instanceof SparseFieldVector) { return add((SparseFieldVector)v); } else { return add(v.toArray()); Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/transform/FastFourierTransformer.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/transform/FastFourierTransformer.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/java/org/apache/commons/math/transform/FastFourierTransformer.java (original) +++ commons/proper/math/trunk/src/java/org/apache/commons/math/transform/FastFourierTransformer.java Wed Jul 1 16:03:28 2009 @@ -613,11 +613,8 @@ * http://jcp.org/en/jsr/detail?id=83 * may require additional exception throws for other basic requirements. */ - private class MultiDimensionalComplexMatrix - implements Serializable, Cloneable { - - /** Serializable version identifier. */ - private static final long serialVersionUID = 0x564FCD47EBA8169BL; + private static class MultiDimensionalComplexMatrix + implements Cloneable { /** Size in all dimensions. */ protected int[] dimensionSize; Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/util/ResizableDoubleArray.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/util/ResizableDoubleArray.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/java/org/apache/commons/math/util/ResizableDoubleArray.java (original) +++ commons/proper/math/trunk/src/java/org/apache/commons/math/util/ResizableDoubleArray.java Wed Jul 1 16:03:28 2009 @@ -338,20 +338,20 @@ * expansionCriteria * * @param expansionFactor factor to be checked - * @param contractionCritera criteria to be checked + * @param contractionCriteria criteria to be checked * @throws IllegalArgumentException if the contractionCriteria is less than * the expansionCriteria. */ protected void checkContractExpand( - float contractionCritera, + float contractionCriteria, float expansionFactor) { - if (contractionCritera < expansionFactor) { + if (contractionCriteria < expansionFactor) { throw MathRuntimeException.createIllegalArgumentException( "contraction criteria ({0}) smaller than the expansion factor ({1}). This would " + "lead to a never ending loop of expansion and contraction as a newly expanded " + "internal storage array would immediately satisfy the criteria for contraction", - contractionCritera, expansionFactor); + contractionCriteria, expansionFactor); } if (contractionCriteria <= 1.0) { @@ -365,7 +365,7 @@ if (expansionFactor <= 1.0) { throw MathRuntimeException.createIllegalArgumentException( "expansion factor smaller than one ({0})", - contractionCriteria); + expansionFactor); } } @@ -648,7 +648,9 @@ */ public void setContractionCriteria(float contractionCriteria) { checkContractExpand(contractionCriteria, getExpansionFactor()); - this.contractionCriteria = contractionCriteria; + synchronized(this) { + this.contractionCriteria = contractionCriteria; + } } @@ -693,7 +695,9 @@ public void setExpansionFactor(float expansionFactor) { checkContractExpand(getContractionCriteria(), expansionFactor); // The check above verifies that the expansion factor is > 1.0; - this.expansionFactor = expansionFactor; + synchronized(this) { + this.expansionFactor = expansionFactor; + } } /** @@ -711,7 +715,9 @@ expansionMode, MULTIPLICATIVE_MODE, "MULTIPLICATIVE_MODE", ADDITIVE_MODE, "ADDITIVE_MODE"); } - this.expansionMode = expansionMode; + synchronized(this) { + this.expansionMode = expansionMode; + } } /** @@ -876,17 +882,15 @@ * @since 2.0 */ @Override - public int hashCode() { + public synchronized int hashCode() { int[] hashData = new int[7]; hashData[0] = new Float(expansionFactor).hashCode(); hashData[1] = new Float(contractionCriteria).hashCode(); hashData[2] = expansionMode; - synchronized(this) { hashData[3] = Arrays.hashCode(internalArray); hashData[4] = initialCapacity; hashData[5] = numElements; hashData[6] = startIndex; - } return Arrays.hashCode(hashData); } Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/estimation/LevenbergMarquardtEstimatorTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/estimation/LevenbergMarquardtEstimatorTest.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/estimation/LevenbergMarquardtEstimatorTest.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/estimation/LevenbergMarquardtEstimatorTest.java Wed Jul 1 16:03:28 2009 @@ -793,18 +793,6 @@ addMeasurement(new LocalMeasurement(x, y, w)); } - public double getA() { - return a.getEstimate(); - } - - public double getB() { - return b.getEstimate(); - } - - public double getC() { - return c.getEstimate(); - } - public double theoreticalValue(double x) { return ( (a.getEstimate() * x + b.getEstimate() ) * x + c.getEstimate()); } Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/genetics/RandomKeyTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/genetics/RandomKeyTest.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/genetics/RandomKeyTest.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/genetics/RandomKeyTest.java Wed Jul 1 16:03:28 2009 @@ -28,14 +28,12 @@ @Test(expected=IllegalArgumentException.class) public void testConstructor1() { - @SuppressWarnings("unused") - DummyRandomKey drk = new DummyRandomKey(new Double[] {0.2, 0.3, 1.2}); + new DummyRandomKey(new Double[] {0.2, 0.3, 1.2}); } @Test(expected=IllegalArgumentException.class) public void testConstructor2() { - @SuppressWarnings("unused") - DummyRandomKey drk = new DummyRandomKey(new Double[] {0.2, 0.3, -0.2}); + new DummyRandomKey(new Double[] {0.2, 0.3, -0.2}); } @Test Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/linear/BlockFieldMatrixTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/linear/BlockFieldMatrixTest.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/linear/BlockFieldMatrixTest.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/linear/BlockFieldMatrixTest.java Wed Jul 1 16:03:28 2009 @@ -549,50 +549,50 @@ // test submatrix accessors public void testGetSubMatrix() { FieldMatrix m = new BlockFieldMatrix(subTestData); - checkGetSubMatrix(m, subRows23Cols00, 2 , 3 , 0, 0, false); - checkGetSubMatrix(m, subRows00Cols33, 0 , 0 , 3, 3, false); - checkGetSubMatrix(m, subRows01Cols23, 0 , 1 , 2, 3, false); - checkGetSubMatrix(m, subRows02Cols13, new int[] { 0, 2 }, new int[] { 1, 3 }, false); - checkGetSubMatrix(m, subRows03Cols12, new int[] { 0, 3 }, new int[] { 1, 2 }, false); - checkGetSubMatrix(m, subRows03Cols123, new int[] { 0, 3 }, new int[] { 1, 2, 3 }, false); - checkGetSubMatrix(m, subRows20Cols123, new int[] { 2, 0 }, new int[] { 1, 2, 3 }, false); - checkGetSubMatrix(m, subRows31Cols31, new int[] { 3, 1 }, new int[] { 3, 1 }, false); - checkGetSubMatrix(m, subRows31Cols31, new int[] { 3, 1 }, new int[] { 3, 1 }, false); - checkGetSubMatrix(m, null, 1, 0, 2, 4, true); - checkGetSubMatrix(m, null, -1, 1, 2, 2, true); - checkGetSubMatrix(m, null, 1, 0, 2, 2, true); - checkGetSubMatrix(m, null, 1, 0, 2, 4, true); - checkGetSubMatrix(m, null, new int[] {}, new int[] { 0 }, true); - checkGetSubMatrix(m, null, new int[] { 0 }, new int[] { 4 }, true); + checkGetSubMatrix(m, subRows23Cols00, 2 , 3 , 0, 0); + checkGetSubMatrix(m, subRows00Cols33, 0 , 0 , 3, 3); + checkGetSubMatrix(m, subRows01Cols23, 0 , 1 , 2, 3); + checkGetSubMatrix(m, subRows02Cols13, new int[] { 0, 2 }, new int[] { 1, 3 }); + checkGetSubMatrix(m, subRows03Cols12, new int[] { 0, 3 }, new int[] { 1, 2 }); + checkGetSubMatrix(m, subRows03Cols123, new int[] { 0, 3 }, new int[] { 1, 2, 3 }); + checkGetSubMatrix(m, subRows20Cols123, new int[] { 2, 0 }, new int[] { 1, 2, 3 }); + checkGetSubMatrix(m, subRows31Cols31, new int[] { 3, 1 }, new int[] { 3, 1 }); + checkGetSubMatrix(m, subRows31Cols31, new int[] { 3, 1 }, new int[] { 3, 1 }); + checkGetSubMatrix(m, null, 1, 0, 2, 4); + checkGetSubMatrix(m, null, -1, 1, 2, 2); + checkGetSubMatrix(m, null, 1, 0, 2, 2); + checkGetSubMatrix(m, null, 1, 0, 2, 4); + checkGetSubMatrix(m, null, new int[] {}, new int[] { 0 }); + checkGetSubMatrix(m, null, new int[] { 0 }, new int[] { 4 }); } private void checkGetSubMatrix(FieldMatrix m, Fraction[][] reference, - int startRow, int endRow, int startColumn, int endColumn, - boolean mustFail) { + int startRow, int endRow, int startColumn, int endColumn) { try { FieldMatrix sub = m.getSubMatrix(startRow, endRow, startColumn, endColumn); - assertEquals(new BlockFieldMatrix(reference), sub); - if (mustFail) { + if (reference != null) { + assertEquals(new BlockFieldMatrix(reference), sub); + } else { fail("Expecting MatrixIndexException"); } } catch (MatrixIndexException e) { - if (!mustFail) { + if (reference != null) { throw e; } } } private void checkGetSubMatrix(FieldMatrix m, Fraction[][] reference, - int[] selectedRows, int[] selectedColumns, - boolean mustFail) { + int[] selectedRows, int[] selectedColumns) { try { FieldMatrix sub = m.getSubMatrix(selectedRows, selectedColumns); - assertEquals(new BlockFieldMatrix(reference), sub); - if (mustFail) { - fail("Expecting MatrixIndexException"); + if (reference != null) { + assertEquals(new BlockFieldMatrix(reference), sub); + } else { + fail("Expecting MatrixIndexException"); } } catch (MatrixIndexException e) { - if (!mustFail) { + if (reference != null) { throw e; } } @@ -621,57 +621,57 @@ public void testCopySubMatrix() { FieldMatrix m = new BlockFieldMatrix(subTestData); - checkCopy(m, subRows23Cols00, 2 , 3 , 0, 0, false); - checkCopy(m, subRows00Cols33, 0 , 0 , 3, 3, false); - checkCopy(m, subRows01Cols23, 0 , 1 , 2, 3, false); - checkCopy(m, subRows02Cols13, new int[] { 0, 2 }, new int[] { 1, 3 }, false); - checkCopy(m, subRows03Cols12, new int[] { 0, 3 }, new int[] { 1, 2 }, false); - checkCopy(m, subRows03Cols123, new int[] { 0, 3 }, new int[] { 1, 2, 3 }, false); - checkCopy(m, subRows20Cols123, new int[] { 2, 0 }, new int[] { 1, 2, 3 }, false); - checkCopy(m, subRows31Cols31, new int[] { 3, 1 }, new int[] { 3, 1 }, false); - checkCopy(m, subRows31Cols31, new int[] { 3, 1 }, new int[] { 3, 1 }, false); + checkCopy(m, subRows23Cols00, 2 , 3 , 0, 0); + checkCopy(m, subRows00Cols33, 0 , 0 , 3, 3); + checkCopy(m, subRows01Cols23, 0 , 1 , 2, 3); + checkCopy(m, subRows02Cols13, new int[] { 0, 2 }, new int[] { 1, 3 }); + checkCopy(m, subRows03Cols12, new int[] { 0, 3 }, new int[] { 1, 2 }); + checkCopy(m, subRows03Cols123, new int[] { 0, 3 }, new int[] { 1, 2, 3 }); + checkCopy(m, subRows20Cols123, new int[] { 2, 0 }, new int[] { 1, 2, 3 }); + checkCopy(m, subRows31Cols31, new int[] { 3, 1 }, new int[] { 3, 1 }); + checkCopy(m, subRows31Cols31, new int[] { 3, 1 }, new int[] { 3, 1 }); - checkCopy(m, null, 1, 0, 2, 4, true); - checkCopy(m, null, -1, 1, 2, 2, true); - checkCopy(m, null, 1, 0, 2, 2, true); - checkCopy(m, null, 1, 0, 2, 4, true); - checkCopy(m, null, new int[] {}, new int[] { 0 }, true); - checkCopy(m, null, new int[] { 0 }, new int[] { 4 }, true); + checkCopy(m, null, 1, 0, 2, 4); + checkCopy(m, null, -1, 1, 2, 2); + checkCopy(m, null, 1, 0, 2, 2); + checkCopy(m, null, 1, 0, 2, 4); + checkCopy(m, null, new int[] {}, new int[] { 0 }); + checkCopy(m, null, new int[] { 0 }, new int[] { 4 }); } private void checkCopy(FieldMatrix m, Fraction[][] reference, - int startRow, int endRow, int startColumn, int endColumn, - boolean mustFail) { + int startRow, int endRow, int startColumn, int endColumn) { try { Fraction[][] sub = (reference == null) ? new Fraction[1][1] : new Fraction[reference.length][reference[0].length]; m.copySubMatrix(startRow, endRow, startColumn, endColumn, sub); - assertEquals(new BlockFieldMatrix(reference), new BlockFieldMatrix(sub)); - if (mustFail) { - fail("Expecting MatrixIndexException"); + if (reference != null) { + assertEquals(new BlockFieldMatrix(reference), new BlockFieldMatrix(sub)); + } else { + fail("Expecting MatrixIndexException"); } } catch (MatrixIndexException e) { - if (!mustFail) { + if (reference != null) { throw e; } } } private void checkCopy(FieldMatrix m, Fraction[][] reference, - int[] selectedRows, int[] selectedColumns, - boolean mustFail) { + int[] selectedRows, int[] selectedColumns) { try { Fraction[][] sub = (reference == null) ? new Fraction[1][1] : new Fraction[reference.length][reference[0].length]; m.copySubMatrix(selectedRows, selectedColumns, sub); - assertEquals(new BlockFieldMatrix(reference), new BlockFieldMatrix(sub)); - if (mustFail) { - fail("Expecting MatrixIndexException"); + if (reference != null) { + assertEquals(new BlockFieldMatrix(reference), new BlockFieldMatrix(sub)); + } else { + fail("Expecting MatrixIndexException"); } } catch (MatrixIndexException e) { - if (!mustFail) { + if (reference != null) { throw e; } } Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/linear/BlockRealMatrixTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/linear/BlockRealMatrixTest.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/linear/BlockRealMatrixTest.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/linear/BlockRealMatrixTest.java Wed Jul 1 16:03:28 2009 @@ -476,50 +476,50 @@ // test submatrix accessors public void testGetSubMatrix() { RealMatrix m = new BlockRealMatrix(subTestData); - checkGetSubMatrix(m, subRows23Cols00, 2 , 3 , 0, 0, false); - checkGetSubMatrix(m, subRows00Cols33, 0 , 0 , 3, 3, false); - checkGetSubMatrix(m, subRows01Cols23, 0 , 1 , 2, 3, false); - checkGetSubMatrix(m, subRows02Cols13, new int[] { 0, 2 }, new int[] { 1, 3 }, false); - checkGetSubMatrix(m, subRows03Cols12, new int[] { 0, 3 }, new int[] { 1, 2 }, false); - checkGetSubMatrix(m, subRows03Cols123, new int[] { 0, 3 }, new int[] { 1, 2, 3 }, false); - checkGetSubMatrix(m, subRows20Cols123, new int[] { 2, 0 }, new int[] { 1, 2, 3 }, false); - checkGetSubMatrix(m, subRows31Cols31, new int[] { 3, 1 }, new int[] { 3, 1 }, false); - checkGetSubMatrix(m, subRows31Cols31, new int[] { 3, 1 }, new int[] { 3, 1 }, false); - checkGetSubMatrix(m, null, 1, 0, 2, 4, true); - checkGetSubMatrix(m, null, -1, 1, 2, 2, true); - checkGetSubMatrix(m, null, 1, 0, 2, 2, true); - checkGetSubMatrix(m, null, 1, 0, 2, 4, true); - checkGetSubMatrix(m, null, new int[] {}, new int[] { 0 }, true); - checkGetSubMatrix(m, null, new int[] { 0 }, new int[] { 4 }, true); + checkGetSubMatrix(m, subRows23Cols00, 2 , 3 , 0, 0); + checkGetSubMatrix(m, subRows00Cols33, 0 , 0 , 3, 3); + checkGetSubMatrix(m, subRows01Cols23, 0 , 1 , 2, 3); + checkGetSubMatrix(m, subRows02Cols13, new int[] { 0, 2 }, new int[] { 1, 3 }); + checkGetSubMatrix(m, subRows03Cols12, new int[] { 0, 3 }, new int[] { 1, 2 }); + checkGetSubMatrix(m, subRows03Cols123, new int[] { 0, 3 }, new int[] { 1, 2, 3 }); + checkGetSubMatrix(m, subRows20Cols123, new int[] { 2, 0 }, new int[] { 1, 2, 3 }); + checkGetSubMatrix(m, subRows31Cols31, new int[] { 3, 1 }, new int[] { 3, 1 }); + checkGetSubMatrix(m, subRows31Cols31, new int[] { 3, 1 }, new int[] { 3, 1 }); + checkGetSubMatrix(m, null, 1, 0, 2, 4); + checkGetSubMatrix(m, null, -1, 1, 2, 2); + checkGetSubMatrix(m, null, 1, 0, 2, 2); + checkGetSubMatrix(m, null, 1, 0, 2, 4); + checkGetSubMatrix(m, null, new int[] {}, new int[] { 0 }); + checkGetSubMatrix(m, null, new int[] { 0 }, new int[] { 4 }); } private void checkGetSubMatrix(RealMatrix m, double[][] reference, - int startRow, int endRow, int startColumn, int endColumn, - boolean mustFail) { + int startRow, int endRow, int startColumn, int endColumn) { try { RealMatrix sub = m.getSubMatrix(startRow, endRow, startColumn, endColumn); - assertEquals(new BlockRealMatrix(reference), sub); - if (mustFail) { - fail("Expecting MatrixIndexException"); + if (reference != null) { + assertEquals(new BlockRealMatrix(reference), sub); + } else { + fail("Expecting MatrixIndexException"); } } catch (MatrixIndexException e) { - if (!mustFail) { + if (reference != null) { throw e; } } } private void checkGetSubMatrix(RealMatrix m, double[][] reference, - int[] selectedRows, int[] selectedColumns, - boolean mustFail) { + int[] selectedRows, int[] selectedColumns) { try { RealMatrix sub = m.getSubMatrix(selectedRows, selectedColumns); - assertEquals(new BlockRealMatrix(reference), sub); - if (mustFail) { - fail("Expecting MatrixIndexException"); + if (reference != null) { + assertEquals(new BlockRealMatrix(reference), sub); + } else { + fail("Expecting MatrixIndexException"); } } catch (MatrixIndexException e) { - if (!mustFail) { + if (reference != null) { throw e; } } @@ -546,57 +546,57 @@ public void testCopySubMatrix() { RealMatrix m = new BlockRealMatrix(subTestData); - checkCopy(m, subRows23Cols00, 2 , 3 , 0, 0, false); - checkCopy(m, subRows00Cols33, 0 , 0 , 3, 3, false); - checkCopy(m, subRows01Cols23, 0 , 1 , 2, 3, false); - checkCopy(m, subRows02Cols13, new int[] { 0, 2 }, new int[] { 1, 3 }, false); - checkCopy(m, subRows03Cols12, new int[] { 0, 3 }, new int[] { 1, 2 }, false); - checkCopy(m, subRows03Cols123, new int[] { 0, 3 }, new int[] { 1, 2, 3 }, false); - checkCopy(m, subRows20Cols123, new int[] { 2, 0 }, new int[] { 1, 2, 3 }, false); - checkCopy(m, subRows31Cols31, new int[] { 3, 1 }, new int[] { 3, 1 }, false); - checkCopy(m, subRows31Cols31, new int[] { 3, 1 }, new int[] { 3, 1 }, false); + checkCopy(m, subRows23Cols00, 2 , 3 , 0, 0); + checkCopy(m, subRows00Cols33, 0 , 0 , 3, 3); + checkCopy(m, subRows01Cols23, 0 , 1 , 2, 3); + checkCopy(m, subRows02Cols13, new int[] { 0, 2 }, new int[] { 1, 3 }); + checkCopy(m, subRows03Cols12, new int[] { 0, 3 }, new int[] { 1, 2 }); + checkCopy(m, subRows03Cols123, new int[] { 0, 3 }, new int[] { 1, 2, 3 }); + checkCopy(m, subRows20Cols123, new int[] { 2, 0 }, new int[] { 1, 2, 3 }); + checkCopy(m, subRows31Cols31, new int[] { 3, 1 }, new int[] { 3, 1 }); + checkCopy(m, subRows31Cols31, new int[] { 3, 1 }, new int[] { 3, 1 }); - checkCopy(m, null, 1, 0, 2, 4, true); - checkCopy(m, null, -1, 1, 2, 2, true); - checkCopy(m, null, 1, 0, 2, 2, true); - checkCopy(m, null, 1, 0, 2, 4, true); - checkCopy(m, null, new int[] {}, new int[] { 0 }, true); - checkCopy(m, null, new int[] { 0 }, new int[] { 4 }, true); + checkCopy(m, null, 1, 0, 2, 4); + checkCopy(m, null, -1, 1, 2, 2); + checkCopy(m, null, 1, 0, 2, 2); + checkCopy(m, null, 1, 0, 2, 4); + checkCopy(m, null, new int[] {}, new int[] { 0 }); + checkCopy(m, null, new int[] { 0 }, new int[] { 4 }); } private void checkCopy(RealMatrix m, double[][] reference, - int startRow, int endRow, int startColumn, int endColumn, - boolean mustFail) { + int startRow, int endRow, int startColumn, int endColumn) { try { double[][] sub = (reference == null) ? new double[1][1] : new double[reference.length][reference[0].length]; m.copySubMatrix(startRow, endRow, startColumn, endColumn, sub); - assertEquals(new BlockRealMatrix(reference), new BlockRealMatrix(sub)); - if (mustFail) { - fail("Expecting MatrixIndexException"); + if (reference != null) { + assertEquals(new BlockRealMatrix(reference), new BlockRealMatrix(sub)); + } else { + fail("Expecting MatrixIndexException"); } } catch (MatrixIndexException e) { - if (!mustFail) { + if (reference != null) { throw e; } } } private void checkCopy(RealMatrix m, double[][] reference, - int[] selectedRows, int[] selectedColumns, - boolean mustFail) { + int[] selectedRows, int[] selectedColumns) { try { double[][] sub = (reference == null) ? new double[1][1] : new double[reference.length][reference[0].length]; m.copySubMatrix(selectedRows, selectedColumns, sub); - assertEquals(new BlockRealMatrix(reference), new BlockRealMatrix(sub)); - if (mustFail) { - fail("Expecting MatrixIndexException"); + if (reference != null) { + assertEquals(new BlockRealMatrix(reference), new BlockRealMatrix(sub)); + } else { + fail("Expecting MatrixIndexException"); } } catch (MatrixIndexException e) { - if (!mustFail) { + if (reference != null) { throw e; } } Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/linear/EigenDecompositionImplTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/linear/EigenDecompositionImplTest.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/linear/EigenDecompositionImplTest.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/linear/EigenDecompositionImplTest.java Wed Jul 1 16:03:28 2009 @@ -293,13 +293,13 @@ boolean found = false; int i = 0; while (!found && i < searchMatrix.getColumnDimension()) { - double multiplier = 1d; + double multiplier = 1.0; boolean matching = true; int j = 0; while (matching && j < searchMatrix.getRowDimension()) { double colEntry = searchMatrix.getEntry(j, i); // Use the first entry where both are non-zero as scalar - if (multiplier == 1d && Math.abs(colEntry) > 1E-14 + if (Math.abs(multiplier - 1.0) <= Math.ulp(1.0) && Math.abs(colEntry) > 1E-14 && Math.abs(column[j]) > 1e-14) { multiplier = colEntry / column[j]; } Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/linear/FieldMatrixImplTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/linear/FieldMatrixImplTest.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/linear/FieldMatrixImplTest.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/linear/FieldMatrixImplTest.java Wed Jul 1 16:03:28 2009 @@ -363,50 +363,50 @@ // test submatrix accessors public void testGetSubMatrix() { FieldMatrix m = new Array2DRowFieldMatrix(subTestData); - checkGetSubMatrix(m, subRows23Cols00, 2 , 3 , 0, 0, false); - checkGetSubMatrix(m, subRows00Cols33, 0 , 0 , 3, 3, false); - checkGetSubMatrix(m, subRows01Cols23, 0 , 1 , 2, 3, false); - checkGetSubMatrix(m, subRows02Cols13, new int[] { 0, 2 }, new int[] { 1, 3 }, false); - checkGetSubMatrix(m, subRows03Cols12, new int[] { 0, 3 }, new int[] { 1, 2 }, false); - checkGetSubMatrix(m, subRows03Cols123, new int[] { 0, 3 }, new int[] { 1, 2, 3 }, false); - checkGetSubMatrix(m, subRows20Cols123, new int[] { 2, 0 }, new int[] { 1, 2, 3 }, false); - checkGetSubMatrix(m, subRows31Cols31, new int[] { 3, 1 }, new int[] { 3, 1 }, false); - checkGetSubMatrix(m, subRows31Cols31, new int[] { 3, 1 }, new int[] { 3, 1 }, false); - checkGetSubMatrix(m, null, 1, 0, 2, 4, true); - checkGetSubMatrix(m, null, -1, 1, 2, 2, true); - checkGetSubMatrix(m, null, 1, 0, 2, 2, true); - checkGetSubMatrix(m, null, 1, 0, 2, 4, true); - checkGetSubMatrix(m, null, new int[] {}, new int[] { 0 }, true); - checkGetSubMatrix(m, null, new int[] { 0 }, new int[] { 4 }, true); + checkGetSubMatrix(m, subRows23Cols00, 2 , 3 , 0, 0); + checkGetSubMatrix(m, subRows00Cols33, 0 , 0 , 3, 3); + checkGetSubMatrix(m, subRows01Cols23, 0 , 1 , 2, 3); + checkGetSubMatrix(m, subRows02Cols13, new int[] { 0, 2 }, new int[] { 1, 3 }); + checkGetSubMatrix(m, subRows03Cols12, new int[] { 0, 3 }, new int[] { 1, 2 }); + checkGetSubMatrix(m, subRows03Cols123, new int[] { 0, 3 }, new int[] { 1, 2, 3 }); + checkGetSubMatrix(m, subRows20Cols123, new int[] { 2, 0 }, new int[] { 1, 2, 3 }); + checkGetSubMatrix(m, subRows31Cols31, new int[] { 3, 1 }, new int[] { 3, 1 }); + checkGetSubMatrix(m, subRows31Cols31, new int[] { 3, 1 }, new int[] { 3, 1 }); + checkGetSubMatrix(m, null, 1, 0, 2, 4); + checkGetSubMatrix(m, null, -1, 1, 2, 2); + checkGetSubMatrix(m, null, 1, 0, 2, 2); + checkGetSubMatrix(m, null, 1, 0, 2, 4); + checkGetSubMatrix(m, null, new int[] {}, new int[] { 0 }); + checkGetSubMatrix(m, null, new int[] { 0 }, new int[] { 4 }); } private void checkGetSubMatrix(FieldMatrix m, Fraction[][] reference, - int startRow, int endRow, int startColumn, int endColumn, - boolean mustFail) { + int startRow, int endRow, int startColumn, int endColumn) { try { FieldMatrix sub = m.getSubMatrix(startRow, endRow, startColumn, endColumn); - assertEquals(new Array2DRowFieldMatrix(reference), sub); - if (mustFail) { - fail("Expecting MatrixIndexException"); + if (reference != null) { + assertEquals(new Array2DRowFieldMatrix(reference), sub); + } else { + fail("Expecting MatrixIndexException"); } } catch (MatrixIndexException e) { - if (!mustFail) { + if (reference != null) { throw e; } } } private void checkGetSubMatrix(FieldMatrix m, Fraction[][] reference, - int[] selectedRows, int[] selectedColumns, - boolean mustFail) { + int[] selectedRows, int[] selectedColumns) { try { FieldMatrix sub = m.getSubMatrix(selectedRows, selectedColumns); - assertEquals(new Array2DRowFieldMatrix(reference), sub); - if (mustFail) { - fail("Expecting MatrixIndexException"); + if (reference != null) { + assertEquals(new Array2DRowFieldMatrix(reference), sub); + } else { + fail("Expecting MatrixIndexException"); } } catch (MatrixIndexException e) { - if (!mustFail) { + if (reference != null) { throw e; } } @@ -414,57 +414,57 @@ public void testCopySubMatrix() { FieldMatrix m = new Array2DRowFieldMatrix(subTestData); - checkCopy(m, subRows23Cols00, 2 , 3 , 0, 0, false); - checkCopy(m, subRows00Cols33, 0 , 0 , 3, 3, false); - checkCopy(m, subRows01Cols23, 0 , 1 , 2, 3, false); - checkCopy(m, subRows02Cols13, new int[] { 0, 2 }, new int[] { 1, 3 }, false); - checkCopy(m, subRows03Cols12, new int[] { 0, 3 }, new int[] { 1, 2 }, false); - checkCopy(m, subRows03Cols123, new int[] { 0, 3 }, new int[] { 1, 2, 3 }, false); - checkCopy(m, subRows20Cols123, new int[] { 2, 0 }, new int[] { 1, 2, 3 }, false); - checkCopy(m, subRows31Cols31, new int[] { 3, 1 }, new int[] { 3, 1 }, false); - checkCopy(m, subRows31Cols31, new int[] { 3, 1 }, new int[] { 3, 1 }, false); + checkCopy(m, subRows23Cols00, 2 , 3 , 0, 0); + checkCopy(m, subRows00Cols33, 0 , 0 , 3, 3); + checkCopy(m, subRows01Cols23, 0 , 1 , 2, 3); + checkCopy(m, subRows02Cols13, new int[] { 0, 2 }, new int[] { 1, 3 }); + checkCopy(m, subRows03Cols12, new int[] { 0, 3 }, new int[] { 1, 2 }); + checkCopy(m, subRows03Cols123, new int[] { 0, 3 }, new int[] { 1, 2, 3 }); + checkCopy(m, subRows20Cols123, new int[] { 2, 0 }, new int[] { 1, 2, 3 }); + checkCopy(m, subRows31Cols31, new int[] { 3, 1 }, new int[] { 3, 1 }); + checkCopy(m, subRows31Cols31, new int[] { 3, 1 }, new int[] { 3, 1 }); - checkCopy(m, null, 1, 0, 2, 4, true); - checkCopy(m, null, -1, 1, 2, 2, true); - checkCopy(m, null, 1, 0, 2, 2, true); - checkCopy(m, null, 1, 0, 2, 4, true); - checkCopy(m, null, new int[] {}, new int[] { 0 }, true); - checkCopy(m, null, new int[] { 0 }, new int[] { 4 }, true); + checkCopy(m, null, 1, 0, 2, 4); + checkCopy(m, null, -1, 1, 2, 2); + checkCopy(m, null, 1, 0, 2, 2); + checkCopy(m, null, 1, 0, 2, 4); + checkCopy(m, null, new int[] {}, new int[] { 0 }); + checkCopy(m, null, new int[] { 0 }, new int[] { 4 }); } private void checkCopy(FieldMatrix m, Fraction[][] reference, - int startRow, int endRow, int startColumn, int endColumn, - boolean mustFail) { + int startRow, int endRow, int startColumn, int endColumn) { try { Fraction[][] sub = (reference == null) ? new Fraction[1][1] : new Fraction[reference.length][reference[0].length]; m.copySubMatrix(startRow, endRow, startColumn, endColumn, sub); - assertEquals(new Array2DRowFieldMatrix(reference), new Array2DRowFieldMatrix(sub)); - if (mustFail) { - fail("Expecting MatrixIndexException"); + if (reference != null) { + assertEquals(new Array2DRowFieldMatrix(reference), new Array2DRowFieldMatrix(sub)); + } else { + fail("Expecting MatrixIndexException"); } } catch (MatrixIndexException e) { - if (!mustFail) { + if (reference != null) { throw e; } } } private void checkCopy(FieldMatrix m, Fraction[][] reference, - int[] selectedRows, int[] selectedColumns, - boolean mustFail) { + int[] selectedRows, int[] selectedColumns) { try { Fraction[][] sub = (reference == null) ? new Fraction[1][1] : new Fraction[reference.length][reference[0].length]; m.copySubMatrix(selectedRows, selectedColumns, sub); - assertEquals(new Array2DRowFieldMatrix(reference), new Array2DRowFieldMatrix(sub)); - if (mustFail) { - fail("Expecting MatrixIndexException"); + if (reference != null) { + assertEquals(new Array2DRowFieldMatrix(reference), new Array2DRowFieldMatrix(sub)); + } else { + fail("Expecting MatrixIndexException"); } } catch (MatrixIndexException e) { - if (!mustFail) { + if (reference != null) { throw e; } } Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/linear/SparseFieldMatrixTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/linear/SparseFieldMatrixTest.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/linear/SparseFieldMatrixTest.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/linear/SparseFieldMatrixTest.java Wed Jul 1 16:03:28 2009 @@ -149,11 +149,11 @@ public void testCopyFunctions() { SparseFieldMatrix m1 = createSparseMatrix(testData); FieldMatrix m2 = m1.copy(); - assertTrue(m2 instanceof SparseFieldMatrix); + assertEquals(m1.getClass(), m2.getClass()); assertEquals((m2), m1); SparseFieldMatrix m3 = createSparseMatrix(testData); FieldMatrix m4 = m3.copy(); - assertTrue(m4 instanceof SparseFieldMatrix); + assertEquals(m3.getClass(), m4.getClass()); assertEquals((m4), m3); } Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/linear/SparseRealMatrixTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/linear/SparseRealMatrixTest.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/linear/SparseRealMatrixTest.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/linear/SparseRealMatrixTest.java Wed Jul 1 16:03:28 2009 @@ -130,11 +130,11 @@ public void testCopyFunctions() { OpenMapRealMatrix m1 = createSparseMatrix(testData); RealMatrix m2 = m1.copy(); - assertTrue(m2 instanceof OpenMapRealMatrix); + assertEquals(m1.getClass(), m2.getClass()); assertEquals((m2), m1); OpenMapRealMatrix m3 = createSparseMatrix(testData); RealMatrix m4 = m3.copy(); - assertTrue(m4 instanceof OpenMapRealMatrix); + assertEquals(m3.getClass(), m4.getClass()); assertEquals((m4), m3); } Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem1.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem1.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem1.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem1.java Wed Jul 1 16:03:28 2009 @@ -62,12 +62,8 @@ y = problem.y.clone(); } - /** - * Clone operation. - * @return a copy of the instance - */ - @Override - public Object clone() { + /** {@inheritDoc} */ + public TestProblem1 copy() { return new TestProblem1(this); } Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem2.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem2.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem2.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem2.java Wed Jul 1 16:03:28 2009 @@ -63,12 +63,8 @@ y = problem.y.clone(); } - /** - * Clone operation. - * @return a copy of the instance - */ - @Override - public Object clone() { + /** {@inheritDoc} */ + public TestProblem2 copy() { return new TestProblem2(this); } Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem3.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem3.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem3.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem3.java Wed Jul 1 16:03:28 2009 @@ -78,12 +78,8 @@ y = problem.y.clone(); } - /** - * Clone operation. - * @return a copy of the instance - */ - @Override - public Object clone() { + /** {@inheritDoc} */ + public TestProblem3 copy() { return new TestProblem3(this); } Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem4.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem4.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem4.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem4.java Wed Jul 1 16:03:28 2009 @@ -68,12 +68,8 @@ y = problem.y.clone(); } - /** - * Clone operation. - * @return a copy of the instance - */ - @Override - public Object clone() { + /** {@inheritDoc} */ + public TestProblem4 copy() { return new TestProblem4(this); } Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem5.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem5.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem5.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem5.java Wed Jul 1 16:03:28 2009 @@ -35,5 +35,9 @@ super(); setFinalConditions(2 * t0 - t1); } - + + /** {@inheritDoc} */ + public TestProblem5 copy() { + return new TestProblem5(); + } } Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem6.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem6.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem6.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem6.java Wed Jul 1 16:03:28 2009 @@ -63,13 +63,9 @@ y = problem.y.clone(); } - /** - * Clone operation. - * @return a copy of the instance - */ - @Override - public Object clone() { - return new TestProblem6(this); + /** {@inheritDoc} */ + public TestProblem6 copy() { + return new TestProblem6(this); } @Override Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblemAbstract.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblemAbstract.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblemAbstract.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblemAbstract.java Wed Jul 1 16:03:28 2009 @@ -25,7 +25,7 @@ * integrated during the junit tests for the ODE integrators. */ public abstract class TestProblemAbstract - implements FirstOrderDifferentialEquations, Cloneable { + implements FirstOrderDifferentialEquations { /** Serializable version identifier. */ private static final long serialVersionUID = -8521928974502839379L; @@ -82,11 +82,10 @@ } /** - * Clone operation. + * Copy operation. * @return a copy of the instance */ - @Override - public abstract Object clone(); + public abstract TestProblemAbstract copy(); /** * Set the initial conditions Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/ClassicalRungeKuttaIntegratorTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/ClassicalRungeKuttaIntegratorTest.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/ClassicalRungeKuttaIntegratorTest.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/ClassicalRungeKuttaIntegratorTest.java Wed Jul 1 16:03:28 2009 @@ -83,7 +83,7 @@ double previousError = Double.NaN; for (int i = 4; i < 10; ++i) { - TestProblemAbstract pb = (TestProblemAbstract) problems[k].clone(); + TestProblemAbstract pb = problems[k].copy(); double step = (pb.getFinalTime() - pb.getInitialTime()) * Math.pow(2.0, -i); FirstOrderIntegrator integ = new ClassicalRungeKuttaIntegrator(step); Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/DormandPrince853IntegratorTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/DormandPrince853IntegratorTest.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/DormandPrince853IntegratorTest.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/DormandPrince853IntegratorTest.java Wed Jul 1 16:03:28 2009 @@ -230,7 +230,7 @@ public void testNoDenseOutput() throws DerivativeException, IntegratorException { TestProblem1 pb1 = new TestProblem1(); - TestProblem1 pb2 = (TestProblem1) pb1.clone(); + TestProblem1 pb2 = pb1.copy(); double minStep = 0.1 * (pb1.getFinalTime() - pb1.getInitialTime()); double maxStep = pb1.getFinalTime() - pb1.getInitialTime(); double scalAbsoluteTolerance = 1.0e-4; Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/EulerIntegratorTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/EulerIntegratorTest.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/EulerIntegratorTest.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/EulerIntegratorTest.java Wed Jul 1 16:03:28 2009 @@ -62,7 +62,7 @@ double previousError = Double.NaN; for (int i = 4; i < 10; ++i) { - TestProblemAbstract pb = (TestProblemAbstract) problems[k].clone(); + TestProblemAbstract pb = problems[k].copy(); double step = (pb.getFinalTime() - pb.getInitialTime()) * Math.pow(2.0, -i); Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/GillIntegratorTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/GillIntegratorTest.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/GillIntegratorTest.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/GillIntegratorTest.java Wed Jul 1 16:03:28 2009 @@ -63,7 +63,7 @@ double previousError = Double.NaN; for (int i = 5; i < 10; ++i) { - TestProblemAbstract pb = (TestProblemAbstract) problems[k].clone(); + TestProblemAbstract pb = problems[k].copy(); double step = (pb.getFinalTime() - pb.getInitialTime()) * Math.pow(2.0, -i); Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/MidpointIntegratorTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/MidpointIntegratorTest.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/MidpointIntegratorTest.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/MidpointIntegratorTest.java Wed Jul 1 16:03:28 2009 @@ -62,7 +62,7 @@ double previousError = Double.NaN; for (int i = 4; i < 10; ++i) { - TestProblemAbstract pb = (TestProblemAbstract) problems[k].clone(); + TestProblemAbstract pb = problems[k].copy(); double step = (pb.getFinalTime() - pb.getInitialTime()) * Math.pow(2.0, -i); FirstOrderIntegrator integ = new MidpointIntegrator(step); Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/ThreeEighthesIntegratorTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/ThreeEighthesIntegratorTest.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/ThreeEighthesIntegratorTest.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/ThreeEighthesIntegratorTest.java Wed Jul 1 16:03:28 2009 @@ -63,7 +63,7 @@ double previousError = Double.NaN; for (int i = 4; i < 10; ++i) { - TestProblemAbstract pb = (TestProblemAbstract) problems[k].clone(); + TestProblemAbstract pb = problems[k].copy(); double step = (pb.getFinalTime() - pb.getInitialTime()) * Math.pow(2.0, -i); Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/ode/sampling/DummyStepInterpolatorTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/ode/sampling/DummyStepInterpolatorTest.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/ode/sampling/DummyStepInterpolatorTest.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/ode/sampling/DummyStepInterpolatorTest.java Wed Jul 1 16:03:28 2009 @@ -128,15 +128,15 @@ } private static class BadStepInterpolator extends DummyStepInterpolator { - public BadStepInterpolator() { - super(); - } - public BadStepInterpolator(double[] y, boolean forward) { - super(y, forward); - } - @Override - protected void doFinalize() - throws DerivativeException { + @SuppressWarnings("unused") + public BadStepInterpolator() { + } + public BadStepInterpolator(double[] y, boolean forward) { + super(y, forward); + } + @Override + protected void doFinalize() + throws DerivativeException { throw new DerivativeException(null); } } Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/MultiStartMultivariateRealOptimizerTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/MultiStartMultivariateRealOptimizerTest.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/MultiStartMultivariateRealOptimizerTest.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/MultiStartMultivariateRealOptimizerTest.java Wed Jul 1 16:03:28 2009 @@ -59,7 +59,7 @@ } - private class Rosenbrock implements MultivariateRealFunction { + private static class Rosenbrock implements MultivariateRealFunction { private int count; Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/direct/NelderMeadTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/direct/NelderMeadTest.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/direct/NelderMeadTest.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/direct/NelderMeadTest.java Wed Jul 1 16:03:28 2009 @@ -204,7 +204,7 @@ } } - private class Rosenbrock implements MultivariateRealFunction { + private static class Rosenbrock implements MultivariateRealFunction { private int count; @@ -225,7 +225,7 @@ } - private class Powell implements MultivariateRealFunction { + private static class Powell implements MultivariateRealFunction { private int count; Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizerTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizerTest.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizerTest.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizerTest.java Wed Jul 1 16:03:28 2009 @@ -434,8 +434,7 @@ Arrays.fill(target, 0.0); double[] weights = new double[circle.getN()]; Arrays.fill(weights, 2.0); - optimum = - optimizer.optimize(circle, target, weights, new double[] { 98.680, 47.345 }); + optimizer.optimize(circle, target, weights, new double[] { 98.680, 47.345 }); cov = optimizer.getCovariances(); assertEquals(0.0016, cov[0][0], 0.001); assertEquals(3.2e-7, cov[0][1], 1.0e-9); Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizerTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizerTest.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizerTest.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizerTest.java Wed Jul 1 16:03:28 2009 @@ -429,10 +429,6 @@ points.add(new Point2D.Double(px, py)); } - public int getN() { - return points.size(); - } - public double getRadius(Point2D.Double center) { double r = 0; for (Point2D.Double point : points) { Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/stat/ranking/NaturalRankingTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/stat/ranking/NaturalRankingTest.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/stat/ranking/NaturalRankingTest.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/stat/ranking/NaturalRankingTest.java Wed Jul 1 16:03:28 2009 @@ -199,5 +199,6 @@ ranking = new NaturalRanking(NaNStrategy.MINIMAL); ranks = ranking.rank(data); correctRanks = new double[] { 3, 4, 1.5, 1.5 }; + TestUtils.assertEquals(correctRanks, ranks, 0d); } } Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/util/MathUtilsTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/util/MathUtilsTest.java?rev=790243&r1=790242&r2=790243&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/util/MathUtilsTest.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/util/MathUtilsTest.java Wed Jul 1 16:03:28 2009 @@ -52,7 +52,7 @@ */ private long binomialCoefficient(int n, int k) throws ArithmeticException { if (binomialCache.size() > n) { - Long cachedResult = binomialCache.get(n).get(new Integer(k)); + Long cachedResult = binomialCache.get(n).get(Integer.valueOf(k)); if (cachedResult != null) { return cachedResult.longValue(); } @@ -80,7 +80,7 @@ for (int i = binomialCache.size(); i < n + 1; i++) { binomialCache.add(new HashMap()); } - binomialCache.get(n).put(new Integer(k), new Long(result)); + binomialCache.get(n).put(Integer.valueOf(k), Long.valueOf(result)); return result; }