EmpiricalDistribution extends AbstractRealDistribution { public void load(double[] in) throws NullArgumentException { DataAdapter da = new ArrayDataAdapter(in); try { da.computeStats(); fillBinStats(new ArrayDataAdapter(in)); } catch (IOException ex) { throw new MathInternalError(); } loaded = true; } EmpiricalDistribution();  EmpiricalDistribution(int binCount);  EmpiricalDistribution(int binCount, RandomGenerator generator);  EmpiricalDistribution(RandomGenerator generator); @Deprecated  EmpiricalDistribution(int binCount, RandomDataImpl randomData); @Deprecated  EmpiricalDistribution(RandomDataImpl randomData); private  EmpiricalDistribution(int binCount,
                                  RandomDataGenerator randomData); void load(double[] in); void load(URL url); void load(File file); double getNextValue(); StatisticalSummary getSampleStats(); int getBinCount(); List<SummaryStatistics> getBinStats(); double[] getUpperBounds(); double[] getGeneratorUpperBounds(); boolean isLoaded(); void reSeed(long seed); @Override double probability(double x); double density(double x); double cumulativeProbability(double x); @Override double inverseCumulativeProbability(final double p); double getNumericalMean(); double getNumericalVariance(); double getSupportLowerBound(); double getSupportUpperBound(); boolean isSupportLowerBoundInclusive(); boolean isSupportUpperBoundInclusive(); boolean isSupportConnected(); @Override void reseedRandomGenerator(long seed); static final int DEFAULT_BIN_COUNT; }
@Test public void testLoad() throws Exception { empiricalDistribution.load(url); checkDistribution(); File file = new File(url.toURI()); empiricalDistribution.load(file); checkDistribution(); }
@Test public void testBinIndexOverflow() throws Exception { double[] x = new double[] {9474.94326071674, 2080107.8865462579}; new EmpiricalDistribution().load(x); }
@Test public void testSerialization() { EmpiricalDistribution dist = new EmpiricalDistribution(); EmpiricalDistribution dist2 = (EmpiricalDistribution) TestUtils.serializeAndRecover(dist); verifySame(dist, dist2); empiricalDistribution2.load(dataArray); dist2 = (EmpiricalDistribution) TestUtils.serializeAndRecover(empiricalDistribution2); verifySame(empiricalDistribution2, dist2); }
@Test(expected=NullArgumentException.class) public void testLoadNullDoubleArray() { new EmpiricalDistribution().load((double[]) null); }
@Test(expected=NullArgumentException.class) public void testLoadNullURL() throws Exception { new EmpiricalDistribution().load((URL) null); }
@Test(expected=NullArgumentException.class) public void testLoadNullFile() throws Exception { new EmpiricalDistribution().load((File) null); }