|
||||||||||
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.AbstractOrderNDistribution
public abstract class AbstractOrderNDistribution
Simple base class for OrderNDistributions.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.biojava.bio.dist.Distribution |
---|
Distribution.NullModelForwarder |
Field Summary | |
---|---|
protected ChangeForwarder |
weightForwarder
The listener that will forward events from the underlying distributions to listeners for this distribution. |
Fields inherited from class org.biojava.bio.dist.AbstractDistribution |
---|
nullModelForwarder |
Fields inherited from interface org.biojava.bio.dist.Distribution |
---|
NULL_MODEL, WEIGHTS |
Constructor Summary | |
---|---|
protected |
AbstractOrderNDistribution(Alphabet alpha)
Construct a new NthOrderDistribution. |
Method Summary | |
---|---|
Alphabet |
getAlphabet()
The alphabet from which this spectrum emits symbols. |
protected ChangeSupport |
getChangeSupport(ChangeType ct)
Called to retrieve the ChangeSupport for this object. |
Alphabet |
getConditionedAlphabet()
Get the conditioned alphabet. |
Alphabet |
getConditioningAlphabet()
Get the conditioning alphabet of this distribution. |
Distribution |
getNullModel()
Retrieve the null model Distribution that this Distribution recognizes. |
protected double |
getWeightImpl(AtomicSymbol sym)
Get a weight from one of the sub-distributions, conditioned on the first part of the symbol. |
void |
registerWithTrainer(DistributionTrainerContext dtc)
Register an IgnoreCountsTrainer instance as the trainer for this distribution. |
void |
setNullModelImpl(Distribution nullModel)
Implement this to set the null model. |
void |
setWeightImpl(AtomicSymbol sym,
double w)
Set a weight in one of the conditioned distributions. |
Methods inherited from class org.biojava.bio.dist.AbstractDistribution |
---|
equals, 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.bio.dist.OrderNDistribution |
---|
conditionedDistributions, getDistribution, setDistribution |
Methods inherited from interface org.biojava.bio.dist.Distribution |
---|
getWeight, sampleSymbol, setNullModel, setWeight |
Methods inherited from interface org.biojava.utils.Changeable |
---|
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener |
Field Detail |
---|
protected transient ChangeForwarder weightForwarder
Constructor Detail |
---|
protected AbstractOrderNDistribution(Alphabet alpha) throws IllegalAlphabetException
alpha
- the Alpahbet this is over
IllegalAlphabetException
Method Detail |
---|
protected ChangeSupport getChangeSupport(ChangeType ct)
AbstractChangeable
Your implementation of this method should have the following structure:
It is usual for the forwarding listeners (someForwarder in this example) to
be transient and lazily instantiated. Be sure to register & unregister the
forwarder in the code that does the ChangeEvent handling in setter methods.
ChangeSupport cs = super.getChangeSupport(ct);
if(someForwarder == null && ct.isMatching(SomeInterface.SomeChangeType)) {
someForwarder = new ChangeForwarder(...
this.stateVariable.addChangeListener(someForwarder, VariableInterface.AChange);
}
return cs;
getChangeSupport
in class AbstractDistribution
public Alphabet getConditioningAlphabet()
getConditioningAlphabet
in interface OrderNDistribution
public Alphabet getConditionedAlphabet()
getConditionedAlphabet
in interface OrderNDistribution
public Alphabet getAlphabet()
Distribution
getAlphabet
in interface Distribution
protected double getWeightImpl(AtomicSymbol sym) throws IllegalSymbolException
getWeightImpl
in class AbstractDistribution
sym
- the symbol to look up
IllegalSymbolException
- if sym is not recognisedpublic void setWeightImpl(AtomicSymbol sym, double w) throws IllegalSymbolException, ChangeVetoException
setWeightImpl
in class AbstractDistribution
sym
- the symbol to set the weight forw
- the new weight
IllegalSymbolException
- if the symbol is not known
ChangeVetoException
- if the change is to be preventedpublic void setNullModelImpl(Distribution nullModel)
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 Distributionpublic Distribution getNullModel()
Distribution
getNullModel
in interface Distribution
public void registerWithTrainer(DistributionTrainerContext dtc)
AbstractDistribution
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 |