org.biojava.bio.dist
Class SimpleDistribution

java.lang.Object
  extended byorg.biojava.utils.AbstractChangeable
      extended byorg.biojava.bio.dist.AbstractDistribution
          extended byorg.biojava.bio.dist.SimpleDistribution
All Implemented Interfaces:
Changeable, Distribution, java.io.Serializable
Direct Known Subclasses:
UntrainableDistribution

public class SimpleDistribution
extends AbstractDistribution
implements java.io.Serializable

A simple implementation of a distribution, which works with any finite alphabet.

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

Nested Class Summary
protected  class SimpleDistribution.Trainer
           
 
Nested classes inherited from class org.biojava.bio.dist.Distribution
Distribution.NullModelForwarder
 
Field Summary
 
Fields inherited from class org.biojava.bio.dist.AbstractDistribution
nullModelForwarder, symbolIndices
 
Fields inherited from interface org.biojava.bio.dist.Distribution
NULL_MODEL, WEIGHTS
 
Constructor Summary
SimpleDistribution(FiniteAlphabet alphabet)
           
 
Method Summary
 Alphabet getAlphabet()
          The alphabet from which this spectrum emits symbols.
 Distribution getNullModel()
          Retrieve the null model Distribution that this Distribution recognizes.
 double getWeightImpl(AtomicSymbol s)
           
protected  double[] getWeights()
           
protected  boolean hasWeights()
           
 void registerWithTrainer(DistributionTrainerContext dtc)
          Register a simple trainer for this distribution.
protected  void setNullModelImpl(Distribution nullModel)
           
protected  void setWeightImpl(AtomicSymbol s, double w)
           
 
Methods inherited from class org.biojava.bio.dist.AbstractDistribution
getChangeSupport, getWeight, sampleSymbol, setNullModel, setWeight
 
Methods inherited from class org.biojava.utils.AbstractChangeable
addChangeListener, addChangeListener, generateChangeSupport, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
 

Constructor Detail

SimpleDistribution

public SimpleDistribution(FiniteAlphabet alphabet)
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,
                                ChangeVetoException
Specified by:
setNullModelImpl in class AbstractDistribution
Throws:
IllegalAlphabetException
ChangeVetoException

hasWeights

protected boolean hasWeights()

getWeights

protected double[] getWeights()

getWeightImpl

public double getWeightImpl(AtomicSymbol s)
                     throws IllegalSymbolException
Specified by:
getWeightImpl in class AbstractDistribution
Throws:
IllegalSymbolException

setWeightImpl

protected void setWeightImpl(AtomicSymbol s,
                             double w)
                      throws IllegalSymbolException,
                             ChangeVetoException
Specified by:
setWeightImpl in class AbstractDistribution
Throws:
IllegalSymbolException
ChangeVetoException

registerWithTrainer

public void registerWithTrainer(DistributionTrainerContext dtc)
Register a simple trainer for this distribution.

Specified by:
registerWithTrainer in interface Distribution
Overrides:
registerWithTrainer in class AbstractDistribution