public abstract class AbstractOrderNDistribution extends AbstractDistribution implements OrderNDistribution, Serializable
Distribution.NullModelForwarder| Modifier and Type | Field and Description |
|---|---|
protected ChangeForwarder |
weightForwarder
The listener that will forward events from the underlying distributions to
listeners for this distribution.
|
nullModelForwarderNULL_MODEL, WEIGHTS| Modifier | Constructor and Description |
|---|---|
protected |
AbstractOrderNDistribution(Alphabet alpha)
Construct a new NthOrderDistribution.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
equals, getWeight, hashCode, sampleSymbol, setNullModel, setWeightaddChangeListener, addChangeListener, generateChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListenerclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitconditionedDistributions, getDistribution, setDistributiongetWeight, sampleSymbol, setNullModel, setWeightaddChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListenerprotected transient ChangeForwarder weightForwarder
protected AbstractOrderNDistribution(Alphabet alpha) throws IllegalAlphabetException
alpha - the Alpahbet this is overIllegalAlphabetExceptionprotected 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 AbstractDistributionpublic Alphabet getConditioningAlphabet()
getConditioningAlphabet in interface OrderNDistributionpublic Alphabet getConditionedAlphabet()
getConditionedAlphabet in interface OrderNDistributionpublic Alphabet getAlphabet()
DistributiongetAlphabet in interface Distributionprotected double getWeightImpl(AtomicSymbol sym) throws IllegalSymbolException
getWeightImpl in class AbstractDistributionsym - the symbol to look upIllegalSymbolException - if sym is not recognisedpublic void setWeightImpl(AtomicSymbol sym, double w) throws IllegalSymbolException, ChangeVetoException
setWeightImpl in class AbstractDistributionsym - the symbol to set the weight forw - the new weightIllegalSymbolException - if the symbol is not knownChangeVetoException - if the change is to be preventedpublic void setNullModelImpl(Distribution nullModel)
AbstractDistributionYou should not inform any change listeners in this method. All of that work has been done for you.
setNullModelImpl in class AbstractDistributionnullModel - the new null model Distributionpublic Distribution getNullModel()
DistributiongetNullModel in interface Distributionpublic void registerWithTrainer(DistributionTrainerContext dtc)
AbstractDistributionregisterWithTrainer in interface DistributionregisterWithTrainer in class AbstractDistributiondtc - the context to register withCopyright © 2020 BioJava. All rights reserved.