Package org.biojava.bio.dist
Class UniformDistribution
java.lang.Object
org.biojava.utils.AbstractChangeable
org.biojava.bio.dist.AbstractDistribution
org.biojava.bio.dist.UniformDistribution
- All Implemented Interfaces:
Serializable
,Distribution
,Changeable
An implementation of an uniform distribution
- Since:
- 1.0
- Author:
- Matthew Pocock, Mark Schreiber, Thomas Down
- See Also:
-
Nested Class Summary
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
ConstructorsConstructorDescriptionUniformDistribution
(FiniteAlphabet alphabet) Create a new UniformDistribution. -
Method Summary
Modifier and TypeMethodDescriptionThe alphabet from which this spectrum emits symbols.Retrieve the null model Distribution that this Distribution recognizes.protected double
Override this method to implement getting the weight for an atomic symbol.void
Register an IgnoreCountsTrainer instance as the trainer for this distribution.protected void
setNullModelImpl
(Distribution nullModel) Assign a background distribution.protected void
setWeightImpl
(AtomicSymbol sym, double weight) 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 Details
-
UniformDistribution
Create a new UniformDistribution.- Parameters:
alphabet
- the finite alphabet to be over
-
-
Method Details
-
getAlphabet
Description copied from interface:Distribution
The alphabet from which this spectrum emits symbols.- Specified by:
getAlphabet
in interfaceDistribution
- Returns:
- the Alphabet associated with this spectrum
-
getNullModel
Description copied from interface:Distribution
Retrieve the null model Distribution that this Distribution recognizes.- Specified by:
getNullModel
in interfaceDistribution
- Returns:
- the apropriate null model
-
setNullModelImpl
Assign a background distribution.- Specified by:
setNullModelImpl
in classAbstractDistribution
- Parameters:
nullModel
- the background distribution to assign- Throws:
IllegalAlphabetException
- if nullModel is over an incompattible alphabet
-
getWeightImpl
Description copied from class:AbstractDistribution
Override this method to implement getting the weight for an atomic symbol. You should just do what is necessary to fetch state. All the work with exceptions and listeners will have been handled for you.- Specified by:
getWeightImpl
in classAbstractDistribution
- Parameters:
s
- the AtomicSymbol to get the weight for- Returns:
- the weight
- Throws:
IllegalSymbolException
- if sym is not known
-
setWeightImpl
Description copied from class:AbstractDistribution
Implement this to actually set the weight.Do not inform any listeners. This has already been done for you. Just update state.
- Specified by:
setWeightImpl
in classAbstractDistribution
- Parameters:
sym
- the AtomicSymbol to update forweight
- the new weight for that symbol- Throws:
ChangeVetoException
- if the change is to be prevented
-
registerWithTrainer
Description copied from class:AbstractDistribution
Register an IgnoreCountsTrainer instance as the trainer for this distribution. Override this if you wish to implement a trainable distribution.- Specified by:
registerWithTrainer
in interfaceDistribution
- Overrides:
registerWithTrainer
in classAbstractDistribution
- Parameters:
dtc
- the context to register with
-