diff --git a/project.properties b/project.properties index 03b0479a3..74c058e69 100644 --- a/project.properties +++ b/project.properties @@ -40,3 +40,5 @@ maven.javadoc.links = http://java.sun.com/j2se/1.4.2/docs/api/,\ maven.changes.issue.template=http://issues.apache.org/bugzilla/show_bug.cgi?id=%ISSUE% +maven.jar.override = on +maven.jar.clover = 1.3.2 diff --git a/src/java/org/apache/commons/math/distribution/CauchyDistribution.java b/src/java/org/apache/commons/math/distribution/CauchyDistribution.java index 44b4b1a16..4c4b7dd0e 100644 --- a/src/java/org/apache/commons/math/distribution/CauchyDistribution.java +++ b/src/java/org/apache/commons/math/distribution/CauchyDistribution.java @@ -29,6 +29,7 @@ package org.apache.commons.math.distribution; * *
* + * @since 1.1 * @version $Revision$ $Date$ */ public interface CauchyDistribution extends ContinuousDistribution { diff --git a/src/java/org/apache/commons/math/distribution/CauchyDistributionImpl.java b/src/java/org/apache/commons/math/distribution/CauchyDistributionImpl.java index cbcc22298..4b763e4dd 100644 --- a/src/java/org/apache/commons/math/distribution/CauchyDistributionImpl.java +++ b/src/java/org/apache/commons/math/distribution/CauchyDistributionImpl.java @@ -22,7 +22,8 @@ import java.io.Serializable; * Default implementation of * {@link org.apache.commons.math.distribution.CauchyDistribution}. * - * @version $Revision: 1.13 $ $Date$ + * @since 1.1 + * @version $Revision$ $Date$ */ public class CauchyDistributionImpl extends AbstractContinuousDistribution implements CauchyDistribution, Serializable { diff --git a/src/java/org/apache/commons/math/distribution/DistributionFactory.java b/src/java/org/apache/commons/math/distribution/DistributionFactory.java index beb485276..5f8b2243f 100644 --- a/src/java/org/apache/commons/math/distribution/DistributionFactory.java +++ b/src/java/org/apache/commons/math/distribution/DistributionFactory.java @@ -85,6 +85,7 @@ public abstract class DistributionFactory { * @param median the median of the distribution * @param scale the scale * @return a new cauchy distribution + * @since 1.1 */ public CauchyDistribution createCauchyDistribution( double median, double scale) @@ -188,6 +189,7 @@ public abstract class DistributionFactory { * @param alpha the shape parameter. * @param beta the scale parameter. * @return a new Weibull distribution. + * @since 1.1 */ public WeibullDistribution createWeibullDistribution( double alpha, double beta) diff --git a/src/java/org/apache/commons/math/distribution/WeibullDistribution.java b/src/java/org/apache/commons/math/distribution/WeibullDistribution.java index 3333f051f..90230d696 100644 --- a/src/java/org/apache/commons/math/distribution/WeibullDistribution.java +++ b/src/java/org/apache/commons/math/distribution/WeibullDistribution.java @@ -33,6 +33,7 @@ package org.apache.commons.math.distribution; * * * + * @since 1.1 * @version $Revision: 1.12 $ $Date: 2004-06-23 11:26:18 -0500 (Wed, 23 Jun 2004) $ */ public interface WeibullDistribution extends ContinuousDistribution { diff --git a/src/java/org/apache/commons/math/distribution/WeibullDistributionImpl.java b/src/java/org/apache/commons/math/distribution/WeibullDistributionImpl.java index 3d1dfef8b..2d397be4d 100644 --- a/src/java/org/apache/commons/math/distribution/WeibullDistributionImpl.java +++ b/src/java/org/apache/commons/math/distribution/WeibullDistributionImpl.java @@ -22,6 +22,7 @@ import java.io.Serializable; * Default implementation of * {@link org.apache.commons.math.distribution.WeibullDistribution}. * + * @since 1.1 * @version $Revision: 1.13 $ $Date: 2004-07-24 16:41:37 -0500 (Sat, 24 Jul 2004) $ */ public class WeibullDistributionImpl extends AbstractContinuousDistribution @@ -64,16 +65,16 @@ public class WeibullDistributionImpl extends AbstractContinuousDistribution } /** - * Access alpha. - * @return the alpha. + * Access the shape parameter. + * @return the shape parameter. */ public double getShape() { return alpha; } /** - * Access beta. - * @return the beta. + * Access the scale parameter. + * @return the scale parameter. */ public double getScale() { return beta; @@ -107,8 +108,8 @@ public class WeibullDistributionImpl extends AbstractContinuousDistribution } /** - * Modify alpha. - * @param alpha The new alpha value. + * Modify the shape parameter. + * @param alpha the new shape parameter value. */ public void setShape(double alpha) { if (alpha <= 0.0) { @@ -119,8 +120,8 @@ public class WeibullDistributionImpl extends AbstractContinuousDistribution } /** - * Modify beta. - * @param beta The new beta value. + * Modify the scale parameter. + * @param beta the new scale parameter value. */ public void setScale(double beta) { if (beta <= 0.0) { diff --git a/src/java/org/apache/commons/math/fraction/Fraction.java b/src/java/org/apache/commons/math/fraction/Fraction.java index 625d84c5b..bed82d73b 100644 --- a/src/java/org/apache/commons/math/fraction/Fraction.java +++ b/src/java/org/apache/commons/math/fraction/Fraction.java @@ -22,7 +22,7 @@ import org.apache.commons.math.util.MathUtils; /** * Representation of a rational number. * - * @author Apache Software Foundation + * @since 1.1 * @version $Revision$ $Date$ */ public class Fraction extends Number implements Comparable { diff --git a/src/java/org/apache/commons/math/fraction/FractionFormat.java b/src/java/org/apache/commons/math/fraction/FractionFormat.java index 1971b08eb..8c6e1a2a2 100644 --- a/src/java/org/apache/commons/math/fraction/FractionFormat.java +++ b/src/java/org/apache/commons/math/fraction/FractionFormat.java @@ -31,7 +31,7 @@ import org.apache.commons.math.ConvergenceException; * format for each of the whole number, numerator and, denominator can be * configured. * - * @author Apache Software Foundation + * @since 1.1 * @version $Revision$ $Date$ */ public class FractionFormat extends Format implements Serializable { diff --git a/src/java/org/apache/commons/math/fraction/ProperFractionFormat.java b/src/java/org/apache/commons/math/fraction/ProperFractionFormat.java index 80bab58b3..0da7f823c 100644 --- a/src/java/org/apache/commons/math/fraction/ProperFractionFormat.java +++ b/src/java/org/apache/commons/math/fraction/ProperFractionFormat.java @@ -25,7 +25,7 @@ import org.apache.commons.math.util.MathUtils; * Formats a Fraction number in proper format. The number format for each of * the whole number, numerator and, denominator can be configured. * - * @author Apache Software Foundation + * @since 1.1 * @version $Revision$ $Date$ */ public class ProperFractionFormat extends FractionFormat { diff --git a/src/java/org/apache/commons/math/random/AbstractRandomGenerator.java b/src/java/org/apache/commons/math/random/AbstractRandomGenerator.java index dc8e184c2..c89272c86 100644 --- a/src/java/org/apache/commons/math/random/AbstractRandomGenerator.java +++ b/src/java/org/apache/commons/math/random/AbstractRandomGenerator.java @@ -1,12 +1,12 @@ /* * Copyright 2005 The Apache Software Foundation. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,6 +26,7 @@ package org.apache.commons.math.random; * performant implementations of the other methods if the underlying PRNG * supplies them. * + * @since 1.1 * @version $Revision$ $Date$ */ public abstract class AbstractRandomGenerator implements RandomGenerator { diff --git a/src/java/org/apache/commons/math/random/JDKRandomGenerator.java b/src/java/org/apache/commons/math/random/JDKRandomGenerator.java index ce263b688..711dfbc8b 100644 --- a/src/java/org/apache/commons/math/random/JDKRandomGenerator.java +++ b/src/java/org/apache/commons/math/random/JDKRandomGenerator.java @@ -1,12 +1,12 @@ /* * Copyright 2005 The Apache Software Foundation. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,6 +21,7 @@ import java.util.Random; * Extension ofjava.util.Random
to implement
* {@link RandomGenerator}.
*
+ * @since 1.1
* @version $Revision:$ $Date$
*/
public class JDKRandomGenerator extends Random implements RandomGenerator {
diff --git a/src/java/org/apache/commons/math/random/RandomDataImpl.java b/src/java/org/apache/commons/math/random/RandomDataImpl.java
index 0147caed1..42d92f375 100644
--- a/src/java/org/apache/commons/math/random/RandomDataImpl.java
+++ b/src/java/org/apache/commons/math/random/RandomDataImpl.java
@@ -100,6 +100,7 @@ public class RandomDataImpl implements RandomData, Serializable {
* as the source of (non-secure) random data.
*
* @param rand the source of (non-secure) random data
+ * @since 1.1
*/
public RandomDataImpl(RandomGenerator rand) {
super();
@@ -290,7 +291,7 @@ public class RandomDataImpl implements RandomData, Serializable {
* Algorithm Description:
* Uses simulation of a Poisson process using Uniform deviates, as
* described
- *
+ *
* here.
*
* The Poisson process (and hence value returned) is bounded by
@@ -396,6 +397,7 @@ public class RandomDataImpl implements RandomData, Serializable {
* Creates and initializes a default generator if null.
*
* @return the Random used to generate random data
+ * @since 1.1
*/
private RandomGenerator getRan() {
if (rand == null) {
diff --git a/src/java/org/apache/commons/math/random/RandomGenerator.java b/src/java/org/apache/commons/math/random/RandomGenerator.java
index 582f96abb..be9b03a0a 100644
--- a/src/java/org/apache/commons/math/random/RandomGenerator.java
+++ b/src/java/org/apache/commons/math/random/RandomGenerator.java
@@ -1,12 +1,12 @@
/*
* Copyright 2005 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,6 +19,7 @@ package org.apache.commons.math.random;
* Interface extracted from java.util.Random
. This interface is
* implemented by {@link AbstractRandomGenerator}.
*
+ * @since 1.1
* @version $Revision:$ $Date$
*/
public interface RandomGenerator {
diff --git a/src/java/org/apache/commons/math/random/ValueServer.java b/src/java/org/apache/commons/math/random/ValueServer.java
index b8c52ed34..177fe6285 100644
--- a/src/java/org/apache/commons/math/random/ValueServer.java
+++ b/src/java/org/apache/commons/math/random/ValueServer.java
@@ -358,6 +358,7 @@ public class ValueServer {
* of random data.
*
* @param randomData the RandomData instance used to source random data
+ * @since 1.1
*/
public ValueServer(RandomData randomData) {
super();
diff --git a/src/java/org/apache/commons/math/util/MathUtils.java b/src/java/org/apache/commons/math/util/MathUtils.java
index 20a9ddc9e..207275276 100644
--- a/src/java/org/apache/commons/math/util/MathUtils.java
+++ b/src/java/org/apache/commons/math/util/MathUtils.java
@@ -55,6 +55,7 @@ public final class MathUtils {
* @param x the value to round.
* @param scale the number of digits to the right of the decimal point.
* @return the rounded value.
+ * @since 1.1
*/
public static double round(double x, int scale) {
return round(x, scale, BigDecimal.ROUND_HALF_UP);
@@ -69,6 +70,7 @@ public final class MathUtils {
* @param roundingMethod the rounding method as defined in
* {@link BigDecimal}.
* @return the rounded value.
+ * @since 1.1
*/
public static double round(
double x, int scale, int roundingMethod)
@@ -83,6 +85,7 @@ public final class MathUtils {
* @param x the value to round.
* @param scale the number of digits to the right of the decimal point.
* @return the rounded value.
+ * @since 1.1
*/
public static float round(float x, int scale) {
return round(x, scale, BigDecimal.ROUND_HALF_UP);
@@ -97,6 +100,7 @@ public final class MathUtils {
* @param roundingMethod the rounding method as defined in
* {@link BigDecimal}.
* @return the rounded value.
+ * @since 1.1
*/
public static float round(float x, int scale, int roundingMethod) {
return (new BigDecimal(x).setScale(scale, roundingMethod)).floatValue();
diff --git a/src/test/org/apache/commons/math/fraction/FractionTest.java b/src/test/org/apache/commons/math/fraction/FractionTest.java
index f7ded2ced..cbc8973cc 100644
--- a/src/test/org/apache/commons/math/fraction/FractionTest.java
+++ b/src/test/org/apache/commons/math/fraction/FractionTest.java
@@ -39,6 +39,63 @@ public class FractionTest extends TestCase {
assertFraction(-1, 2, new Fraction(1, -2));
assertFraction(-1, 2, new Fraction(-2, 4));
assertFraction(-1, 2, new Fraction(2, -4));
+
+ // overflow
+ try {
+ new Fraction(Integer.MIN_VALUE, -1);
+ fail();
+ } catch (ArithmeticException ex) {
+ // success
+ }
+ try {
+ new Fraction(1, Integer.MIN_VALUE);
+ fail();
+ } catch (ArithmeticException ex) {
+ // success
+ }
+ }
+
+ public void testCompareTo() {
+ Fraction first = new Fraction(1, 2);
+ Fraction second = new Fraction(1, 3);
+ Fraction third = new Fraction(1, 2);
+
+ assertEquals(0, first.compareTo(first));
+ assertEquals(0, first.compareTo(third));
+ assertEquals(1, first.compareTo(second));
+ assertEquals(-1, second.compareTo(first));
+ }
+
+ public void testDoubleValue() {
+ Fraction first = new Fraction(1, 2);
+ Fraction second = new Fraction(1, 3);
+
+ assertEquals(0.5, first.doubleValue(), 0.0);
+ assertEquals(1.0 / 3.0, second.doubleValue(), 0.0);
+ }
+
+ public void testFloatValue() {
+ Fraction first = new Fraction(1, 2);
+ Fraction second = new Fraction(1, 3);
+
+ assertEquals(0.5f, first.floatValue(), 0.0f);
+ assertEquals((float)(1.0 / 3.0), second.floatValue(), 0.0f);
+ }
+
+ public void testIntValue() {
+ Fraction first = new Fraction(1, 2);
+ Fraction second = new Fraction(3, 2);
+
+ assertEquals(0, first.intValue());
+ assertEquals(1, second.intValue());
+ }
+
+ public void testLongValue() {
+ Fraction first = new Fraction(1, 2);
+ Fraction second = new Fraction(3, 2);
+
+ assertEquals(0L, first.longValue());
+ assertEquals(1L, second.longValue());
}
public void testConstructorDouble() {
diff --git a/xdocs/developers.xml b/xdocs/developers.xml
index 5d49e8577..4ec90ff01 100644
--- a/xdocs/developers.xml
+++ b/xdocs/developers.xml
@@ -74,7 +74,7 @@
Setup an account on Bugzilla and use it to submit patches and
identify bugs. Read the
-
+
directions for submitting bugs and search the database to
determine if an issue exists or has already been dealt with.
diff --git a/xdocs/userguide/index.xml b/xdocs/userguide/index.xml index 0b6b0a3d0..ec21380af 100644 --- a/xdocs/userguide/index.xml +++ b/xdocs/userguide/index.xml @@ -29,74 +29,73 @@
- Commons Math is divided into eight subpackages, based on functionality provided. + Commons Math is divided into nine subpackages, based on functionality provided.
Using the ValueServer
class, you can generate data based on the
values in an input file in one of two ways: