public abstract class BoundedDiscreteDistribution extends DiscreteDistribution
name
Constructor and Description |
---|
BoundedDiscreteDistribution(java.lang.String name,
double bound,
boolean boundUpper)
Will create a distribution bound to one side (other side will be +- infinity (Double.MAX)),
which will reject any values drawn from the distribution not lying within these bounds.
|
BoundedDiscreteDistribution(java.lang.String name,
double lowerBound,
double upperBound)
Will create a bounded distribution, which will reject any values drawn from the distribution not lying within these bounds.
|
Modifier and Type | Method and Description |
---|---|
double |
draw()
Will draw a value corresponding to the (cut off) underlying probability distribution lying within the bounds.
|
protected abstract double |
drawValue() |
double |
getLowerBound() |
double |
getUpperBound() |
boolean |
isLowerBoundSet() |
boolean |
isUpperBoundSet() |
getName, toString
public BoundedDiscreteDistribution(java.lang.String name, double lowerBound, double upperBound) throws java.lang.IllegalArgumentException
name
- The name of the distributionlowerBound
- The lower bound of the distribution (will only create values at least as big as this)upperBound
- The upper bound of the distribution (will only create values at most as big as this)java.lang.IllegalArgumentException
- Will be thrown when lowerBound > upperBound making no sense and leading to infinite loopspublic BoundedDiscreteDistribution(java.lang.String name, double bound, boolean boundUpper)
name
- The name of the distributionbound
- The bound of the distribution (will only create values at most as big as this (if upper bound) or as small as this (if lower bound)boundUpper
- Indicates what direction of the interval the bound is located (true for upperBound, false for lower bound)public double draw()
draw
in class UnivariateDistribution
public double getLowerBound()
public double getUpperBound()
public boolean isLowerBoundSet()
public boolean isUpperBoundSet()
protected abstract double drawValue()