|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.biojava.utils.AbstractChangeable
org.biojava.bio.dist.AbstractDistribution
org.biojava.bio.dist.SimpleDistribution
public class SimpleDistribution
A simple implementation of a distribution, which works with any finite alphabet.
Nested Class Summary | |
---|---|
protected class |
SimpleDistribution.Trainer
A simple implementation of a trainer for this class. |
Nested classes/interfaces inherited from interface org.biojava.bio.dist.Distribution |
---|
Distribution.NullModelForwarder |
Field Summary |
---|
Fields inherited from class org.biojava.bio.dist.AbstractDistribution |
---|
nullModelForwarder |
Fields inherited from interface org.biojava.bio.dist.Distribution |
---|
NULL_MODEL, WEIGHTS |
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
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. |
Methods inherited from class org.biojava.bio.dist.AbstractDistribution |
---|
equals, getChangeSupport, getWeight, hashCode, sampleSymbol, setNullModel, setWeight |
Methods inherited from class org.biojava.utils.AbstractChangeable |
---|
addChangeListener, addChangeListener, generateChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.biojava.utils.Changeable |
---|
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener |
Constructor Detail |
---|
public SimpleDistribution(FiniteAlphabet alphabet)
public SimpleDistribution(Distribution dist)
dist
- Distribution to copy the weights from.Method Detail |
---|
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 Distribution
IllegalAlphabetException
- if the null model is for the wrong alphabet
ChangeVetoException
- 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 for
IllegalSymbolException
- 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 symbol
IllegalSymbolException
- if the symbol is not known
ChangeVetoException
- if the change is to be preventedpublic void registerWithTrainer(DistributionTrainerContext dtc)
registerWithTrainer
in interface Distribution
registerWithTrainer
in class AbstractDistribution
dtc
- the context to register with
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |