Looks good. Thanks! Phil
On 12/14/12 2:12 PM, er...@apache.org wrote: > Author: erans > Date: Fri Dec 14 22:12:34 2012 > New Revision: 1422123 > > URL: http://svn.apache.org/viewvc?rev=1422123&view=rev > Log: > Replaced deprecated "RandomDataImpl" with "RandomDataGenerator". > Added private constructor. > > Modified: > > commons/proper/math/trunk/src/main/java/org/apache/commons/math3/random/EmpiricalDistribution.java > > Modified: > commons/proper/math/trunk/src/main/java/org/apache/commons/math3/random/EmpiricalDistribution.java > URL: > http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/random/EmpiricalDistribution.java?rev=1422123&r1=1422122&r2=1422123&view=diff > ============================================================================== > --- > commons/proper/math/trunk/src/main/java/org/apache/commons/math3/random/EmpiricalDistribution.java > (original) > +++ > commons/proper/math/trunk/src/main/java/org/apache/commons/math3/random/EmpiricalDistribution.java > Fri Dec 14 22:12:34 2012 > @@ -134,14 +134,14 @@ public class EmpiricalDistribution exten > /** upper bounds of subintervals in (0,1) "belonging" to the bins */ > private double[] upperBounds = null; > > - /** RandomDataImpl instance to use in repeated calls to getNext() */ > - private final RandomDataImpl randomData; > + /** RandomDataGenerator instance to use in repeated calls to getNext() */ > + private final RandomDataGenerator randomData; > > /** > * Creates a new EmpiricalDistribution with the default bin count. > */ > public EmpiricalDistribution() { > - this(DEFAULT_BIN_COUNT, new RandomDataImpl()); > + this(DEFAULT_BIN_COUNT); > } > > /** > @@ -150,7 +150,7 @@ public class EmpiricalDistribution exten > * @param binCount number of bins > */ > public EmpiricalDistribution(int binCount) { > - this(binCount, new RandomDataImpl()); > + this(binCount, new RandomDataGenerator()); > } > > /** > @@ -162,9 +162,7 @@ public class EmpiricalDistribution exten > * @since 3.0 > */ > public EmpiricalDistribution(int binCount, RandomGenerator generator) { > - this.binCount = binCount; > - randomData = new RandomDataImpl(generator); > - binStats = new ArrayList<SummaryStatistics>(); > + this(binCount, new RandomDataGenerator(generator)); > } > > /** > @@ -189,9 +187,7 @@ public class EmpiricalDistribution exten > */ > @Deprecated > public EmpiricalDistribution(int binCount, RandomDataImpl randomData) { > - this.binCount = binCount; > - this.randomData = randomData; > - binStats = new ArrayList<SummaryStatistics>(); > + this(binCount, randomData.getDelegate()); > } > > /** > @@ -207,7 +203,22 @@ public class EmpiricalDistribution exten > this(DEFAULT_BIN_COUNT, randomData); > } > > - /** > + /** > + * Private constructor to allow lazy initialisation of the RNG contained > + * in the {@link #randomData} instance variable. > + * > + * @param binCount number of bins > + * @param randomData Random data generator. > + */ > + private EmpiricalDistribution(int binCount, > + RandomDataGenerator randomData) { > + super(null); > + this.binCount = binCount; > + this.randomData = randomData; > + binStats = new ArrayList<SummaryStatistics>(); > + } > + > + /** > * Computes the empirical distribution from the provided > * array of numbers. > * > > > -- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org