本文整理汇总了Java中org.apache.commons.math3.exception.util.LocalizedFormats.POPULATION_SIZE属性的典型用法代码示例。如果您正苦于以下问题:Java LocalizedFormats.POPULATION_SIZE属性的具体用法?Java LocalizedFormats.POPULATION_SIZE怎么用?Java LocalizedFormats.POPULATION_SIZE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.commons.math3.exception.util.LocalizedFormats
的用法示例。
在下文中一共展示了LocalizedFormats.POPULATION_SIZE属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: HypergeometricDistribution
/**
* Creates a new hypergeometric distribution.
*
* @param rng Random number generator.
* @param populationSize Population size.
* @param numberOfSuccesses Number of successes in the population.
* @param sampleSize Sample size.
* @throws NotPositiveException if {@code numberOfSuccesses < 0}.
* @throws NotStrictlyPositiveException if {@code populationSize <= 0}.
* @throws NumberIsTooLargeException if {@code numberOfSuccesses > populationSize},
* or {@code sampleSize > populationSize}.
* @since 3.1
*/
public HypergeometricDistribution(RandomGenerator rng,
int populationSize,
int numberOfSuccesses,
int sampleSize)
throws NotPositiveException, NotStrictlyPositiveException, NumberIsTooLargeException {
super(rng);
if (populationSize <= 0) {
throw new NotStrictlyPositiveException(LocalizedFormats.POPULATION_SIZE,
populationSize);
}
if (numberOfSuccesses < 0) {
throw new NotPositiveException(LocalizedFormats.NUMBER_OF_SUCCESSES,
numberOfSuccesses);
}
if (sampleSize < 0) {
throw new NotPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES,
sampleSize);
}
if (numberOfSuccesses > populationSize) {
throw new NumberIsTooLargeException(LocalizedFormats.NUMBER_OF_SUCCESS_LARGER_THAN_POPULATION_SIZE,
numberOfSuccesses, populationSize, true);
}
if (sampleSize > populationSize) {
throw new NumberIsTooLargeException(LocalizedFormats.SAMPLE_SIZE_LARGER_THAN_POPULATION_SIZE,
sampleSize, populationSize, true);
}
this.numberOfSuccesses = numberOfSuccesses;
this.populationSize = populationSize;
this.sampleSize = sampleSize;
}