diff --git a/src/experimental/org/apache/commons/math/function/DefaultContext.java b/src/experimental/org/apache/commons/math/function/DefaultContext.java index 45d3561ec..0d9efed60 100644 --- a/src/experimental/org/apache/commons/math/function/DefaultContext.java +++ b/src/experimental/org/apache/commons/math/function/DefaultContext.java @@ -145,19 +145,19 @@ public class DefaultContext implements EvaluationContext { } DefaultValue(double d) { - value = new Double(d); + value = Double.valueOf(d); } DefaultValue(float f) { - value = new Float(f); + value = Float.valueOf(f); } DefaultValue(int i) { - value = new Integer(i); + value = Integer.valueOf(i); } DefaultValue(long l) { - value = new Long(l); + value = Long.valueOf(l); } /* (non-Javadoc) diff --git a/src/experimental/org/apache/commons/math/stat/univariate/BeanListUnivariateImpl.java b/src/experimental/org/apache/commons/math/stat/univariate/BeanListUnivariateImpl.java index 0df42a9c2..8bbd07539 100644 --- a/src/experimental/org/apache/commons/math/stat/univariate/BeanListUnivariateImpl.java +++ b/src/experimental/org/apache/commons/math/stat/univariate/BeanListUnivariateImpl.java @@ -134,7 +134,7 @@ public class BeanListUnivariateImpl extends ListUnivariateImpl implements Serial } catch (Exception ex) { // InstantiationException, IllegalAccessException throw new RuntimeException(ex); // should never happen } - dynaBean.set(propertyName, new Double(v)); + dynaBean.set(propertyName, Double.valueOf(v)); addObject(dynaBean); } diff --git a/src/experimental/org/apache/commons/math/stat/univariate/BeanListUnivariateImplTest.java b/src/experimental/org/apache/commons/math/stat/univariate/BeanListUnivariateImplTest.java index 9b60288c0..9e9751baf 100644 --- a/src/experimental/org/apache/commons/math/stat/univariate/BeanListUnivariateImplTest.java +++ b/src/experimental/org/apache/commons/math/stat/univariate/BeanListUnivariateImplTest.java @@ -60,21 +60,21 @@ public final class BeanListUnivariateImplTest extends TestCase { patientList = new ArrayList(); // Create and add patient bean 1 - VitalStats vs1 = new VitalStats( new Double(120.0), - new Double(96.4) ); - Patient p1 = new Patient( vs1, new Integer( 35 ) ); + VitalStats vs1 = new VitalStats( Double.valueOf(120.0), + Double.valueOf(96.4) ); + Patient p1 = new Patient( vs1, Integer.valueOf( 35 ) ); patientList.add( p1 ); // Create and add patient bean 2 - VitalStats vs2 = new VitalStats( new Double(70.0), - new Double(97.4) ); - Patient p2 = new Patient( vs2, new Integer( 23 ) ); + VitalStats vs2 = new VitalStats( Double.valueOf(70.0), + Double.valueOf(97.4) ); + Patient p2 = new Patient( vs2, Integer.valueOf( 23 ) ); patientList.add( p2 ); // Create and add patient bean 3 - VitalStats vs3 = new VitalStats( new Double(90.0), - new Double(98.6) ); - Patient p3 = new Patient( vs3, new Integer( 42 ) ); + VitalStats vs3 = new VitalStats( Double.valueOf(90.0), + Double.valueOf(98.6) ); + Patient p3 = new Patient( vs3, Integer.valueOf( 42 ) ); patientList.add( p3 ); } diff --git a/src/java/org/apache/commons/math/ArgumentOutsideDomainException.java b/src/java/org/apache/commons/math/ArgumentOutsideDomainException.java index 20efc0de2..e17a7dc56 100644 --- a/src/java/org/apache/commons/math/ArgumentOutsideDomainException.java +++ b/src/java/org/apache/commons/math/ArgumentOutsideDomainException.java @@ -38,7 +38,7 @@ public class ArgumentOutsideDomainException extends FunctionEvaluationException public ArgumentOutsideDomainException(double argument, double lower, double upper) { super(argument, "Argument {0} outside domain [{1} ; {2}]", - new Object[] { new Double(argument), new Double(lower), new Double(upper) }); + new Object[] { Double.valueOf(argument), Double.valueOf(lower), Double.valueOf(upper) }); } } diff --git a/src/java/org/apache/commons/math/DimensionMismatchException.java b/src/java/org/apache/commons/math/DimensionMismatchException.java index 0fdd0a1b0..a5ce4b4ca 100644 --- a/src/java/org/apache/commons/math/DimensionMismatchException.java +++ b/src/java/org/apache/commons/math/DimensionMismatchException.java @@ -35,7 +35,7 @@ public class DimensionMismatchException extends MathException { public DimensionMismatchException(int dimension1, int dimension2) { super("dimension mismatch {0} != {1}", new Object[] { - new Integer(dimension1), new Integer(dimension2) + Integer.valueOf(dimension1), Integer.valueOf(dimension2) }); this.dimension1 = dimension1; this.dimension2 = dimension2; diff --git a/src/java/org/apache/commons/math/DuplicateSampleAbscissaException.java b/src/java/org/apache/commons/math/DuplicateSampleAbscissaException.java index 2d1be1b89..d2986b06e 100644 --- a/src/java/org/apache/commons/math/DuplicateSampleAbscissaException.java +++ b/src/java/org/apache/commons/math/DuplicateSampleAbscissaException.java @@ -35,7 +35,7 @@ public class DuplicateSampleAbscissaException extends MathException { */ public DuplicateSampleAbscissaException(double abscissa, int i1, int i2) { super("Abscissa {0} is duplicated at both indices {1} and {2}", - new Object[] { new Double(abscissa), new Integer(i1), new Integer(i2) }); + new Object[] { Double.valueOf(abscissa), Integer.valueOf(i1), Integer.valueOf(i2) }); } /** diff --git a/src/java/org/apache/commons/math/FunctionEvaluationException.java b/src/java/org/apache/commons/math/FunctionEvaluationException.java index e8b15a817..e0a957e4a 100644 --- a/src/java/org/apache/commons/math/FunctionEvaluationException.java +++ b/src/java/org/apache/commons/math/FunctionEvaluationException.java @@ -40,7 +40,7 @@ public class FunctionEvaluationException extends MathException { */ public FunctionEvaluationException(double argument) { super("Evaluation failed for argument = {0}", - new Object[] { new Double(argument) }); + new Object[] { Double.valueOf(argument) }); this.argument = argument; } diff --git a/src/java/org/apache/commons/math/MaxIterationsExceededException.java b/src/java/org/apache/commons/math/MaxIterationsExceededException.java index ecc59de94..f21d72734 100644 --- a/src/java/org/apache/commons/math/MaxIterationsExceededException.java +++ b/src/java/org/apache/commons/math/MaxIterationsExceededException.java @@ -41,7 +41,7 @@ public class MaxIterationsExceededException extends ConvergenceException { */ public MaxIterationsExceededException(int maxIterations) { super("Maximal number of iterations ({0}) exceeded", - new Object[] { new Integer(maxIterations) }); + new Object[] { Integer.valueOf(maxIterations) }); this.maxIterations = maxIterations; } diff --git a/src/java/org/apache/commons/math/analysis/UnivariateRealSolverUtils.java b/src/java/org/apache/commons/math/analysis/UnivariateRealSolverUtils.java index 8c11bd5df..89eb0196d 100644 --- a/src/java/org/apache/commons/math/analysis/UnivariateRealSolverUtils.java +++ b/src/java/org/apache/commons/math/analysis/UnivariateRealSolverUtils.java @@ -199,9 +199,9 @@ public class UnivariateRealSolverUtils { if (fa * fb >= 0.0 ) { throw new ConvergenceException ("Number of iterations={0}, maximum iterations={1}, initial={2}, lower bound={3}, upper bound={4}, final a value={5}, final b value={6}, f(a)={7}, f(b)={8}", - new Object[] { new Integer(numIterations), new Integer(maximumIterations), - new Double(initial), new Double(lowerBound), new Double(upperBound), - new Double(a), new Double(b), new Double(fa), new Double(fb) }); + new Object[] { Integer.valueOf(numIterations), Integer.valueOf(maximumIterations), + Double.valueOf(initial), Double.valueOf(lowerBound), Double.valueOf(upperBound), + Double.valueOf(a), Double.valueOf(b), Double.valueOf(fa), Double.valueOf(fb) }); } return new double[]{a, b}; diff --git a/src/java/org/apache/commons/math/complex/ComplexFormat.java b/src/java/org/apache/commons/math/complex/ComplexFormat.java index 0757d9b91..3ad8878c2 100644 --- a/src/java/org/apache/commons/math/complex/ComplexFormat.java +++ b/src/java/org/apache/commons/math/complex/ComplexFormat.java @@ -450,7 +450,7 @@ public class ComplexFormat extends Format implements Serializable { int endIndex = startIndex + n; if (endIndex < source.length()) { if (source.substring(startIndex, endIndex).compareTo(sb.toString()) == 0) { - ret = new Double(value); + ret = Double.valueOf(value); pos.setIndex(endIndex); } } diff --git a/src/java/org/apache/commons/math/estimation/AbstractEstimator.java b/src/java/org/apache/commons/math/estimation/AbstractEstimator.java index a0676c7e7..deddbdff7 100644 --- a/src/java/org/apache/commons/math/estimation/AbstractEstimator.java +++ b/src/java/org/apache/commons/math/estimation/AbstractEstimator.java @@ -98,7 +98,7 @@ public abstract class AbstractEstimator implements Estimator { if (++costEvaluations > maxCostEval) { throw new EstimationException("maximal number of evaluations exceeded ({0})", - new Object[] { new Integer(maxCostEval) }); + new Object[] { Integer.valueOf(maxCostEval) }); } cost = 0; @@ -202,7 +202,7 @@ public abstract class AbstractEstimator implements Estimator { int p = problem.getUnboundParameters().length; if (m <= p) { throw new EstimationException("no degrees of freedom ({0} measurements, {1} parameters)", - new Object[] { new Integer(m), new Integer(p)}); + new Object[] { Integer.valueOf(m), Integer.valueOf(p)}); } double[] errors = new double[problem.getUnboundParameters().length]; final double c = Math.sqrt(getChiSquare(problem) / (m - p)); diff --git a/src/java/org/apache/commons/math/estimation/LevenbergMarquardtEstimator.java b/src/java/org/apache/commons/math/estimation/LevenbergMarquardtEstimator.java index 07bffbad1..7cbb91396 100644 --- a/src/java/org/apache/commons/math/estimation/LevenbergMarquardtEstimator.java +++ b/src/java/org/apache/commons/math/estimation/LevenbergMarquardtEstimator.java @@ -401,16 +401,16 @@ public class LevenbergMarquardtEstimator extends AbstractEstimator implements Se throw new EstimationException("cost relative tolerance is too small ({0})," + " no further reduction in the" + " sum of squares is possible", - new Object[] { new Double(costRelativeTolerance) }); + new Object[] { Double.valueOf(costRelativeTolerance) }); } else if (delta <= 2.2204e-16 * xNorm) { throw new EstimationException("parameters relative tolerance is too small" + " ({0}), no further improvement in" + " the approximate solution is possible", - new Object[] { new Double(parRelativeTolerance) }); + new Object[] { Double.valueOf(parRelativeTolerance) }); } else if (maxCosine <= 2.2204e-16) { throw new EstimationException("orthogonality tolerance is too small ({0})," + " solution is orthogonal to the jacobian", - new Object[] { new Double(orthoTolerance) }); + new Object[] { Double.valueOf(orthoTolerance) }); } } @@ -763,7 +763,7 @@ public class LevenbergMarquardtEstimator extends AbstractEstimator implements Se } if (Double.isInfinite(norm2) || Double.isNaN(norm2)) { throw new EstimationException("unable to perform Q.R decomposition on the {0}x{1} jacobian matrix", - new Object[] { new Integer(rows), new Integer(cols) }); + new Object[] { Integer.valueOf(rows), Integer.valueOf(cols) }); } if (norm2 > ak2) { nextColumn = i; diff --git a/src/java/org/apache/commons/math/fraction/FractionConversionException.java b/src/java/org/apache/commons/math/fraction/FractionConversionException.java index 1cde8d592..fdcbb7e85 100644 --- a/src/java/org/apache/commons/math/fraction/FractionConversionException.java +++ b/src/java/org/apache/commons/math/fraction/FractionConversionException.java @@ -39,7 +39,7 @@ public class FractionConversionException extends ConvergenceException { */ public FractionConversionException(double value, int maxIterations) { super("Unable to convert {0} to fraction after {1} iterations", - new Object[] { new Double(value), new Integer(maxIterations) }); + new Object[] { Double.valueOf(value), Integer.valueOf(maxIterations) }); } /** @@ -51,7 +51,7 @@ public class FractionConversionException extends ConvergenceException { */ public FractionConversionException(double value, long p, long q) { super("Overflow trying to convert {0} to fraction ({1}/{2})", - new Object[] { new Double(value), new Long(p), new Long(q) }); + new Object[] { Double.valueOf(value), Long.valueOf(p), Long.valueOf(q) }); } } diff --git a/src/java/org/apache/commons/math/ode/AdaptiveStepsizeIntegrator.java b/src/java/org/apache/commons/math/ode/AdaptiveStepsizeIntegrator.java index ca2aa0f4d..be13af3f9 100644 --- a/src/java/org/apache/commons/math/ode/AdaptiveStepsizeIntegrator.java +++ b/src/java/org/apache/commons/math/ode/AdaptiveStepsizeIntegrator.java @@ -198,37 +198,37 @@ public abstract class AdaptiveStepsizeIntegrator throw new IntegratorException("dimensions mismatch: ODE problem has dimension {0}," + " initial state vector has dimension {1}", new Object[] { - new Integer(equations.getDimension()), - new Integer(y0.length) + Integer.valueOf(equations.getDimension()), + Integer.valueOf(y0.length) }); } if (equations.getDimension() != y.length) { throw new IntegratorException("dimensions mismatch: ODE problem has dimension {0}," + " final state vector has dimension {1}", new Object[] { - new Integer(equations.getDimension()), - new Integer(y.length) + Integer.valueOf(equations.getDimension()), + Integer.valueOf(y.length) }); } if ((vecAbsoluteTolerance != null) && (vecAbsoluteTolerance.length != y0.length)) { throw new IntegratorException("dimensions mismatch: state vector has dimension {0}," + " absolute tolerance vector has dimension {1}", new Object[] { - new Integer(y0.length), - new Integer(vecAbsoluteTolerance.length) + Integer.valueOf(y0.length), + Integer.valueOf(vecAbsoluteTolerance.length) }); } if ((vecRelativeTolerance != null) && (vecRelativeTolerance.length != y0.length)) { throw new IntegratorException("dimensions mismatch: state vector has dimension {0}," + " relative tolerance vector has dimension {1}", new Object[] { - new Integer(y0.length), - new Integer(vecRelativeTolerance.length) + Integer.valueOf(y0.length), + Integer.valueOf(vecRelativeTolerance.length) }); } if (Math.abs(t - t0) <= 1.0e-12 * Math.max(Math.abs(t0), Math.abs(t))) { throw new IntegratorException("too small integration interval: length = {0}", - new Object[] { new Double(Math.abs(t - t0)) }); + new Object[] { Double.valueOf(Math.abs(t - t0)) }); } } @@ -330,8 +330,8 @@ public abstract class AdaptiveStepsizeIntegrator throw new IntegratorException("minimal step size ({0}) reached," + " integration needs {1}", new Object[] { - new Double(minStep), - new Double(Math.abs(h)) + Double.valueOf(minStep), + Double.valueOf(Math.abs(h)) }); } } diff --git a/src/java/org/apache/commons/math/ode/RungeKuttaIntegrator.java b/src/java/org/apache/commons/math/ode/RungeKuttaIntegrator.java index 521e329b3..690952c96 100644 --- a/src/java/org/apache/commons/math/ode/RungeKuttaIntegrator.java +++ b/src/java/org/apache/commons/math/ode/RungeKuttaIntegrator.java @@ -140,21 +140,21 @@ public abstract class RungeKuttaIntegrator throw new IntegratorException("dimensions mismatch: ODE problem has dimension {0}," + " initial state vector has dimension {1}", new Object[] { - new Integer(equations.getDimension()), - new Integer(y0.length) + Integer.valueOf(equations.getDimension()), + Integer.valueOf(y0.length) }); } if (equations.getDimension() != y.length) { throw new IntegratorException("dimensions mismatch: ODE problem has dimension {0}," + " final state vector has dimension {1}", new Object[] { - new Integer(equations.getDimension()), - new Integer(y.length) + Integer.valueOf(equations.getDimension()), + Integer.valueOf(y.length) }); } if (Math.abs(t - t0) <= 1.0e-12 * Math.max(Math.abs(t0), Math.abs(t))) { throw new IntegratorException("too small integration interval: length = {0}", - new Object[] { new Double(Math.abs(t - t0)) }); + new Object[] { Double.valueOf(Math.abs(t - t0)) }); } } diff --git a/src/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java b/src/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java index 0fbc60454..78a8e77af 100644 --- a/src/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java +++ b/src/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java @@ -271,7 +271,7 @@ public class EmpiricalDistributionImpl implements Serializable, EmpiricalDistrib double val = 0.0; sampleStats = new SummaryStatistics(); while ((str = inputStream.readLine()) != null) { - val = new Double(str).doubleValue(); + val = Double.valueOf(str).doubleValue(); sampleStats.addValue(val); } inputStream.close(); @@ -334,7 +334,7 @@ public class EmpiricalDistributionImpl implements Serializable, EmpiricalDistrib // Load array of bin upper bounds -- evenly spaced from min - max double min = sampleStats.getMin(); double max = sampleStats.getMax(); - double delta = (max - min)/(new Double(binCount)).doubleValue(); + double delta = (max - min)/(Double.valueOf(binCount)).doubleValue(); double[] binUpperBounds = new double[binCount]; binUpperBounds[0] = min + delta; for (int i = 1; i< binCount - 1; i++) { diff --git a/src/java/org/apache/commons/math/random/RandomDataImpl.java b/src/java/org/apache/commons/math/random/RandomDataImpl.java index 4e65d4ad9..481e185f9 100644 --- a/src/java/org/apache/commons/math/random/RandomDataImpl.java +++ b/src/java/org/apache/commons/math/random/RandomDataImpl.java @@ -137,7 +137,7 @@ public class RandomDataImpl implements RandomData, Serializable { //Convert each byte to 2 hex digits for (int i = 0; i < randomBytes.length; i++) { - Integer c = new Integer(randomBytes[i]); + Integer c = Integer.valueOf(randomBytes[i]); /* Add 128 to byte value to make interval 0-255 before * doing hex conversion. @@ -236,7 +236,7 @@ public class RandomDataImpl implements RandomData, Serializable { //Loop over the hash, converting each byte to 2 hex digits for (int i = 0; i < hash.length; i++) { - Integer c = new Integer(hash[i]); + Integer c = Integer.valueOf(hash[i]); /* Add 128 to byte value to make interval 0-255 * This guarantees <= 2 hex digits from toHexString() diff --git a/src/java/org/apache/commons/math/stat/Frequency.java b/src/java/org/apache/commons/math/stat/Frequency.java index 8254b709b..078260ba5 100644 --- a/src/java/org/apache/commons/math/stat/Frequency.java +++ b/src/java/org/apache/commons/math/stat/Frequency.java @@ -30,7 +30,7 @@ import java.util.TreeMap; * throw an IllegalArgumentException.
*
* Integer values (int, long, Integer, Long) are not distinguished by type --
- * i.e. addValue(new Long(2)), addValue(2), addValue(2l)
all have
+ * i.e. addValue(Long.valueOf(2)), addValue(2), addValue(2l)
all have
* the same effect (similarly for arguments to getCount,
etc.).
* The values are ordered using the default (natural order), unless a @@ -96,14 +96,14 @@ public class Frequency implements Serializable { public void addValue(Object v) { Object obj = v; if (v instanceof Integer) { - obj = new Long(((Integer) v).longValue()); + obj = Long.valueOf(((Integer) v).longValue()); } try { Long count = (Long) freqTable.get(obj); if (count == null) { - freqTable.put(obj, new Long(1)); + freqTable.put(obj, Long.valueOf(1)); } else { - freqTable.put(obj, new Long(count.longValue() + 1)); + freqTable.put(obj, Long.valueOf(count.longValue() + 1)); } } catch (ClassCastException ex) { //TreeMap will throw ClassCastException if v is not comparable @@ -117,7 +117,7 @@ public class Frequency implements Serializable { * @param v the value to add. */ public void addValue(int v) { - addValue(new Long(v)); + addValue(Long.valueOf(v)); } /** @@ -126,7 +126,7 @@ public class Frequency implements Serializable { * @param v the value to add. */ public void addValue(Integer v) { - addValue(new Long(v.longValue())); + addValue(Long.valueOf(v.longValue())); } /** @@ -135,7 +135,7 @@ public class Frequency implements Serializable { * @param v the value to add. */ public void addValue(long v) { - addValue(new Long(v)); + addValue(Long.valueOf(v)); } /** @@ -210,7 +210,7 @@ public class Frequency implements Serializable { * @return the frequency of v. */ public long getCount(int v) { - return getCount(new Long(v)); + return getCount(Long.valueOf(v)); } /** @@ -220,7 +220,7 @@ public class Frequency implements Serializable { * @return the frequency of v. */ public long getCount(long v) { - return getCount(new Long(v)); + return getCount(Long.valueOf(v)); } /** @@ -259,7 +259,7 @@ public class Frequency implements Serializable { * @return the proportion of values equal to v */ public double getPct(int v) { - return getPct(new Long(v)); + return getPct(Long.valueOf(v)); } /** @@ -270,7 +270,7 @@ public class Frequency implements Serializable { * @return the proportion of values equal to v */ public double getPct(long v) { - return getPct(new Long(v)); + return getPct(Long.valueOf(v)); } /** @@ -345,7 +345,7 @@ public class Frequency implements Serializable { * @return the proportion of values equal to v */ public long getCumFreq(int v) { - return getCumFreq(new Long(v)); + return getCumFreq(Long.valueOf(v)); } /** @@ -357,7 +357,7 @@ public class Frequency implements Serializable { * @return the proportion of values equal to v */ public long getCumFreq(long v) { - return getCumFreq(new Long(v)); + return getCumFreq(Long.valueOf(v)); } /** @@ -402,7 +402,7 @@ public class Frequency implements Serializable { * @return the proportion of values less than or equal to v */ public double getCumPct(int v) { - return getCumPct(new Long(v)); + return getCumPct(Long.valueOf(v)); } /** @@ -415,7 +415,7 @@ public class Frequency implements Serializable { * @return the proportion of values less than or equal to v */ public double getCumPct(long v) { - return getCumPct(new Long(v)); + return getCumPct(Long.valueOf(v)); } /** diff --git a/src/java/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.java b/src/java/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.java index 490194b11..1f5486414 100644 --- a/src/java/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.java +++ b/src/java/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.java @@ -353,7 +353,7 @@ public class DescriptiveStatistics implements StatisticalSummary, Serializable { try { percentileImpl.getClass().getMethod("setQuantile", new Class[] {Double.TYPE}).invoke(percentileImpl, - new Object[] {new Double(p)}); + new Object[] {Double.valueOf(p)}); } catch (NoSuchMethodException e1) { // Setter guard should prevent throw new IllegalArgumentException( "Percentile implementation does not support setQuantile"); @@ -534,7 +534,7 @@ public class DescriptiveStatistics implements StatisticalSummary, Serializable { try { percentileImpl.getClass().getMethod("setQuantile", new Class[] {Double.TYPE}).invoke(percentileImpl, - new Object[] {new Double(50.0d)}); + new Object[] {Double.valueOf(50.0d)}); } catch (NoSuchMethodException e1) { throw new IllegalArgumentException( "Percentile implementation does not support setQuantile"); diff --git a/src/java/org/apache/commons/math/util/ContinuedFraction.java b/src/java/org/apache/commons/math/util/ContinuedFraction.java index 6e8599794..8436bc59a 100644 --- a/src/java/org/apache/commons/math/util/ContinuedFraction.java +++ b/src/java/org/apache/commons/math/util/ContinuedFraction.java @@ -155,7 +155,7 @@ public abstract class ContinuedFraction implements Serializable { // can not scale an convergent is unbounded. throw new ConvergenceException( "Continued fraction convergents diverged to +/- infinity for value {0}", - new Object[] { new Double(x) }); + new Object[] { Double.valueOf(x) }); } } double r = p2 / q2; @@ -172,7 +172,7 @@ public abstract class ContinuedFraction implements Serializable { if (n >= maxIterations) { throw new MaxIterationsExceededException(maxIterations, "Continued fraction convergents failed to converge for value {0}", - new Object[] { new Double(x) }); + new Object[] { Double.valueOf(x) }); } return c; diff --git a/src/java/org/apache/commons/math/util/DefaultTransformer.java b/src/java/org/apache/commons/math/util/DefaultTransformer.java index bb610e8ec..7216100f9 100644 --- a/src/java/org/apache/commons/math/util/DefaultTransformer.java +++ b/src/java/org/apache/commons/math/util/DefaultTransformer.java @@ -52,7 +52,7 @@ public class DefaultTransformer implements NumberTransformer, Serializable { } try { - return new Double(o.toString()).doubleValue(); + return Double.valueOf(o.toString()).doubleValue(); } catch (Exception e) { throw new MathException("Conversion Exception in Transformation: {0}", new Object[] { e.getMessage() }, e); diff --git a/src/mantissa/src/org/spaceroots/mantissa/algebra/Polynomial.java b/src/mantissa/src/org/spaceroots/mantissa/algebra/Polynomial.java index b3d7f84d3..0100fd330 100644 --- a/src/mantissa/src/org/spaceroots/mantissa/algebra/Polynomial.java +++ b/src/mantissa/src/org/spaceroots/mantissa/algebra/Polynomial.java @@ -818,7 +818,7 @@ public abstract class Polynomial implements Serializable { System.arraycopy((a.length < p.a.length) ? p.a : a, lowLength, newA, lowLength, highLength - lowLength); - return new Double(newA); + return Double.valueOf(newA); } @@ -845,7 +845,7 @@ public abstract class Polynomial implements Serializable { System.arraycopy(a, lowLength, newA, lowLength, highLength - lowLength); } - return new Double(newA); + return Double.valueOf(newA); } @@ -857,7 +857,7 @@ public abstract class Polynomial implements Serializable { for (int i = 0; i < a.length; ++i) { newA[i] = -a[i]; } - return new Double(newA); + return Double.valueOf(newA); } /** Multiply the instance by a polynomial. @@ -877,7 +877,7 @@ public abstract class Polynomial implements Serializable { } } - return new Double(newA); + return Double.valueOf(newA); } @@ -904,14 +904,14 @@ public abstract class Polynomial implements Serializable { public Polynomial multiply(double r) { if (r == 0) { - return new Double(new double[] { 0.0 }); + return Double.valueOf(new double[] { 0.0 }); } double[] newA = new double[a.length]; for (int i = 0; i < a.length; ++i) { newA[i] = a[i] * r; } - return new Double(newA); + return Double.valueOf(newA); } @@ -934,13 +934,13 @@ public abstract class Polynomial implements Serializable { */ public Polynomial getDerivative() { if (a.length == 1) { - return new Double(); + return Double.valueOf(); } double[] newA = new double[a.length - 1]; for (int i = 1; i < a.length; ++i) { newA[i - 1] = a[i] * i; } - return new Double(newA); + return Double.valueOf(newA); } /** Returns a string representation of the polynomial. diff --git a/src/test/org/apache/commons/math/ConvergenceExceptionTest.java b/src/test/org/apache/commons/math/ConvergenceExceptionTest.java index d5e961270..c7e6f9af0 100644 --- a/src/test/org/apache/commons/math/ConvergenceExceptionTest.java +++ b/src/test/org/apache/commons/math/ConvergenceExceptionTest.java @@ -36,7 +36,7 @@ public class ConvergenceExceptionTest extends TestCase { public void testConstructorPatternArguments(){ String pattern = "a {0}x{1} matrix cannot be a rotation matrix"; - Object[] arguments = { new Integer(6), new Integer(4) }; + Object[] arguments = { Integer.valueOf(6), Integer.valueOf(4) }; ConvergenceException ex = new ConvergenceException(pattern, arguments); assertNull(ex.getCause()); assertEquals(pattern, ex.getPattern()); @@ -57,7 +57,7 @@ public class ConvergenceExceptionTest extends TestCase { public void testConstructorPatternArgumentsCause(){ String pattern = "a {0}x{1} matrix cannot be a rotation matrix"; - Object[] arguments = { new Integer(6), new Integer(4) }; + Object[] arguments = { Integer.valueOf(6), Integer.valueOf(4) }; String inMsg = "inner message"; Exception cause = new Exception(inMsg); ConvergenceException ex = new ConvergenceException(pattern, arguments, cause); diff --git a/src/test/org/apache/commons/math/FunctionEvaluationExceptionTest.java b/src/test/org/apache/commons/math/FunctionEvaluationExceptionTest.java index 707a58ba6..26a2124c3 100644 --- a/src/test/org/apache/commons/math/FunctionEvaluationExceptionTest.java +++ b/src/test/org/apache/commons/math/FunctionEvaluationExceptionTest.java @@ -36,7 +36,7 @@ public class FunctionEvaluationExceptionTest extends TestCase { public void testConstructorPatternArguments(){ String pattern = "Evaluation failed for argument = {0}"; - Object[] arguments = { new Double(0.0) }; + Object[] arguments = { Double.valueOf(0.0) }; FunctionEvaluationException ex = new FunctionEvaluationException(0.0, pattern, arguments); assertNull(ex.getCause()); assertEquals(pattern, ex.getPattern()); @@ -50,7 +50,7 @@ public class FunctionEvaluationExceptionTest extends TestCase { public void testConstructorPatternArgumentsCause(){ String pattern = "Evaluation failed for argument = {0}"; - Object[] arguments = { new Double(0.0) }; + Object[] arguments = { Double.valueOf(0.0) }; String inMsg = "inner message"; Exception cause = new Exception(inMsg); FunctionEvaluationException ex = new FunctionEvaluationException(0.0, pattern, arguments, cause); diff --git a/src/test/org/apache/commons/math/MathConfigurationExceptionTest.java b/src/test/org/apache/commons/math/MathConfigurationExceptionTest.java index 53b9743c3..340e5a345 100644 --- a/src/test/org/apache/commons/math/MathConfigurationExceptionTest.java +++ b/src/test/org/apache/commons/math/MathConfigurationExceptionTest.java @@ -35,7 +35,7 @@ public class MathConfigurationExceptionTest extends TestCase { public void testConstructorPatternArguments(){ String pattern = "a {0}x{1} matrix cannot be a rotation matrix"; - Object[] arguments = { new Integer(6), new Integer(4) }; + Object[] arguments = { Integer.valueOf(6), Integer.valueOf(4) }; MathConfigurationException ex = new MathConfigurationException(pattern, arguments); assertNull(ex.getCause()); assertEquals(pattern, ex.getPattern()); @@ -56,7 +56,7 @@ public class MathConfigurationExceptionTest extends TestCase { public void testConstructorPatternArgumentsCause(){ String pattern = "a {0}x{1} matrix cannot be a rotation matrix"; - Object[] arguments = { new Integer(6), new Integer(4) }; + Object[] arguments = { Integer.valueOf(6), Integer.valueOf(4) }; String inMsg = "inner message"; Exception cause = new Exception(inMsg); MathConfigurationException ex = new MathConfigurationException(pattern, arguments, cause); diff --git a/src/test/org/apache/commons/math/MathExceptionTest.java b/src/test/org/apache/commons/math/MathExceptionTest.java index f8af7cd3c..cbb3ab455 100644 --- a/src/test/org/apache/commons/math/MathExceptionTest.java +++ b/src/test/org/apache/commons/math/MathExceptionTest.java @@ -38,7 +38,7 @@ public class MathExceptionTest extends TestCase { public void testConstructorPatternArguments(){ String pattern = "a {0}x{1} matrix cannot be a rotation matrix"; - Object[] arguments = { new Integer(6), new Integer(4) }; + Object[] arguments = { Integer.valueOf(6), Integer.valueOf(4) }; MathException ex = new MathException(pattern, arguments); assertNull(ex.getCause()); assertEquals(pattern, ex.getPattern()); @@ -59,7 +59,7 @@ public class MathExceptionTest extends TestCase { public void testConstructorPatternArgumentsCause(){ String pattern = "a {0}x{1} matrix cannot be a rotation matrix"; - Object[] arguments = { new Integer(6), new Integer(4) }; + Object[] arguments = { Integer.valueOf(6), Integer.valueOf(4) }; String inMsg = "inner message"; Exception cause = new Exception(inMsg); MathException ex = new MathException(pattern, arguments, cause); diff --git a/src/test/org/apache/commons/math/MaxIterationsExceededExceptionTest.java b/src/test/org/apache/commons/math/MaxIterationsExceededExceptionTest.java index c748bfe25..5e60d25ea 100644 --- a/src/test/org/apache/commons/math/MaxIterationsExceededExceptionTest.java +++ b/src/test/org/apache/commons/math/MaxIterationsExceededExceptionTest.java @@ -39,7 +39,7 @@ public class MaxIterationsExceededExceptionTest extends TestCase { MaxIterationsExceededException ex = new MaxIterationsExceededException(1000000, "Continued fraction convergents failed to converge for value {0}", - new Object[] { new Double(1234567) }); + new Object[] { Double.valueOf(1234567) }); assertNull(ex.getCause()); assertNotNull(ex.getMessage()); assertTrue(ex.getMessage().indexOf("1,000,000") < 0); diff --git a/src/test/org/apache/commons/math/complex/ComplexFormatAbstractTest.java b/src/test/org/apache/commons/math/complex/ComplexFormatAbstractTest.java index 2260a0906..3c2ac5e96 100644 --- a/src/test/org/apache/commons/math/complex/ComplexFormatAbstractTest.java +++ b/src/test/org/apache/commons/math/complex/ComplexFormatAbstractTest.java @@ -334,7 +334,7 @@ public abstract class ComplexFormatAbstractTest extends TestCase { public void testFormatNumber() { ComplexFormat cf = ComplexFormat.getInstance(getLocale()); - Double pi = new Double(Math.PI); + Double pi = Double.valueOf(Math.PI); String text = cf.format(pi); assertEquals("3" + getDecimalCharacter() + "14", text); } diff --git a/src/test/org/apache/commons/math/fraction/FractionTest.java b/src/test/org/apache/commons/math/fraction/FractionTest.java index 6844fd9b9..7eb2bbdec 100644 --- a/src/test/org/apache/commons/math/fraction/FractionTest.java +++ b/src/test/org/apache/commons/math/fraction/FractionTest.java @@ -515,7 +515,7 @@ public class FractionTest extends TestCase { Fraction nullFraction = null; assertTrue( zero.equals(zero)); assertFalse(zero.equals(nullFraction)); - assertFalse(zero.equals(new Double(0))); + assertFalse(zero.equals(Double.valueOf(0))); Fraction zero2 = new Fraction(0,2); assertTrue(zero.equals(zero2)); assertEquals(zero.hashCode(), zero2.hashCode()); diff --git a/src/test/org/apache/commons/math/ode/HighamHall54IntegratorTest.java b/src/test/org/apache/commons/math/ode/HighamHall54IntegratorTest.java index be201b967..5ccb4b80d 100644 --- a/src/test/org/apache/commons/math/ode/HighamHall54IntegratorTest.java +++ b/src/test/org/apache/commons/math/ode/HighamHall54IntegratorTest.java @@ -184,7 +184,7 @@ public class HighamHall54IntegratorTest double offset = t - middle; if (offset > 0) { throw new SwitchException("Evaluation failed for argument = {0}", - new Object[] { new Double(t) }); + new Object[] { Double.valueOf(t) }); } return offset; } diff --git a/src/test/org/apache/commons/math/random/RandomDataTest.java b/src/test/org/apache/commons/math/random/RandomDataTest.java index ef40af134..03ef1678b 100644 --- a/src/test/org/apache/commons/math/random/RandomDataTest.java +++ b/src/test/org/apache/commons/math/random/RandomDataTest.java @@ -202,7 +202,7 @@ public class RandomDataTest extends RetryTestCase { f.getCount(3) + f.getCount(4) + f.getCount(5); long sumFreq = f.getSumFreq(); double cumPct = - new Double(cumFreq).doubleValue()/new Double(sumFreq).doubleValue(); + Double.valueOf(cumFreq).doubleValue()/Double.valueOf(sumFreq).doubleValue(); assertEquals("cum Poisson(4)",cumPct,0.7851,0.2); try { randomData.nextPoisson(-1); diff --git a/src/test/org/apache/commons/math/stat/FrequencyTest.java b/src/test/org/apache/commons/math/stat/FrequencyTest.java index 7aaca0b4b..31c6bbb66 100644 --- a/src/test/org/apache/commons/math/stat/FrequencyTest.java +++ b/src/test/org/apache/commons/math/stat/FrequencyTest.java @@ -71,7 +71,7 @@ public final class FrequencyTest extends TestCase { assertEquals("zero cumulative frequency", 0, f.getCumFreq(0)); assertEquals("one cumulative frequency", 3, f.getCumFreq(1)); assertEquals("two cumulative frequency", 4, f.getCumFreq(2)); - assertEquals("Integer argument cum freq",4, f.getCumFreq(new Integer(2))); + assertEquals("Integer argument cum freq",4, f.getCumFreq(Integer.valueOf(2))); assertEquals("five cumulative frequency", 4, f.getCumFreq(5)); assertEquals("foo cumulative frequency", 0, f.getCumFreq("foo")); @@ -92,14 +92,14 @@ public final class FrequencyTest extends TestCase { f = null; Frequency f = new Frequency(); f.addValue(1); - f.addValue(new Integer(1)); - f.addValue(new Long(1)); + f.addValue(Integer.valueOf(1)); + f.addValue(Long.valueOf(1)); f.addValue(2); - f.addValue(new Integer(-1)); + f.addValue(Integer.valueOf(-1)); assertEquals("1 count", 3, f.getCount(1)); - assertEquals("1 count", 3, f.getCount(new Integer(1))); + assertEquals("1 count", 3, f.getCount(Integer.valueOf(1))); assertEquals("0 cum pct", 0.2, f.getCumPct(0), tolerance); - assertEquals("1 pct", 0.6, f.getPct(new Integer(1)), tolerance); + assertEquals("1 pct", 0.6, f.getPct(Integer.valueOf(1)), tolerance); assertEquals("-2 cum pct", 0, f.getCumPct(-2), tolerance); assertEquals("10 cum pct", 1, f.getCumPct(10), tolerance); @@ -141,13 +141,13 @@ public final class FrequencyTest extends TestCase { f.addValue(3); f.addValue(threeI); assertEquals("one pct",0.25,f.getPct(1),tolerance); - assertEquals("two pct",0.25,f.getPct(new Long(2)),tolerance); + assertEquals("two pct",0.25,f.getPct(Long.valueOf(2)),tolerance); assertEquals("three pct",0.5,f.getPct(threeL),tolerance); assertEquals("five pct",0,f.getPct(5),tolerance); assertEquals("foo pct",0,f.getPct("foo"),tolerance); assertEquals("one cum pct",0.25,f.getCumPct(1),tolerance); - assertEquals("two cum pct",0.50,f.getCumPct(new Long(2)),tolerance); - assertEquals("Integer argument",0.50,f.getCumPct(new Integer(2)),tolerance); + assertEquals("two cum pct",0.50,f.getCumPct(Long.valueOf(2)),tolerance); + assertEquals("Integer argument",0.50,f.getCumPct(Integer.valueOf(2)),tolerance); assertEquals("three cum pct",1.0,f.getCumPct(threeL),tolerance); assertEquals("five cum pct",1.0,f.getCumPct(5),tolerance); assertEquals("zero cum pct",0.0,f.getCumPct(0),tolerance); @@ -177,13 +177,13 @@ public final class FrequencyTest extends TestCase { public void testEmptyTable() { assertEquals("freq sum, empty table", 0, f.getSumFreq()); assertEquals("count, empty table", 0, f.getCount(0)); - assertEquals("count, empty table",0, f.getCount(new Integer(0))); + assertEquals("count, empty table",0, f.getCount(Integer.valueOf(0))); assertEquals("cum freq, empty table", 0, f.getCumFreq(0)); assertEquals("cum freq, empty table", 0, f.getCumFreq("x")); assertTrue("pct, empty table", Double.isNaN(f.getPct(0))); - assertTrue("pct, empty table", Double.isNaN(f.getPct(new Integer(0)))); + assertTrue("pct, empty table", Double.isNaN(f.getPct(Integer.valueOf(0)))); assertTrue("cum pct, empty table", Double.isNaN(f.getCumPct(0))); - assertTrue("cum pct, empty table", Double.isNaN(f.getCumPct(new Integer(0)))); + assertTrue("cum pct, empty table", Double.isNaN(f.getCumPct(Integer.valueOf(0)))); } /** @@ -217,18 +217,18 @@ public final class FrequencyTest extends TestCase { } public void testIntegerValues() { Object obj1 = null; - obj1 = new Integer(1); - Integer int1 = new Integer(1); + obj1 = Integer.valueOf(1); + Integer int1 = Integer.valueOf(1); f.addValue(obj1); f.addValue(int1); f.addValue(2); - f.addValue(new Long(2)); + f.addValue(Long.valueOf(2)); assertEquals("Integer 1 count", 2, f.getCount(1)); - assertEquals("Integer 1 count", 2, f.getCount(new Integer(1))); - assertEquals("Integer 1 count", 2, f.getCount(new Long(1))); + assertEquals("Integer 1 count", 2, f.getCount(Integer.valueOf(1))); + assertEquals("Integer 1 count", 2, f.getCount(Long.valueOf(1))); assertEquals("Integer 1 cumPct", 0.5, f.getCumPct(1), tolerance); - assertEquals("Integer 1 cumPct", 0.5, f.getCumPct(new Long(1)), tolerance); - assertEquals("Integer 1 cumPct", 0.5, f.getCumPct(new Integer(1)), tolerance); + assertEquals("Integer 1 cumPct", 0.5, f.getCumPct(Long.valueOf(1)), tolerance); + assertEquals("Integer 1 cumPct", 0.5, f.getCumPct(Integer.valueOf(1)), tolerance); Iterator it = f.valuesIterator(); while (it.hasNext()) { assertTrue(it.next() instanceof Long); diff --git a/src/test/org/apache/commons/math/stat/data/CertifiedDataAbstractTest.java b/src/test/org/apache/commons/math/stat/data/CertifiedDataAbstractTest.java index 77af4d7e0..252a95acd 100644 --- a/src/test/org/apache/commons/math/stat/data/CertifiedDataAbstractTest.java +++ b/src/test/org/apache/commons/math/stat/data/CertifiedDataAbstractTest.java @@ -78,7 +78,7 @@ public abstract class CertifiedDataAbstractTest extends TestCase { // certified value String name = line.substring(0, n).trim(); String valueString = line.substring(n + 1).trim(); - Double value = new Double(valueString); + Double value = Double.valueOf(valueString); certifiedValues.put(name, value); } } @@ -138,7 +138,7 @@ public abstract class CertifiedDataAbstractTest extends TestCase { if (meth.getReturnType().equals(Double.TYPE)) { return (Double) property; } else if (meth.getReturnType().equals(Long.TYPE)) { - return new Double(((Long) property).doubleValue()); + return Double.valueOf(((Long) property).doubleValue()); } else { fail("wrong type: " + meth.getReturnType().getName()); } diff --git a/src/test/org/apache/commons/math/stat/descriptive/ListUnivariateImpl.java b/src/test/org/apache/commons/math/stat/descriptive/ListUnivariateImpl.java index c0d9eb037..7f1f84678 100644 --- a/src/test/org/apache/commons/math/stat/descriptive/ListUnivariateImpl.java +++ b/src/test/org/apache/commons/math/stat/descriptive/ListUnivariateImpl.java @@ -143,7 +143,7 @@ public class ListUnivariateImpl extends DescriptiveStatistics implements Seriali * @see org.apache.commons.math.stat.descriptive.DescriptiveStatistics#addValue(double) */ public void addValue(double v) { - list.add(new Double(v)); + list.add(Double.valueOf(v)); } /** diff --git a/src/test/org/apache/commons/math/stat/descriptive/ListUnivariateImplTest.java b/src/test/org/apache/commons/math/stat/descriptive/ListUnivariateImplTest.java index 2a5c93ed0..f9fdf81d9 100644 --- a/src/test/org/apache/commons/math/stat/descriptive/ListUnivariateImplTest.java +++ b/src/test/org/apache/commons/math/stat/descriptive/ListUnivariateImplTest.java @@ -92,7 +92,7 @@ public final class ListUnivariateImplTest extends TestCase { assertTrue("Standard Deviation of n = 0 set should be NaN", Double.isNaN( u.getStandardDeviation() ) ); assertTrue("Variance of n = 0 set should be NaN", Double.isNaN(u.getVariance() ) ); - list.add( new Double(one)); + list.add( Double.valueOf(one)); assertTrue( "Mean of n = 1 set should be value of single item n1", u.getMean() == one); assertTrue( "StdDev of n = 1 set should be zero, instead it is: " + u.getStandardDeviation(), u.getStandardDeviation() == 0); diff --git a/src/test/org/apache/commons/math/stat/descriptive/MixedListUnivariateImplTest.java b/src/test/org/apache/commons/math/stat/descriptive/MixedListUnivariateImplTest.java index 210d2a461..c7f74759f 100644 --- a/src/test/org/apache/commons/math/stat/descriptive/MixedListUnivariateImplTest.java +++ b/src/test/org/apache/commons/math/stat/descriptive/MixedListUnivariateImplTest.java @@ -123,22 +123,22 @@ public final class MixedListUnivariateImplTest extends TestCase { new ListUnivariateImpl(new ArrayList