public abstract class DistributionCategorical<C extends java.lang.Enum<C>> extends DistributionDiscrete implements java.io.Serializable
Modifier and Type | Class and Description |
---|---|
static class |
DistributionCategorical.Range
Nested class representing an integer (inclusive) range [min, max].
|
CUMULATIVE_PROB_TOLERANCE
Modifier and Type | Method and Description |
---|---|
int |
addRange(int min,
int max)
Add a range to be used as part of mapping sampled outcomes to an integer.
|
void |
clearRanges()
Clear all ranges, which will revert any integer sampling to return a
'raw' 1-K value.
|
int |
getK()
Get the distribution's K value; i.e.,
the number of discrete alternatives (labellable 1-K)
|
boolean |
isLocked()
Determine if the distribution is locked.
|
void |
lock()
Lock the distribution (which will cause an error on sampling) whilst changes
are made to it (e.g., ranges are added to map to numeric outcomes).
|
C |
sampleCategory()
Sample a Java enum category value from the distribution.
|
abstract java.lang.String |
toString()
Require concrete subclasses to implement toString.
|
void |
unlock()
Unlock the distribution (allowing it to be sampled) after changes to it
are completed.
|
boolean |
usesEnumCategory()
Whether this distribution returns an enum category on sampling or not.
|
boolean |
usesMappedRanges()
Whether this distribution uses mapped ranges or not.
|
sampleDouble, sampleInt
createRegisteredCopy, createUnregisteredCopy
getSampler, registerAccessInfo, registerSampler
public void lock()
public void unlock()
public boolean isLocked()
public abstract java.lang.String toString()
toString
in class DistributionDiscrete
public boolean usesEnumCategory()
public boolean usesMappedRanges()
public C sampleCategory()
public int addRange(int min, int max)
min
- The range minimum.max
- The range maximum.public void clearRanges()
public int getK()