You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2009/04/05 18:56:00 UTC
svn commit: r762118 - in
/commons/proper/math/trunk/src/test/org/apache/commons/math: distribution/
estimation/ linear/ ode/nonstiff/ random/ stat/data/ stat/descriptive/
stat/descriptive/moment/ transform/ util/
Author: sebb
Date: Sun Apr 5 16:55:59 2009
New Revision: 762118
URL: http://svn.apache.org/viewvc?rev=762118&view=rev
Log:
Remove unnecessary casts, unnecessary throws and unnecessary semi-colons
Modified:
commons/proper/math/trunk/src/test/org/apache/commons/math/distribution/IntegerDistributionAbstractTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/distribution/NormalDistributionTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/estimation/GaussNewtonEstimatorTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/estimation/LevenbergMarquardtEstimatorTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/linear/BigMatrixImplTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/linear/MatrixUtilsTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/EulerStepInterpolatorTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/TestProblem1.java
commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/TestProblem2.java
commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/TestProblem3.java
commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/TestProblem4.java
commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/TestProblemAbstract.java
commons/proper/math/trunk/src/test/org/apache/commons/math/random/RandomDataTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/stat/data/CertifiedDataAbstractTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/StorelessUnivariateStatisticAbstractTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/moment/StandardDeviationTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/moment/VarianceTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/transform/FastFourierTransformerTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/transform/FastHadamardTransformerTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/util/MathUtilsTest.java
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/distribution/IntegerDistributionAbstractTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/distribution/IntegerDistributionAbstractTest.java?rev=762118&r1=762117&r2=762118&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/distribution/IntegerDistributionAbstractTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/distribution/IntegerDistributionAbstractTest.java Sun Apr 5 16:55:59 2009
@@ -196,14 +196,14 @@
*/
public void testFloatingPointArguments() throws Exception {
for (int i = 0; i < cumulativeTestPoints.length; i++) {
- double arg = (double) cumulativeTestPoints[i];
+ double arg = cumulativeTestPoints[i];
assertEquals(
"Incorrect cumulative probability value returned for " +
cumulativeTestPoints[i],
cumulativeTestValues[i],
distribution.cumulativeProbability(arg), tolerance);
if (i < cumulativeTestPoints.length - 1) {
- double arg2 = (double) cumulativeTestPoints[i + 1];
+ double arg2 = cumulativeTestPoints[i + 1];
assertEquals("Inconsistent probability for discrete range " +
"[ " + arg + "," + arg2 + " ]",
distribution.cumulativeProbability(
@@ -223,9 +223,9 @@
int one = 1;
int ten = 10;
int two = 2;
- double oned = (double) one;
- double twod = (double) two;
- double tend = (double) ten;
+ double oned = one;
+ double twod = two;
+ double tend = ten;
assertEquals(distribution.cumulativeProbability(one, two),
distribution.cumulativeProbability(oned, twod), tolerance);
assertEquals(distribution.cumulativeProbability(one, two),
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/distribution/NormalDistributionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/distribution/NormalDistributionTest.java?rev=762118&r1=762117&r2=762118&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/distribution/NormalDistributionTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/distribution/NormalDistributionTest.java Sun Apr 5 16:55:59 2009
@@ -149,8 +149,8 @@
distribution.setMean(0);
distribution.setStandardDeviation(1);
for (int i = 0; i < 100; i+=5) { // make sure no convergence exception
- double lowerTail = distribution.cumulativeProbability((double)-i);
- double upperTail = distribution.cumulativeProbability((double) i);
+ double lowerTail = distribution.cumulativeProbability(-i);
+ double upperTail = distribution.cumulativeProbability(i);
if (i < 10) { // make sure not top-coded
assertTrue(lowerTail > 0.0d);
assertTrue(upperTail < 1.0d);
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/estimation/GaussNewtonEstimatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/estimation/GaussNewtonEstimatorTest.java?rev=762118&r1=762117&r2=762118&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/estimation/GaussNewtonEstimatorTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/estimation/GaussNewtonEstimatorTest.java Sun Apr 5 16:55:59 2009
@@ -237,7 +237,7 @@
}
- public void testNonInversible() throws EstimationException {
+ public void testNonInversible() {
EstimatedParameter[] p = {
new EstimatedParameter("p0", 0),
@@ -322,7 +322,7 @@
}
- public void testMoreEstimatedParametersSimple() throws EstimationException {
+ public void testMoreEstimatedParametersSimple() {
EstimatedParameter[] p = {
new EstimatedParameter("p0", 7),
@@ -354,7 +354,7 @@
}
- public void testMoreEstimatedParametersUnsorted() throws EstimationException {
+ public void testMoreEstimatedParametersUnsorted() {
EstimatedParameter[] p = {
new EstimatedParameter("p0", 2),
new EstimatedParameter("p1", 2),
@@ -516,7 +516,7 @@
assertEquals(48.13516790438953, circle.getY(), 1.0e-10);
}
- public void testCircleFittingBadInit() throws EstimationException {
+ public void testCircleFittingBadInit() {
Circle circle = new Circle(-12, -12);
double[][] points = new double[][] {
{-0.312967, 0.072366}, {-0.339248, 0.132965}, {-0.379780, 0.202724},
@@ -637,7 +637,7 @@
}
public WeightedMeasurement[] getMeasurements() {
- return (WeightedMeasurement[]) points.toArray(new PointModel[points.size()]);
+ return points.toArray(new PointModel[points.size()]);
}
public EstimatedParameter[] getAllParameters() {
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=762118&r1=762117&r2=762118&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 Sun Apr 5 16:55:59 2009
@@ -457,7 +457,7 @@
}
- public void testControlParameters() throws EstimationException {
+ public void testControlParameters() {
Circle circle = new Circle(98.680, 47.345);
circle.addPoint( 30.0, 68.0);
circle.addPoint( 50.0, -6.0);
@@ -620,7 +620,7 @@
set.add(parameters[j]);
}
}
- return (EstimatedParameter[]) set.toArray(new EstimatedParameter[set.size()]);
+ return set.toArray(new EstimatedParameter[set.size()]);
}
private LinearMeasurement[] measurements;
@@ -682,7 +682,7 @@
}
public WeightedMeasurement[] getMeasurements() {
- return (WeightedMeasurement[]) points.toArray(new PointModel[points.size()]);
+ return points.toArray(new PointModel[points.size()]);
}
public EstimatedParameter[] getAllParameters() {
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/linear/BigMatrixImplTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/linear/BigMatrixImplTest.java?rev=762118&r1=762117&r2=762118&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/linear/BigMatrixImplTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/linear/BigMatrixImplTest.java Sun Apr 5 16:55:59 2009
@@ -236,7 +236,7 @@
m.add(m2);
fail("IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
}
@@ -258,7 +258,7 @@
m.subtract(new BigMatrixImpl(testData2));
fail("Expecting illegalArgumentException");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
}
@@ -282,7 +282,7 @@
m.multiply(new BigMatrixImpl(bigSingular));
fail("Expecting illegalArgumentException");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
}
@@ -350,32 +350,32 @@
asDouble(m.solve(asBigDecimal(testVector2)));
fail("expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
BigMatrix bs = new BigMatrixImpl(bigSingular);
try {
bs.solve(bs);
fail("Expecting InvalidMatrixException");
} catch (InvalidMatrixException ex) {
- ;
+ // ignored
}
try {
m.solve(bs);
fail("Expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
try {
new BigMatrixImpl(testData2).solve(bs);
fail("Expecting illegalArgumentException");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
try {
(new BigMatrixImpl(testData2)).luDecompose();
fail("Expecting InvalidMatrixException");
} catch (InvalidMatrixException ex) {
- ;
+ // ignored
}
}
@@ -396,7 +396,7 @@
new BigMatrixImpl(testData2).getDeterminant().doubleValue();
fail("Expecting InvalidMatrixException");
} catch (InvalidMatrixException ex) {
- ;
+ // ignored
}
}
@@ -409,7 +409,7 @@
m.getTrace().doubleValue();
fail("Expecting NonSquareMatrixException");
} catch (NonSquareMatrixException ex) {
- ;
+ // ignored
}
}
@@ -430,7 +430,7 @@
asDouble(m.operate(asBigDecimal(testVector)));
fail("Expecting illegalArgumentException");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
}
@@ -467,7 +467,7 @@
m.preMultiply(asBigDecimal(testVector));
fail("expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
}
@@ -493,7 +493,7 @@
m.preMultiply(new BigMatrixImpl(bigSingular));
fail("Expecting illegalArgumentException");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
}
@@ -505,24 +505,24 @@
m.getRowAsDoubleArray(10);
fail("expecting MatrixIndexException");
} catch (MatrixIndexException ex) {
- ;
+ // ignored
}
try {
m.getColumnAsDoubleArray(-1);
fail("expecting MatrixIndexException");
} catch (MatrixIndexException ex) {
- ;
+ // ignored
}
}
public void testLUDecomposition() throws Exception {
BigMatrixImpl m = new BigMatrixImpl(testData);
BigMatrix lu = m.getLUMatrix();
- assertClose("LU decomposition", lu, (BigMatrix) new BigMatrixImpl(testDataLU), normTolerance);
+ assertClose("LU decomposition", lu, new BigMatrixImpl(testDataLU), normTolerance);
verifyDecomposition(m, lu);
m = new BigMatrixImpl(luData);
lu = m.getLUMatrix();
- assertClose("LU decomposition", lu, (BigMatrix) new BigMatrixImpl(luDataLUDecomposition), normTolerance);
+ assertClose("LU decomposition", lu, new BigMatrixImpl(luDataLUDecomposition), normTolerance);
verifyDecomposition(m, lu);
m = new BigMatrixImpl(testDataMinus);
lu = m.getLUMatrix();
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/linear/MatrixUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/linear/MatrixUtilsTest.java?rev=762118&r1=762117&r2=762118&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/linear/MatrixUtilsTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/linear/MatrixUtilsTest.java Sun Apr 5 16:55:59 2009
@@ -132,11 +132,11 @@
}
public void testCreateRowBigMatrix() {
- assertEquals((BigMatrixImpl) MatrixUtils.createRowBigMatrix(row),
+ assertEquals(MatrixUtils.createRowBigMatrix(row),
new BigMatrixImpl(rowMatrix));
- assertEquals((BigMatrixImpl) MatrixUtils.createRowBigMatrix(bigRow),
+ assertEquals(MatrixUtils.createRowBigMatrix(bigRow),
new BigMatrixImpl(bigRowMatrix));
- assertEquals((BigMatrixImpl) MatrixUtils.createRowBigMatrix(stringRow),
+ assertEquals(MatrixUtils.createRowBigMatrix(stringRow),
new BigMatrixImpl(stringRowMatrix));
try {
MatrixUtils.createRowBigMatrix(new double[] {}); // empty
@@ -170,11 +170,11 @@
}
public void testCreateColumnBigMatrix() {
- assertEquals((BigMatrixImpl) MatrixUtils.createColumnBigMatrix(col),
+ assertEquals(MatrixUtils.createColumnBigMatrix(col),
new BigMatrixImpl(colMatrix));
- assertEquals((BigMatrixImpl) MatrixUtils.createColumnBigMatrix(bigCol),
+ assertEquals(MatrixUtils.createColumnBigMatrix(bigCol),
new BigMatrixImpl(bigColMatrix));
- assertEquals((BigMatrixImpl) MatrixUtils.createColumnBigMatrix(stringCol),
+ assertEquals(MatrixUtils.createColumnBigMatrix(stringCol),
new BigMatrixImpl(stringColMatrix));
try {
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/EulerStepInterpolatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/EulerStepInterpolatorTest.java?rev=762118&r1=762117&r2=762118&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/EulerStepInterpolatorTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/EulerStepInterpolatorTest.java Sun Apr 5 16:55:59 2009
@@ -63,7 +63,7 @@
double t0 = 0;
double[] y0 = {0.0, 1.0, -2.0};
- double[] y = (double[]) y0.clone();
+ double[] y = y0.clone();
double[][] yDot = { new double[y0.length] };
EulerStepInterpolator interpolator = new EulerStepInterpolator();
interpolator.reinitialize(new DummyEquations(), y, yDot, true);
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/TestProblem1.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/TestProblem1.java?rev=762118&r1=762117&r2=762118&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/TestProblem1.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/TestProblem1.java Sun Apr 5 16:55:59 2009
@@ -59,7 +59,7 @@
*/
public TestProblem1(TestProblem1 problem) {
super(problem);
- y = (double[]) problem.y.clone();
+ y = problem.y.clone();
}
/**
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/TestProblem2.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/TestProblem2.java?rev=762118&r1=762117&r2=762118&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/TestProblem2.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/TestProblem2.java Sun Apr 5 16:55:59 2009
@@ -60,7 +60,7 @@
*/
public TestProblem2(TestProblem2 problem) {
super(problem);
- y = (double[]) problem.y.clone();
+ y = problem.y.clone();
}
/**
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/TestProblem3.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/TestProblem3.java?rev=762118&r1=762117&r2=762118&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/TestProblem3.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/TestProblem3.java Sun Apr 5 16:55:59 2009
@@ -75,7 +75,7 @@
public TestProblem3(TestProblem3 problem) {
super(problem);
e = problem.e;
- y = (double[]) problem.y.clone();
+ y = problem.y.clone();
}
/**
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/TestProblem4.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/TestProblem4.java?rev=762118&r1=762117&r2=762118&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/TestProblem4.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/TestProblem4.java Sun Apr 5 16:55:59 2009
@@ -65,7 +65,7 @@
public TestProblem4(TestProblem4 problem) {
super(problem);
a = problem.a;
- y = (double[]) problem.y.clone();
+ y = problem.y.clone();
}
/**
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/TestProblemAbstract.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/TestProblemAbstract.java?rev=762118&r1=762117&r2=762118&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/TestProblemAbstract.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/TestProblemAbstract.java Sun Apr 5 16:55:59 2009
@@ -71,12 +71,12 @@
if (problem.y0 == null) {
y0 = null;
} else {
- y0 = (double[]) problem.y0.clone();
+ y0 = problem.y0.clone();
}
if (problem.errorScale == null) {
errorScale = null;
} else {
- errorScale = (double[]) problem.errorScale.clone();
+ errorScale = problem.errorScale.clone();
}
t1 = problem.t1;
}
@@ -97,7 +97,7 @@
calls = 0;
n = y0.length;
this.t0 = t0;
- this.y0 = (double[]) y0.clone();
+ this.y0 = y0.clone();
}
/**
@@ -113,7 +113,7 @@
* @param errorScale error scale
*/
protected void setErrorScale(double[] errorScale) {
- this.errorScale = (double[]) errorScale.clone();
+ this.errorScale = errorScale.clone();
}
public int getDimension() {
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/random/RandomDataTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/random/RandomDataTest.java?rev=762118&r1=762117&r2=762118&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/random/RandomDataTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/random/RandomDataTest.java Sun Apr 5 16:55:59 2009
@@ -18,8 +18,6 @@
import junit.framework.Test;
import junit.framework.TestSuite;
-import java.security.NoSuchProviderException;
-import java.security.NoSuchAlgorithmException;
import java.util.HashSet;
import org.apache.commons.math.RetryTestCase;
@@ -72,7 +70,7 @@
randomData.nextInt(4,3);
fail("IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
Frequency freq = new Frequency();
int value = 0;
@@ -99,7 +97,7 @@
randomData.nextLong(4,3);
fail("IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
Frequency freq = new Frequency();
long value = 0;
@@ -126,7 +124,7 @@
randomData.nextSecureLong(4,3);
fail("IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
Frequency freq = new Frequency();
long value = 0;
@@ -153,7 +151,7 @@
randomData.nextSecureInt(4,3);
fail("IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
Frequency freq = new Frequency();
int value = 0;
@@ -185,7 +183,7 @@
randomData.nextPoisson(0);
fail("zero mean -- expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
Frequency f = new Frequency();
for (int i = 0; i<largeSampleSize; i++) {
@@ -205,13 +203,13 @@
randomData.nextPoisson(-1);
fail("negative mean supplied -- IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
try {
randomData.nextPoisson(0);
fail("0 mean supplied -- IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
}
@@ -222,13 +220,13 @@
randomData.nextHexString(-1);
fail("negative length supplied -- IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
try {
randomData.nextHexString(0);
fail("zero length supplied -- IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
String hexString = randomData.nextHexString(3);
if (hexString.length() != 3) {
@@ -242,7 +240,7 @@
hexString = randomData.nextHexString(0);
fail("zero length requested -- expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
if (hexString.length() != 1) {
fail("incorrect length for generated string");
@@ -260,7 +258,7 @@
double[] expected = new double[16];
long[] observed = new long[16];
for (int i = 0; i < 16; i++) {
- expected[i] = (double)smallSampleSize*100/(double)16;
+ expected[i] = (double)smallSampleSize*100/16;
observed[i] = f.getCount(hex[i]);
}
/* Use ChiSquare dist with df = 16-1 = 15, alpha = .001
@@ -276,13 +274,13 @@
randomData.nextSecureHexString(-1);
fail("negative length -- IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
try {
randomData.nextSecureHexString(0);
fail("zero length -- IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
String hexString = randomData.nextSecureHexString(3);
if (hexString.length() != 3) {
@@ -296,7 +294,7 @@
hexString = randomData.nextSecureHexString(0);
fail("zero length requested -- expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
if (hexString.length() != 1) {
fail("incorrect length for generated string");
@@ -314,7 +312,7 @@
double[] expected = new double[16];
long[] observed = new long[16];
for (int i = 0; i < 16; i++) {
- expected[i] = (double)smallSampleSize*100/(double)16;
+ expected[i] = (double)smallSampleSize*100/16;
observed[i] = f.getCount(hex[i]);
}
/* Use ChiSquare dist with df = 16-1 = 15, alpha = .001
@@ -330,13 +328,13 @@
randomData.nextUniform(4,3);
fail("IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
try {
randomData.nextUniform(3,3);
fail("IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
double[] expected = {500,500};
long[] observed = {0,0};
@@ -376,7 +374,7 @@
randomData.nextGaussian(0,0);
fail("zero sigma -- IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
SummaryStatistics u = new SummaryStatistics();
for (int i = 0; i<largeSampleSize; i++) {
@@ -384,7 +382,7 @@
}
double xbar = u.getMean();
double s = u.getStandardDeviation();
- double n = (double) u.getN();
+ double n = u.getN();
/* t-test at .001-level TODO: replace with externalized t-test, with
* test statistic defined in TestStatistic
*/
@@ -397,7 +395,7 @@
randomData.nextExponential(-1);
fail("negative mean -- expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
assertEquals("0 mean", 0,randomData.nextExponential(0),10E-8);
long cumFreq = 0;
@@ -416,8 +414,7 @@
}
/** test reseeding, algorithm/provider games */
- public void testConfig() throws NoSuchProviderException,
- NoSuchAlgorithmException {
+ public void testConfig() {
randomData.reSeed(1000);
double v = randomData.nextUniform(0,1);
randomData.reSeed();
@@ -521,7 +518,7 @@
one = randomData.nextSample(hs,2);
fail("sample size > set size, expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
// Make sure we fail for empty collection
@@ -530,7 +527,7 @@
one = randomData.nextSample(hs,0);
fail("n = k = 0, expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
}
@@ -577,7 +574,7 @@
perm = randomData.nextPermutation(2,3);
fail("permutation k > n, expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
// Make sure we fail for n = 0
@@ -585,7 +582,7 @@
perm = randomData.nextPermutation(0,0);
fail("permutation k = n = 0, expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
// Make sure we fail for k < n < 0
@@ -593,7 +590,7 @@
perm = randomData.nextPermutation(-1,-3);
fail("permutation k < n < 0, expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
}
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/stat/data/CertifiedDataAbstractTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/stat/data/CertifiedDataAbstractTest.java?rev=762118&r1=762117&r2=762118&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/stat/data/CertifiedDataAbstractTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/stat/data/CertifiedDataAbstractTest.java Sun Apr 5 16:55:59 2009
@@ -112,7 +112,7 @@
public void testCertifiedValues() {
for (String name : certifiedValues.keySet()) {
- Double expectedValue = (Double)certifiedValues.get(name);
+ Double expectedValue = certifiedValues.get(name);
Double summariesValue = getProperty(summaries, name);
if (summariesValue != null) {
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/StorelessUnivariateStatisticAbstractTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/StorelessUnivariateStatisticAbstractTest.java?rev=762118&r1=762117&r2=762118&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/StorelessUnivariateStatisticAbstractTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/StorelessUnivariateStatisticAbstractTest.java Sun Apr 5 16:55:59 2009
@@ -183,11 +183,11 @@
StorelessUnivariateStatistic replica = null;
// Randomly select a portion of testArray to load first
- long index = Math.round((Math.random()) * (double) testArray.length);
+ long index = Math.round((Math.random()) * testArray.length);
// Put first half in master and copy master to replica
master.incrementAll(testArray, 0, (int) index);
- replica = (StorelessUnivariateStatistic) master.copy();
+ replica = master.copy();
// Check same
assertTrue(replica.equals(master));
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/moment/StandardDeviationTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/moment/StandardDeviationTest.java?rev=762118&r1=762117&r2=762118&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/moment/StandardDeviationTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/moment/StandardDeviationTest.java Sun Apr 5 16:55:59 2009
@@ -101,7 +101,7 @@
for (int i = 0; i < v.length; i++) {
sum += (v[i] - mean) * (v[i] - mean);
}
- return Math.sqrt(sum / (double) v.length);
+ return Math.sqrt(sum / v.length);
}
}
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/moment/VarianceTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/moment/VarianceTest.java?rev=762118&r1=762117&r2=762118&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/moment/VarianceTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/moment/VarianceTest.java Sun Apr 5 16:55:59 2009
@@ -100,7 +100,7 @@
for (int i = 0; i < v.length; i++) {
sum += (v[i] - mean) * (v[i] - mean);
}
- return sum / (double) v.length;
+ return sum / v.length;
}
}
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/transform/FastFourierTransformerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/transform/FastFourierTransformerTest.java?rev=762118&r1=762117&r2=762118&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/transform/FastFourierTransformerTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/transform/FastFourierTransformerTest.java Sun Apr 5 16:55:59 2009
@@ -34,7 +34,7 @@
/**
* Test of transformer for the ad hoc data taken from Mathematica.
*/
- public void testAdHocData() throws MathException {
+ public void testAdHocData() {
FastFourierTransformer transformer = new FastFourierTransformer();
Complex result[]; double tolerance = 1E-12;
@@ -78,7 +78,7 @@
}
}
- public void test2DData() throws MathException {
+ public void test2DData() {
FastFourierTransformer transformer = new FastFourierTransformer();
double tolerance = 1E-12;
Complex[][] input = new Complex[][] {new Complex[] {new Complex(1, 0),
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/transform/FastHadamardTransformerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/transform/FastHadamardTransformerTest.java?rev=762118&r1=762117&r2=762118&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/transform/FastHadamardTransformerTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/transform/FastHadamardTransformerTest.java Sun Apr 5 16:55:59 2009
@@ -77,7 +77,7 @@
// check double transform
double[] dX = new double[x.length];
for (int i = 0; i < dX.length; ++i) {
- dX[i] = (double) x[i];
+ dX[i] = x[i];
}
double dResult[] = transformer.transform(dX);
for (int i = 0; i < dResult.length; i++) {
@@ -106,7 +106,7 @@
// check double transform
double[] dY = new double[y.length];
for (int i = 0; i < dY.length; ++i) {
- dY[i] = (double) y[i];
+ dY[i] = y[i];
}
double dResult[] = transformer.inversetransform(dY);
for (int i = 0; i < dResult.length; i++) {
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=762118&r1=762117&r2=762118&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 Sun Apr 5 16:55:59 2009
@@ -170,8 +170,8 @@
for (int n = 1; n < 10; n++) {
for (int k = 0; k <= n; k++) {
assertEquals(n + " choose " + k, binomialCoefficient(n, k), MathUtils.binomialCoefficient(n, k));
- assertEquals(n + " choose " + k, (double)binomialCoefficient(n, k), MathUtils.binomialCoefficientDouble(n, k), Double.MIN_VALUE);
- assertEquals(n + " choose " + k, Math.log((double)binomialCoefficient(n, k)), MathUtils.binomialCoefficientLog(n, k), 10E-12);
+ assertEquals(n + " choose " + k, binomialCoefficient(n, k), MathUtils.binomialCoefficientDouble(n, k), Double.MIN_VALUE);
+ assertEquals(n + " choose " + k, Math.log(binomialCoefficient(n, k)), MathUtils.binomialCoefficientLog(n, k), 10E-12);
}
}
@@ -181,7 +181,7 @@
long expected = binomialCoefficient(n[i], k[i]);
assertEquals(n[i] + " choose " + k[i], expected,
MathUtils.binomialCoefficient(n[i], k[i]));
- assertEquals(n[i] + " choose " + k[i], (double) expected,
+ assertEquals(n[i] + " choose " + k[i], expected,
MathUtils.binomialCoefficientDouble(n[i], k[i]), 0.0);
assertEquals("log(" + n[i] + " choose " + k[i] + ")", Math.log(expected),
MathUtils.binomialCoefficientLog(n[i], k[i]), 0.0);
@@ -253,53 +253,53 @@
MathUtils.binomialCoefficient(4, 5);
fail("expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
try {
MathUtils.binomialCoefficientDouble(4, 5);
fail("expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
try {
MathUtils.binomialCoefficientLog(4, 5);
fail("expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
try {
MathUtils.binomialCoefficient(-1, -2);
fail("expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
try {
MathUtils.binomialCoefficientDouble(-1, -2);
fail("expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
try {
MathUtils.binomialCoefficientLog(-1, -2);
fail("expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
try {
MathUtils.binomialCoefficient(67, 30);
fail("expecting ArithmeticException");
} catch (ArithmeticException ex) {
- ;
+ // ignored
}
try {
MathUtils.binomialCoefficient(67, 34);
fail("expecting ArithmeticException");
} catch (ArithmeticException ex) {
- ;
+ // ignored
}
double x = MathUtils.binomialCoefficientDouble(1030, 515);
assertTrue("expecting infinite binomial coefficient", Double
@@ -378,8 +378,8 @@
public void testFactorial() {
for (int i = 1; i < 21; i++) {
assertEquals(i + "! ", factorial(i), MathUtils.factorial(i));
- assertEquals(i + "! ", (double)factorial(i), MathUtils.factorialDouble(i), Double.MIN_VALUE);
- assertEquals(i + "! ", Math.log((double)factorial(i)), MathUtils.factorialLog(i), 10E-12);
+ assertEquals(i + "! ", factorial(i), MathUtils.factorialDouble(i), Double.MIN_VALUE);
+ assertEquals(i + "! ", Math.log(factorial(i)), MathUtils.factorialLog(i), 10E-12);
}
assertEquals("0", 1, MathUtils.factorial(0));
@@ -392,25 +392,25 @@
MathUtils.factorial(-1);
fail("expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
try {
MathUtils.factorialDouble(-1);
fail("expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
try {
MathUtils.factorialLog(-1);
fail("expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) {
- ;
+ // ignored
}
try {
MathUtils.factorial(21);
fail("expecting ArithmeticException");
} catch (ArithmeticException ex) {
- ;
+ // ignored
}
assertTrue("expecting infinite factorial value", Double.isInfinite(MathUtils.factorialDouble(171)));
}
@@ -515,7 +515,7 @@
// Generate 10 distinct random values
for (int i = 0; i < 10; i++) {
- original[i] = random.nextUniform((double)i + 0.5, (double)i + 0.75);
+ original[i] = random.nextUniform(i + 0.5, i + 0.75);
}
// Generate a random permutation, making sure it is not the identity
@@ -556,9 +556,9 @@
}
public void testIndicatorInt() {
- assertEquals((int)1, MathUtils.indicator((int)(2)));
- assertEquals((int)1, MathUtils.indicator((int)(0)));
- assertEquals((int)(-1), MathUtils.indicator((int)(-2)));
+ assertEquals(1, MathUtils.indicator((2)));
+ assertEquals(1, MathUtils.indicator((0)));
+ assertEquals((-1), MathUtils.indicator((-2)));
}
public void testIndicatorLong() {
@@ -999,9 +999,9 @@
}
public void testSignInt() {
- assertEquals((int) 1, MathUtils.sign((int) 2));
- assertEquals((int) 0, MathUtils.sign((int) 0));
- assertEquals((int) (-1), MathUtils.sign((int) (-2)));
+ assertEquals(1, MathUtils.sign(2));
+ assertEquals(0, MathUtils.sign(0));
+ assertEquals((-1), MathUtils.sign((-2)));
}
public void testSignLong() {