Author: psteitz
Date: Sun Mar 21 21:05:20 2010
New Revision: 925895
URL: http://svn.apache.org/viewvc?rev=925895&view=rev
Log:
Corrected an error in sample code. The example did not illustrate the
technique being described.
Modified:
commons/proper/math/trunk/src/site/xdoc/userguide/stat.xml
Modified: commons/proper/math/trunk/src/site/xdoc/userguide/stat.xml
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/site/xdoc/userguide/stat.xml?rev=925895&r1=925894&r2=925895&view=diff
==============================================================================
--- commons/proper/math/trunk/src/site/xdoc/userguide/stat.xml (original)
+++ commons/proper/math/trunk/src/site/xdoc/userguide/stat.xml Sun Mar 21
21:05:20 2010
@@ -263,22 +263,23 @@ double totalSampleSum = aggregate.getSum
aggregate</a> method is available, as shown in the following example.
This method should be used when aggregation needs to be done across
threads.
<source>
-// Create a AggregateSummaryStatistics instance to accumulate the overall
statistics
-// and AggregatingSummaryStatistics for the subsamples
-AggregateSummaryStatistics aggregate = new AggregateSummaryStatistics();
-SummaryStatistics setOneStats = aggregate.createContributingStatistics();
-SummaryStatistics setTwoStats = aggregate.createContributingStatistics();
-// Add values to the subsample aggregates
+// Create SummaryStatistics instances for the subsample data
+SummaryStatistics setOneStats = new SummaryStatistics();
+SummaryStatistics setTwoStats = new SummaryStatistics();
+// Add values to the subsample SummaryStatistics instances
setOneStats.addValue(2);
setOneStats.addValue(3);
setTwoStats.addValue(2);
setTwoStats.addValue(4);
...
-// Get a <code>StatisticalSummary</code> describing the full set of data
+// Aggregate the subsample statistics
Collection<SummaryStatistics> aggregate = new
ArrayList<SummaryStatistics>();
aggregate.add(setOneStats);
aggregate.add(setTwoStats);
StatisticalSummary aggregatedStats =
AggregateSummaryStatistics.aggregate(aggregate);
+
+// Full sample data is reported by aggregatedStats
+double totalSampleSum = aggregatedStats.getSum();
</source>
</dd>
</dl>