org.biojava.bio.dist
Class UniformDistribution

java.lang.Object
  extended by org.biojava.utils.AbstractChangeable
      extended by org.biojava.bio.dist.AbstractDistribution
          extended by org.biojava.bio.dist.UniformDistribution
All Implemented Interfaces:
java.io.Serializable, Distribution, Changeable

public class UniformDistribution
extends AbstractDistribution
implements java.io.Serializable

An implementation of an uniform distribution

Since:
1.0
Author:
Matthew Pocock, Mark Schreiber, Thomas Down
See Also:
Serialized Form

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
UniformDistribution(FiniteAlphabet alphabet)
          Create a new UniformDistribution.
 
Method Summary
 Alphabet getAlphabet()
          The alphabet from which this spectrum emits symbols.
 Distribution getNullModel()
          Retrieve the null model Distribution that this Distribution recognizes.
protected  double getWeightImpl(AtomicSymbol s)
          Override this method to implement getting the weight for an atomic symbol.
 void registerWithTrainer(DistributionTrainerContext dtc)
          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 Detail

UniformDistribution

public UniformDistribution(FiniteAlphabet alphabet)
Create a new UniformDistribution.

Parameters:
alphabet - the finite alphabet to be over
Method Detail

getAlphabet

public Alphabet getAlphabet()
Description copied from interface: Distribution
The alphabet from which this spectrum emits symbols.

Specified by:
getAlphabet in interface Distribution
Returns:
the Alphabet associated with this spectrum

getNullModel

public Distribution getNullModel()
Description copied from interface: Distribution
Retrieve the null model Distribution that this Distribution recognizes.

Specified by:
getNullModel in interface Distribution
Returns:
the apropriate null model

setNullModelImpl

protected void setNullModelImpl(Distribution nullModel)
                         throws IllegalAlphabetException
Assign a background distribution.

Specified by:
setNullModelImpl in class AbstractDistribution
Parameters:
nullModel - the background distribution to assign
Throws:
IllegalAlphabetException - if nullModel is over an incompattible alphabet

getWeightImpl

protected double getWeightImpl(AtomicSymbol s)
                        throws IllegalSymbolException
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 class AbstractDistribution
Parameters:
s - the AtomicSymbol to get the weight for
Returns:
the weight
Throws:
IllegalSymbolException - if sym is not known

setWeightImpl

protected void setWeightImpl(AtomicSymbol sym,
                             double weight)
                      throws ChangeVetoException
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 class AbstractDistribution
Parameters:
sym - the AtomicSymbol to update for
weight - the new weight for that symbol
Throws:
ChangeVetoException - if the change is to be prevented

registerWithTrainer

public void registerWithTrainer(DistributionTrainerContext dtc)
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 interface Distribution
Overrides:
registerWithTrainer in class AbstractDistribution
Parameters:
dtc - the context to register with