public interface Distribution extends Changeable
An encapsulation of a probability distribution over the Symbols within an alphabet.
A distribution can be implemented as a map from symbol to probability. It is more correct to think of them as being integrals or sums over probability dencity funcitons. In this world view, getWeight should look at the getMatches of the symbol it is given and then perform the apropreate sum or integral to return the probability of something within that set of symbols being emitted.
This interface should handle the case of emitting an ambiguity symbol. This should be just the sum of the probabiltiy of emitting each matching symbol. It is up to the code using the Distribution instance to divide out the null model appropreately.
Modifier and Type  Interface and Description 

static class 
Distribution.NullModelForwarder
Deprecated.
use
new ChangeForwarder.Retyper(this, cs, Annotation.PROPERTY)
instead 
Modifier and Type  Field and Description 

static ChangeType 
NULL_MODEL
Whenever the null model distribution changes the values that would be
returned by getWeight, either by being edited or by being replaced, a
ChangeEvent with this object as the type should be thrown.

static ChangeType 
WEIGHTS
Whenever a distribution changes the values that would be returned by
getWeight, they should fire a ChangeEvent with this object as the type.

Modifier and Type  Method and Description 

Alphabet 
getAlphabet()
The alphabet from which this spectrum emits symbols.

Distribution 
getNullModel()
Retrieve the null model Distribution that this Distribution recognizes.

double 
getWeight(Symbol s)
Return the probability that Symbol s is emitted by this spectrum.

void 
registerWithTrainer(DistributionTrainerContext dtc)
Register this distribution with a training context.

Symbol 
sampleSymbol()
Sample a symbol from this state's probability distribution.

void 
setNullModel(Distribution nullDist)
Set the null model Distribution that this Distribution recognizes.

void 
setWeight(Symbol s,
double w)
Set the probability or odds that Symbol s is emitted by this state.

addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
static final ChangeType WEIGHTS
Whenever a distribution changes the values that would be returned by getWeight, they should fire a ChangeEvent with this object as the type.
If the whole distribution changes, then the change and previous fields of the ChangeEvent should be left null. If only a single weight is modified, then change should be of the form Object[] { symbol, new Double(newVal) } and previous should be of the form Object[] { symbol, new Double(oldVal) }
static final ChangeType NULL_MODEL
Whenever the null model distribution changes the values that would be returned by getWeight, either by being edited or by being replaced, a ChangeEvent with this object as the type should be thrown.
If the null model has changed its weights, then the ChangeEvent should refer back to the ChangeEvent from the null model.
Alphabet getAlphabet()
double getWeight(Symbol s) throws IllegalSymbolException
Return the probability that Symbol s is emitted by this spectrum.
If the symbol is ambiguou, then it is the sum of the probability that each one of the matching symbols was emitted.
s
 the Symbol emittedIllegalSymbolException
 if s is not from this state's alphabetvoid setWeight(Symbol s, double w) throws IllegalSymbolException, ChangeVetoException
s
 the Symbol emittedw
 the probability of emitting that symbolIllegalSymbolException
 if s is not from this state's alphabet, or
if it is an ambiguity symbol and the implementation can't handle
this caseChangeVetoException
 if this state does not allow weights
to be tampered with, or if one of the listeners vetoed this changeSymbol sampleSymbol()
Distribution getNullModel()
void setNullModel(Distribution nullDist) throws IllegalAlphabetException, ChangeVetoException
nullDist
 the new null model DistributionIllegalAlphabetException
 if the null model has the wrong alphabetChangeVetoException
 if this Distirbution doesn't support setting
the null model, or if one of its listeners objectsvoid registerWithTrainer(DistributionTrainerContext dtc)
Register this distribution with a training context.
This should be invoked from within dtc.addDistribution(). This method is responsible for constructing a suitable DistributionTrainer instance and registering it by calling dtc.registerDistributionTrainer(this, trainer). If the distribution is a view onto another distribution, it can force the other to be registered by calling dtc.addDistribution(other), and can then get on with registering it's own trainer.
dtc
 the DistributionTrainerContext with witch to register a trainerCopyright © 2014 BioJava. All rights reserved.