You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2010/09/28 14:38:10 UTC
svn commit: r1002145 - in /commons/proper/math/trunk/src:
main/java/org/apache/commons/math/distribution/
test/java/org/apache/commons/math/distribution/
Author: erans
Date: Tue Sep 28 12:38:09 2010
New Revision: 1002145
URL: http://svn.apache.org/viewvc?rev=1002145&view=rev
Log:
Removed deprecated code.
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/NormalDistribution.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/NormalDistributionImpl.java
commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/NormalDistributionTest.java
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/NormalDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/NormalDistribution.java?rev=1002145&r1=1002144&r2=1002145&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/NormalDistribution.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/NormalDistribution.java Tue Sep 28 12:38:09 2010
@@ -30,36 +30,26 @@ package org.apache.commons.math.distribu
*
* @version $Revision$ $Date$
*/
-public interface NormalDistribution extends ContinuousDistribution, HasDensity<Double> {
+public interface NormalDistribution extends ContinuousDistribution {
/**
* Access the mean.
- * @return mean for this distribution
+ *
+ * @return the mean for this distribution.
*/
double getMean();
- /**
- * Modify the mean.
- * @param mean for this distribution
- * @deprecated as of v2.1
- */
- @Deprecated
- void setMean(double mean);
+
/**
* Access the standard deviation.
- * @return standard deviation for this distribution
+ *
+ * @return the standard deviation for this distribution.
*/
double getStandardDeviation();
- /**
- * Modify the standard deviation.
- * @param sd standard deviation for this distribution
- * @deprecated as of v2.1
- */
- @Deprecated
- void setStandardDeviation(double sd);
/**
* Return the probability density for a particular point.
- * @param x The point at which the density should be computed.
- * @return The pdf at point x.
+ *
+ * @param x Point at which the density should be computed.
+ * @return the pdf at point {@code x}.
*/
- double density(Double x);
+ double density(double x);
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/NormalDistributionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/NormalDistributionImpl.java?rev=1002145&r1=1002144&r2=1002145&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/NormalDistributionImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/NormalDistributionImpl.java Tue Sep 28 12:38:09 2010
@@ -20,7 +20,7 @@ package org.apache.commons.math.distribu
import java.io.Serializable;
import org.apache.commons.math.MathException;
-import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.exception.NotStrictlyPositiveException;
import org.apache.commons.math.MaxIterationsExceededException;
import org.apache.commons.math.exception.util.LocalizedFormats;
import org.apache.commons.math.special.Erf;
@@ -34,26 +34,20 @@ import org.apache.commons.math.util.Fast
*/
public class NormalDistributionImpl extends AbstractContinuousDistribution
implements NormalDistribution, Serializable {
-
/**
* Default inverse cumulative probability accuracy
* @since 2.1
*/
public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;
-
- /** Serializable version identifier */
+ /** Serializable version identifier. */
private static final long serialVersionUID = 8589540077390120676L;
-
/** &sqrt;(2 π) */
private static final double SQRT2PI = FastMath.sqrt(2 * FastMath.PI);
-
- /** The mean of this distribution. */
+ /** Mean of this distribution. */
private double mean = 0;
-
- /** The standard deviation of this distribution. */
+ /** Standard deviation of this distribution. */
private double standardDeviation = 1;
-
- /** Inverse cumulative probability accuracy */
+ /** Inverse cumulative probability accuracy. */
private final double solverAbsoluteAccuracy;
/**
@@ -69,113 +63,61 @@ public class NormalDistributionImpl exte
* Create a normal distribution using the given mean, standard deviation and
* inverse cumulative distribution accuracy.
*
- * @param mean mean for this distribution
- * @param sd standard deviation for this distribution
- * @param inverseCumAccuracy inverse cumulative probability accuracy
+ * @param mean Mean for this distribution.
+ * @param sd Standard deviation for this distribution.
+ * @param inverseCumAccuracy inverse cumulative probability accuracy.
+ * @throws NotStrictlyPositiveException if {@code sd <= 0}.
* @since 2.1
*/
public NormalDistributionImpl(double mean, double sd, double inverseCumAccuracy) {
- super();
- setMeanInternal(mean);
- setStandardDeviationInternal(sd);
+ if (sd <= 0) {
+ throw new NotStrictlyPositiveException(LocalizedFormats.STANDARD_DEVIATION, sd);
+ }
+
+ this.mean = mean;
+ standardDeviation = sd;
solverAbsoluteAccuracy = inverseCumAccuracy;
}
/**
- * Creates normal distribution with the mean equal to zero and standard
+ * Create a normal distribution with mean equal to zero and standard
* deviation equal to one.
*/
public NormalDistributionImpl(){
- this(0.0, 1.0);
+ this(0, 1);
}
/**
- * Access the mean.
- * @return mean for this distribution
+ * {@inheritDoc}
*/
public double getMean() {
return mean;
}
/**
- * Modify the mean.
- * @param mean for this distribution
- * @deprecated as of 2.1 (class will become immutable in 3.0)
- */
- @Deprecated
- public void setMean(double mean) {
- setMeanInternal(mean);
- }
- /**
- * Modify the mean.
- * @param newMean for this distribution
- */
- private void setMeanInternal(double newMean) {
- this.mean = newMean;
- }
-
- /**
- * Access the standard deviation.
- * @return standard deviation for this distribution
+ * {@inheritDoc}
*/
public double getStandardDeviation() {
return standardDeviation;
}
/**
- * Modify the standard deviation.
- * @param sd standard deviation for this distribution
- * @throws IllegalArgumentException if <code>sd</code> is not positive.
- * @deprecated as of 2.1 (class will become immutable in 3.0)
- */
- @Deprecated
- public void setStandardDeviation(double sd) {
- setStandardDeviationInternal(sd);
- }
- /**
- * Modify the standard deviation.
- * @param sd standard deviation for this distribution
- * @throws IllegalArgumentException if <code>sd</code> is not positive.
- */
- private void setStandardDeviationInternal(double sd) {
- if (sd <= 0.0) {
- throw MathRuntimeException.createIllegalArgumentException(
- LocalizedFormats.NOT_POSITIVE_STANDARD_DEVIATION,
- sd);
- }
- standardDeviation = sd;
- }
-
- /**
- * Return the probability density for a particular point.
- *
- * @param x The point at which the density should be computed.
- * @return The pdf at point x.
- * @deprecated
- */
- public double density(Double x) {
- return density(x.doubleValue());
- }
-
- /**
- * Returns the probability density for a particular point.
- *
- * @param x The point at which the density should be computed.
- * @return The pdf at point x.
- * @since 2.1
+ * {@inheritDoc}
*/
public double density(double x) {
- double x0 = x - mean;
- return FastMath.exp(-x0 * x0 / (2 * standardDeviation * standardDeviation)) / (standardDeviation * SQRT2PI);
+ final double x0 = x - mean;
+ final double x1 = x0 / standardDeviation;
+ return FastMath.exp(-0.5 * x1 * x1) / (standardDeviation * SQRT2PI);
}
/**
- * For this distribution, X, this method returns P(X < <code>x</code>).
- * @param x the value at which the CDF is evaluated.
- * @return CDF evaluted at <code>x</code>.
+ * For this distribution, {@code X}, this method returns {@code P(X < x)}.
+ *
+ * @param x Value at which the CDF is evaluated.
+ * @return CDF evaluted at {@code x}.
* @throws MathException if the algorithm fails to converge; unless
- * x is more than 20 standard deviations from the mean, in which case the
- * convergence exception is caught and 0 or 1 is returned.
+ * {@code x} is more than 20 standard deviations from the mean, in which
+ * case the convergence exception is caught and 0 or 1 is returned.
*/
public double cumulativeProbability(double x) throws MathException {
try {
@@ -183,9 +125,9 @@ public class NormalDistributionImpl exte
(standardDeviation * FastMath.sqrt(2.0))));
} catch (MaxIterationsExceededException ex) {
if (x < (mean - 20 * standardDeviation)) { // JDK 1.5 blows at 38
- return 0.0d;
+ return 0;
} else if (x > (mean + 20 * standardDeviation)) {
- return 1.0d;
+ return 1;
} else {
throw ex;
}
@@ -205,14 +147,13 @@ public class NormalDistributionImpl exte
}
/**
- * For this distribution, X, this method returns the critical point x, such
- * that P(X < x) = <code>p</code>.
- * <p>
- * Returns <code>Double.NEGATIVE_INFINITY</code> for p=0 and
- * <code>Double.POSITIVE_INFINITY</code> for p=1.</p>
+ * For this distribution, X, this method returns the critical point
+ * {@code x}, such that {@code P(X < x) = p}.
+ * Returns {@code Double.NEGATIVE_INFINITY} when p = 0 and
+ * {@code Double.POSITIVE_INFINITY} for p = 1.
*
* @param p the desired probability
- * @return x, such that P(X < x) = <code>p</code>
+ * @return {@code x}, such that {@code P(X < x) = p}.
* @throws MathException if the inverse cumulative probability can not be
* computed due to convergence or other numerical errors.
* @throws IllegalArgumentException if <code>p</code> is not a valid
@@ -243,19 +184,18 @@ public class NormalDistributionImpl exte
}
/**
- * Access the domain value lower bound, based on <code>p</code>, used to
+ * Access the domain value lower bound, based on {@code p}, used to
* bracket a CDF root. This method is used by
* {@link #inverseCumulativeProbability(double)} to find critical values.
*
* @param p the desired probability for the critical value
- * @return domain value lower bound, i.e.
- * P(X < <i>lower bound</i>) < <code>p</code>
+ * @return domain value lower bound, i.e. {@code P(X < 'lower bound') < p}.
*/
@Override
protected double getDomainLowerBound(double p) {
double ret;
- if (p < .5) {
+ if (p < 0.5) {
ret = -Double.MAX_VALUE;
} else {
ret = mean;
@@ -265,19 +205,18 @@ public class NormalDistributionImpl exte
}
/**
- * Access the domain value upper bound, based on <code>p</code>, used to
+ * Access the domain value upper bound, based on {@code p}, used to
* bracket a CDF root. This method is used by
* {@link #inverseCumulativeProbability(double)} to find critical values.
*
* @param p the desired probability for the critical value
- * @return domain value upper bound, i.e.
- * P(X < <i>upper bound</i>) > <code>p</code>
+ * @return domain value upper bound, i.e. {@code P(X < 'upper bound') > p}.
*/
@Override
protected double getDomainUpperBound(double p) {
double ret;
- if (p < .5) {
+ if (p < 0.5) {
ret = mean;
} else {
ret = Double.MAX_VALUE;
@@ -287,7 +226,7 @@ public class NormalDistributionImpl exte
}
/**
- * Access the initial domain value, based on <code>p</code>, used to
+ * Access the initial domain value, based on {@code p}, used to
* bracket a CDF root. This method is used by
* {@link #inverseCumulativeProbability(double)} to find critical values.
*
@@ -298,9 +237,9 @@ public class NormalDistributionImpl exte
protected double getInitialDomain(double p) {
double ret;
- if (p < .5) {
+ if (p < 0.5) {
ret = mean - standardDeviation;
- } else if (p > .5) {
+ } else if (p > 0.5) {
ret = mean + standardDeviation;
} else {
ret = mean;
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/NormalDistributionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/NormalDistributionTest.java?rev=1002145&r1=1002144&r2=1002145&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/NormalDistributionTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/NormalDistributionTest.java Tue Sep 28 12:38:09 2010
@@ -18,6 +18,7 @@
package org.apache.commons.math.distribution;
import org.apache.commons.math.MathException;
+import org.apache.commons.math.exception.NotStrictlyPositiveException;
import org.apache.commons.math.util.FastMath;
/**
@@ -121,29 +122,16 @@ public class NormalDistributionTest exte
assertEquals(2.1, distribution.getMean(), 0);
}
- public void testSetMean() throws Exception {
- double mu = FastMath.random();
- NormalDistribution distribution = (NormalDistribution) getDistribution();
- distribution.setMean(mu);
- verifyQuantiles();
- }
-
public void testGetStandardDeviation() {
NormalDistribution distribution = (NormalDistribution) getDistribution();
assertEquals(1.4, distribution.getStandardDeviation(), 0);
}
- public void testSetStandardDeviation() throws Exception {
- double sigma = 0.1d + FastMath.random();
- NormalDistribution distribution = (NormalDistribution) getDistribution();
- distribution.setStandardDeviation(sigma);
- assertEquals(sigma, distribution.getStandardDeviation(), 0);
- verifyQuantiles();
+ public void testPreconditions() {
try {
- distribution.setStandardDeviation(0);
- fail("Expecting IllegalArgumentException for sd = 0");
- } catch (IllegalArgumentException ex) {
- // Expected
+ NormalDistribution distribution = new NormalDistributionImpl(1, 0);
+ } catch (NotStrictlyPositiveException e) {
+ // Expected.
}
}
@@ -167,9 +155,7 @@ public class NormalDistributionTest exte
* Verifies fix for JIRA MATH-167
*/
public void testExtremeValues() throws Exception {
- NormalDistribution distribution = (NormalDistribution) getDistribution();
- distribution.setMean(0);
- distribution.setStandardDeviation(1);
+ NormalDistribution distribution = new NormalDistributionImpl(0, 1);
for (int i = 0; i < 100; i+=5) { // make sure no convergence exception
double lowerTail = distribution.cumulativeProbability(-i);
double upperTail = distribution.cumulativeProbability(i);
Re: svn commit: r1002145 - in /commons/proper/math/trunk/src:
main/java/org/apache/commons/math/distribution/ test/java/org/apache/commons/math/distribution/
Posted by sebb <se...@gmail.com>.
On 28 September 2010 16:18, Luc Maisonobe <Lu...@free.fr> wrote:
> Le 28/09/2010 16:56, sebb a écrit :
>> On 28 September 2010 15:42, Luc Maisonobe <Lu...@free.fr> wrote:
>>> Le 28/09/2010 16:25, Gilles Sadowski a écrit :
>>>>>
>>>>> It seems some recent changes break compilation. Not in this specific
>>>>> set, but probably one of the previous ones from today or yesterday.
>>>>
>>>> Break compilation?
>>>> "mvn clean site" produces a "BUILD SUCCESSFUL" here.
>>>>
>>>>> The problems are some @Override annotations in BetaDistributionImpl
>>>>> (getAlpha, getBeta), GammaDistributionImpl (getalpha, getBeta) and
>>>>> ExponentialDistributionImpl (getMean). They directly implement
>>>>> interfaces and do not extend a superclass, so the Override annotation
>>>>> generates an error (at least on Eclipse).
>>>>
>>>> So, does that mean that Eclipse refuses to compile because of annotations?
>>>
>>> Yes.
>>>
>>>> Seems a bug in Eclipse...
>>
>> It's an incompatibilty between Java 1.5 and Java 1.6.
>>
>>> No, it is the expected behaviour, or at least it is what I understand
>>> from this:
>>> <http://java.sun.com/docs/books/jls/third_edition/html/interfaces.html#9.6.1.4>
>>>
>>> "Note that if a method overrides a method from a superinterface but
>>> not from a superclass, using @Override will cause a compile-time
>>> error."
>>>
>>
>> This is only true for Java 1.5.
>>
>>>>
>>>> Is it the expected behaviour that "@Override" only means "overrides a
>>>> method in a class but not in an interface"?
>>>
>>> Yes.
>>>
>>>>
>>>> [Anyway, I'll try and remove the annotations in all those problematic
>>>> cases. I thought I was being nice in putting them :-}.]
>>>
>>> I agree this is strange. They explain the rationale for it in the link
>>> above.
>>
>> ... where they say that using @Override for interface implementations
>> would be confusing.
>>
>> But unfortunately they changed their minds with Java 1.6 -
>> implementations of interfaces should now have @Override tags.
>>
>> You can change the Eclipse settings to stop reporting this:
>>
>> Properties | Java Compiler | Errors/Warnings | Annotations | Missing
>> '@Override' | Include implementations of interface methods (1.6 or
>> higher)
>
> As we target 1.5 for [math], it may be better to not do that and staty
> with the strange behaviour.
I suggest *disabling* the warning of missing interface @Overrides for
any projects that must be 1.5 compatible.
Alternatively, make sure that Eclipse is set to use 1.5 to compile
Math, and it should not suggest adding the overrides.
> Luc
>
>>
>> I could not find an updated JLS which documents this.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: svn commit: r1002145 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/distribution/
test/java/org/apache/commons/math/distribution/
Posted by Luc Maisonobe <Lu...@free.fr>.
Le 28/09/2010 16:56, sebb a écrit :
> On 28 September 2010 15:42, Luc Maisonobe <Lu...@free.fr> wrote:
>> Le 28/09/2010 16:25, Gilles Sadowski a écrit :
>>>>
>>>> It seems some recent changes break compilation. Not in this specific
>>>> set, but probably one of the previous ones from today or yesterday.
>>>
>>> Break compilation?
>>> "mvn clean site" produces a "BUILD SUCCESSFUL" here.
>>>
>>>> The problems are some @Override annotations in BetaDistributionImpl
>>>> (getAlpha, getBeta), GammaDistributionImpl (getalpha, getBeta) and
>>>> ExponentialDistributionImpl (getMean). They directly implement
>>>> interfaces and do not extend a superclass, so the Override annotation
>>>> generates an error (at least on Eclipse).
>>>
>>> So, does that mean that Eclipse refuses to compile because of annotations?
>>
>> Yes.
>>
>>> Seems a bug in Eclipse...
>
> It's an incompatibilty between Java 1.5 and Java 1.6.
>
>> No, it is the expected behaviour, or at least it is what I understand
>> from this:
>> <http://java.sun.com/docs/books/jls/third_edition/html/interfaces.html#9.6.1.4>
>>
>> "Note that if a method overrides a method from a superinterface but
>> not from a superclass, using @Override will cause a compile-time
>> error."
>>
>
> This is only true for Java 1.5.
>
>>>
>>> Is it the expected behaviour that "@Override" only means "overrides a
>>> method in a class but not in an interface"?
>>
>> Yes.
>>
>>>
>>> [Anyway, I'll try and remove the annotations in all those problematic
>>> cases. I thought I was being nice in putting them :-}.]
>>
>> I agree this is strange. They explain the rationale for it in the link
>> above.
>
> ... where they say that using @Override for interface implementations
> would be confusing.
>
> But unfortunately they changed their minds with Java 1.6 -
> implementations of interfaces should now have @Override tags.
>
> You can change the Eclipse settings to stop reporting this:
>
> Properties | Java Compiler | Errors/Warnings | Annotations | Missing
> '@Override' | Include implementations of interface methods (1.6 or
> higher)
As we target 1.5 for [math], it may be better to not do that and staty
with the strange behaviour.
Luc
>
> I could not find an updated JLS which documents this.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: svn commit: r1002145 - in /commons/proper/math/trunk/src:
main/java/org/apache/commons/math/distribution/ test/java/org/apache/commons/math/distribution/
Posted by sebb <se...@gmail.com>.
On 28 September 2010 15:42, Luc Maisonobe <Lu...@free.fr> wrote:
> Le 28/09/2010 16:25, Gilles Sadowski a écrit :
>>>
>>> It seems some recent changes break compilation. Not in this specific
>>> set, but probably one of the previous ones from today or yesterday.
>>
>> Break compilation?
>> "mvn clean site" produces a "BUILD SUCCESSFUL" here.
>>
>>> The problems are some @Override annotations in BetaDistributionImpl
>>> (getAlpha, getBeta), GammaDistributionImpl (getalpha, getBeta) and
>>> ExponentialDistributionImpl (getMean). They directly implement
>>> interfaces and do not extend a superclass, so the Override annotation
>>> generates an error (at least on Eclipse).
>>
>> So, does that mean that Eclipse refuses to compile because of annotations?
>
> Yes.
>
>> Seems a bug in Eclipse...
It's an incompatibilty between Java 1.5 and Java 1.6.
> No, it is the expected behaviour, or at least it is what I understand
> from this:
> <http://java.sun.com/docs/books/jls/third_edition/html/interfaces.html#9.6.1.4>
>
> "Note that if a method overrides a method from a superinterface but
> not from a superclass, using @Override will cause a compile-time
> error."
>
This is only true for Java 1.5.
>>
>> Is it the expected behaviour that "@Override" only means "overrides a
>> method in a class but not in an interface"?
>
> Yes.
>
>>
>> [Anyway, I'll try and remove the annotations in all those problematic
>> cases. I thought I was being nice in putting them :-}.]
>
> I agree this is strange. They explain the rationale for it in the link
> above.
... where they say that using @Override for interface implementations
would be confusing.
But unfortunately they changed their minds with Java 1.6 -
implementations of interfaces should now have @Override tags.
You can change the Eclipse settings to stop reporting this:
Properties | Java Compiler | Errors/Warnings | Annotations | Missing
'@Override' | Include implementations of interface methods (1.6 or
higher)
I could not find an updated JLS which documents this.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: svn commit: r1002145 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/distribution/
test/java/org/apache/commons/math/distribution/
Posted by Luc Maisonobe <Lu...@free.fr>.
Le 28/09/2010 16:25, Gilles Sadowski a écrit :
>>
>> It seems some recent changes break compilation. Not in this specific
>> set, but probably one of the previous ones from today or yesterday.
>
> Break compilation?
> "mvn clean site" produces a "BUILD SUCCESSFUL" here.
>
>> The problems are some @Override annotations in BetaDistributionImpl
>> (getAlpha, getBeta), GammaDistributionImpl (getalpha, getBeta) and
>> ExponentialDistributionImpl (getMean). They directly implement
>> interfaces and do not extend a superclass, so the Override annotation
>> generates an error (at least on Eclipse).
>
> So, does that mean that Eclipse refuses to compile because of annotations?
Yes.
> Seems a bug in Eclipse...
No, it is the expected behaviour, or at least it is what I understand
from this:
<http://java.sun.com/docs/books/jls/third_edition/html/interfaces.html#9.6.1.4>
"Note that if a method overrides a method from a superinterface but
not from a superclass, using @Override will cause a compile-time
error."
>
> Is it the expected behaviour that "@Override" only means "overrides a
> method in a class but not in an interface"?
Yes.
>
> [Anyway, I'll try and remove the annotations in all those problematic
> cases. I thought I was being nice in putting them :-}.]
I agree this is strange. They explain the rationale for it in the link
above.
Thanks
Luc
>
>
> Gilles
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: svn commit: r1002145 - in /commons/proper/math/trunk/src:
main/java/org/apache/commons/math/distribution/ test/java/org/apache/commons/math/distribution/
Posted by Niall Pemberton <ni...@gmail.com>.
On Tue, Sep 28, 2010 at 3:25 PM, Gilles Sadowski
<gi...@harfang.homelinux.org> wrote:
>>
>> It seems some recent changes break compilation. Not in this specific
>> set, but probably one of the previous ones from today or yesterday.
>
> Break compilation?
> "mvn clean site" produces a "BUILD SUCCESSFUL" here.
>
>> The problems are some @Override annotations in BetaDistributionImpl
>> (getAlpha, getBeta), GammaDistributionImpl (getalpha, getBeta) and
>> ExponentialDistributionImpl (getMean). They directly implement
>> interfaces and do not extend a superclass, so the Override annotation
>> generates an error (at least on Eclipse).
>
> So, does that mean that Eclipse refuses to compile because of annotations?
> Seems a bug in Eclipse...
>
> Is it the expected behaviour that "@Override" only means "overrides a
> method in a class but not in an interface"?
JDK 1.5 doesn't allow @Override for interface - JDK 1.6 does.
Niall
> [Anyway, I'll try and remove the annotations in all those problematic
> cases. I thought I was being nice in putting them :-}.]
>
>
> Gilles
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: svn commit: r1002145 - in /commons/proper/math/trunk/src:
main/java/org/apache/commons/math/distribution/
test/java/org/apache/commons/math/distribution/
Posted by Gilles Sadowski <gi...@harfang.homelinux.org>.
>
> It seems some recent changes break compilation. Not in this specific
> set, but probably one of the previous ones from today or yesterday.
Break compilation?
"mvn clean site" produces a "BUILD SUCCESSFUL" here.
> The problems are some @Override annotations in BetaDistributionImpl
> (getAlpha, getBeta), GammaDistributionImpl (getalpha, getBeta) and
> ExponentialDistributionImpl (getMean). They directly implement
> interfaces and do not extend a superclass, so the Override annotation
> generates an error (at least on Eclipse).
So, does that mean that Eclipse refuses to compile because of annotations?
Seems a bug in Eclipse...
Is it the expected behaviour that "@Override" only means "overrides a
method in a class but not in an interface"?
[Anyway, I'll try and remove the annotations in all those problematic
cases. I thought I was being nice in putting them :-}.]
Gilles
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: svn commit: r1002145 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/distribution/
test/java/org/apache/commons/math/distribution/
Posted by Luc Maisonobe <Lu...@free.fr>.
Le 28/09/2010 14:38, erans@apache.org a écrit :
> Author: erans
> Date: Tue Sep 28 12:38:09 2010
> New Revision: 1002145
>
> URL: http://svn.apache.org/viewvc?rev=1002145&view=rev
> Log:
> Removed deprecated code.
>
> Modified:
> commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/NormalDistribution.java
> commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/NormalDistributionImpl.java
> commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/NormalDistributionTest.java
It seems some recent changes break compilation. Not in this specific
set, but probably one of the previous ones from today or yesterday.
The problems are some @Override annotations in BetaDistributionImpl
(getAlpha, getBeta), GammaDistributionImpl (getalpha, getBeta) and
ExponentialDistributionImpl (getMean). They directly implement
interfaces and do not extend a superclass, so the Override annotation
generates an error (at least on Eclipse).
Luc
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org