commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pste...@apache.org
Subject svn commit: r1369654 - /commons/proper/math/trunk/src/test/java/org/apache/commons/math3/stat/descriptive/AggregateSummaryStatisticsTest.java
Date Sun, 05 Aug 2012 19:48:32 GMT
Author: psteitz
Date: Sun Aug  5 19:48:31 2012
New Revision: 1369654

URL: http://svn.apache.org/viewvc?rev=1369654&view=rev
Log:
Fixed failing test.

Modified:
    commons/proper/math/trunk/src/test/java/org/apache/commons/math3/stat/descriptive/AggregateSummaryStatisticsTest.java

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/stat/descriptive/AggregateSummaryStatisticsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/stat/descriptive/AggregateSummaryStatisticsTest.java?rev=1369654&r1=1369653&r2=1369654&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/stat/descriptive/AggregateSummaryStatisticsTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/stat/descriptive/AggregateSummaryStatisticsTest.java
Sun Aug  5 19:48:31 2012
@@ -265,15 +265,19 @@ public class AggregateSummaryStatisticsT
     private double[][] generatePartition(double[] sample) {
         final int length = sample.length;
         final double[][] out = new double[5][];
-        int cur = 0;
-        int offset = 0;
-        int sampleCount = 0;
+        int cur = 0;          // beginning of current partition segment
+        int offset = 0;       // end of current partition segment
+        int sampleCount = 0;  // number of segments defined 
         for (int i = 0; i < 5; i++) {
             if (cur == length || offset == length) {
                 break;
             }
-            final IntegerDistribution partitionPoint = new UniformIntegerDistribution(cur,
length - 1);
-            final int next = (i == 4 || cur == length - 1) ? length - 1 : partitionPoint.sample();
+            final int next;
+            if (i == 4 || cur == length - 1) {
+                next = length - 1;
+            } else {
+                next = (new UniformIntegerDistribution(cur, length - 1)).sample();
+            }
             final int subLength = next - cur + 1;
             out[i] = new double[subLength];
             System.arraycopy(sample, offset, out[i], 0, subLength);



Mime
View raw message