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.
|
nullModelForwarder
NULL_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, setWeight
addChangeListener, addChangeListener, generateChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
conditionedDistributions, getDistribution, setDistribution
getWeight, sampleSymbol, setNullModel, setWeight
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
protected transient ChangeForwarder weightForwarder
protected AbstractOrderNDistribution(Alphabet alpha) throws IllegalAlphabetException
alpha
- the Alpahbet this is overIllegalAlphabetException
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 upIllegalSymbolException
- 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 weightIllegalSymbolException
- if the symbol is not knownChangeVetoException
- 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 withCopyright © 2014 BioJava. All rights reserved.