public class SimpleDistribution extends AbstractDistribution implements Serializable
Modifier and Type | Class and Description |
---|---|
protected class |
SimpleDistribution.Trainer
A simple implementation of a trainer for this class.
|
Distribution.NullModelForwarder
nullModelForwarder
NULL_MODEL, WEIGHTS
Constructor and Description |
---|
SimpleDistribution(Distribution dist)
make an instance of SimpleDistribution with weights identical
to the specified Distribution.
|
SimpleDistribution(FiniteAlphabet alphabet)
make an instance of SimpleDistribution for the specified Alphabet.
|
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 |
getWeightImpl(AtomicSymbol s)
Override this method to implement getting the weight for an atomic
symbol.
|
protected double[] |
getWeights()
Get the underlying array that stores the weights.
|
protected boolean |
hasWeights()
Indicate whether the weights array has been allocated yet.
|
void |
registerWithTrainer(DistributionTrainerContext dtc)
Register an SimpleDistribution.Trainer instance as the trainer for this distribution.
|
protected void |
setNullModelImpl(Distribution nullModel)
Implement this to set the null model.
|
protected void |
setWeightImpl(AtomicSymbol s,
double w)
Implement this to actually set the weight.
|
equals, getChangeSupport, getWeight, hashCode, sampleSymbol, setNullModel, setWeight
addChangeListener, addChangeListener, generateChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
public SimpleDistribution(FiniteAlphabet alphabet)
public SimpleDistribution(Distribution dist)
dist
- Distribution to copy the weights from.public Alphabet getAlphabet()
Distribution
getAlphabet
in interface Distribution
public Distribution getNullModel()
Distribution
getNullModel
in interface Distribution
protected void setNullModelImpl(Distribution nullModel) throws IllegalAlphabetException, ChangeVetoException
AbstractDistribution
You should not inform any change listeners in this method. All of that work has been done for you.
setNullModelImpl
in class AbstractDistribution
nullModel
- the new null model DistributionIllegalAlphabetException
- if the null model is for the wrong alphabetChangeVetoException
- if your implementation wishes to block this
opperationprotected boolean hasWeights()
protected double[] getWeights()
Modifying this will modify the state of the distribution.
public double getWeightImpl(AtomicSymbol s) throws IllegalSymbolException
AbstractDistribution
getWeightImpl
in class AbstractDistribution
s
- the AtomicSymbol to get the weight forIllegalSymbolException
- if sym is not knownprotected void setWeightImpl(AtomicSymbol s, double w) throws IllegalSymbolException, ChangeVetoException
AbstractDistribution
Do not inform any listeners. This has already been done for you. Just update state.
setWeightImpl
in class AbstractDistribution
s
- the AtomicSymbol to update forw
- the new weight for that symbolIllegalSymbolException
- if the symbol is not knownChangeVetoException
- if the change is to be preventedpublic void registerWithTrainer(DistributionTrainerContext dtc)
registerWithTrainer
in interface Distribution
registerWithTrainer
in class AbstractDistribution
dtc
- the context to register withCopyright © 2014 BioJava. All rights reserved.