You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ps...@apache.org on 2004/07/18 07:34:26 UTC
cvs commit: jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/moment Mean.java Skewness.java Kurtosis.java
psteitz 2004/07/17 22:34:26
Modified: math/src/java/org/apache/commons/math/stat/univariate/moment
Mean.java Skewness.java Kurtosis.java
Log:
Moved instance field initialization into constructor.
Revision Changes Path
1.22 +4 -3 jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/moment/Mean.java
Index: Mean.java
===================================================================
RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/moment/Mean.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- Mean.java 10 Jul 2004 17:09:08 -0000 1.21
+++ Mean.java 18 Jul 2004 05:34:26 -0000 1.22
@@ -53,7 +53,7 @@
static final long serialVersionUID = -1296043746617791564L;
/** First moment on which this statistic is based. */
- protected FirstMoment moment = null;
+ protected FirstMoment moment;
/**
* Determines whether or not this statistic can be incremented or cleared.
@@ -61,10 +61,11 @@
* Statistics based on (constructed from) external moments cannot
* be incremented or cleared.
*/
- protected boolean incMoment = true;
+ protected boolean incMoment;
/** Constructs a Mean. */
public Mean() {
+ incMoment = true;
moment = new FirstMoment();
}
1.26 +3 -2 jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/moment/Skewness.java
Index: Skewness.java
===================================================================
RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/moment/Skewness.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- Skewness.java 10 Jul 2004 17:02:43 -0000 1.25
+++ Skewness.java 18 Jul 2004 05:34:26 -0000 1.26
@@ -50,12 +50,13 @@
* Statistics based on (constructed from) external moments cannot
* be incremented or cleared.
*/
- protected boolean incMoment = true;
+ protected boolean incMoment;
/**
* Constructs a Skewness
*/
public Skewness() {
+ incMoment = true;
moment = new ThirdMoment();
}
1.28 +9 -10 jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/moment/Kurtosis.java
Index: Kurtosis.java
===================================================================
RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/moment/Kurtosis.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- Kurtosis.java 10 Jul 2004 17:09:08 -0000 1.27
+++ Kurtosis.java 18 Jul 2004 05:34:26 -0000 1.28
@@ -15,8 +15,6 @@
*/
package org.apache.commons.math.stat.univariate.moment;
-import java.io.Serializable;
-
import org.apache.commons.math.stat.univariate.AbstractStorelessUnivariateStatistic;
/**
@@ -26,10 +24,11 @@
* <p>
* kurtosis = { [n(n+1) / (n -1)(n - 2)(n-3)] sum[(x_i - mean)^4] / std^4 } - [3(n-1)^2 / (n-2)(n-3)]
* <p>
- * where n is the number of values, mean is the {@link Mean} and std is the {@link StandardDeviation}
+ * where n is the number of values, mean is the {@link Mean} and std is the
+ * {@link StandardDeviation}
* <p>
- * Note that this statistic is undefined for n < 4. <code>Double.Nan</code> is returned when
- * there is not sufficient data to compute the statistic.
+ * Note that this statistic is undefined for n < 4. <code>Double.Nan</code>
+ * is returned when there is not sufficient data to compute the statistic.
* <p>
* <strong>Note that this implementation is not synchronized.</strong> If
* multiple threads access an instance of this class concurrently, and at least
@@ -38,13 +37,13 @@
*
* @version $Revision$ $Date$
*/
-public class Kurtosis extends AbstractStorelessUnivariateStatistic implements Serializable {
+public class Kurtosis extends AbstractStorelessUnivariateStatistic {
/** Serializable version identifier */
static final long serialVersionUID = 2784465764798260919L;
/**Fourth Moment on which this statistic is based */
- protected FourthMoment moment = null;
+ protected FourthMoment moment;
/**
* Determines whether or not this statistic can be incremented or cleared.
@@ -52,13 +51,13 @@
* Statistics based on (constructed from) external moments cannot
* be incremented or cleared.
*/
- protected boolean incMoment = true;
-
+ protected boolean incMoment;
/**
* Construct a Kurtosis
*/
public Kurtosis() {
+ incMoment = true;
moment = new FourthMoment();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org