/*
 *                    BioJava development code
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  If you do not have a copy,
 * see:
 *
 *      http://www.gnu.org/copyleft/lesser.html
 *
 * Copyright for this code is held jointly by the individual
 * authors.  These should be listed in @author doc comments.
 *
 * For more information on the BioJava project and its aims,
 * or to join the biojava-l mailing list, visit the home page
 * at:
 *
 *      http://www.biojava.org/
 *
 */


package org.biojava.bio.dp;
import java.io.Serializable;

import org.biojava.bio.*;
import org.biojava.bio.symbol.*;
import org.biojava.bio.dist.*;

/**
 * @author Matthew Pocock
 */
public interface ScoreType {
  /**
   * Calculate the score associated with a distribution and a symbol.
   */
  double calculateScore(Distribution dist, Symbol sym)
  throws IllegalSymbolException;
  
  public final static ScoreType PROBABILITY = new Probability();
  
  /**
   * @author Matthew Pocock
   */
  public static class Probability implements ScoreType {
    public double calculateScore(Distribution dist, Symbol sym)
    throws IllegalSymbolException {
      return dist.getWeight(sym);
    }
  };
  
  public final static ScoreType ODDS = new Odds();
  
  /**
   * @author Matthew Pocock
   */
  public static class Odds implements ScoreType {
    public double calculateScore(Distribution dist, Symbol sym)
    throws IllegalSymbolException {
      double d = dist.getWeight(sym);
      double n = dist.getNullModel().getWeight(sym);
      //System.out.println("Odds for " + sym.getName() + "\t= " + d + " / " + n);
      return d / n;
    }
  };
  
  public final static ScoreType NULL_MODEL = new NullModel();
  
  /**
   * @author Matthew Pocock
   */
  public static class NullModel implements ScoreType {
    public double calculateScore(Distribution dist, Symbol sym)
    throws IllegalSymbolException {
      return dist.getNullModel().getWeight(sym);
    }
  };
}


@@ -747,16 +747,101 @@
 *;%0A%0A/**%0A
+ * This class computes the score that is used to be used%0A * in a DP optimisation.%0A *%0A
  * @auth
@@ -911,16 +911,17 @@
 alculate
+s
  the sco
@@ -1131,32 +1131,128 @@
 ity();%0A  %0A  /**%0A
+   * In this class, calculateScore returns the probability%0A   * of a Symbol being emitted.%0A   *%0A
    * @author Mat
@@ -1526,32 +1526,236 @@
 dds();%0A  %0A  /**%0A
+   * In this class, calculateScore returns the odds ratio%0A   * of a symbol being emitted, i.e. the ratio of the%0A   * probability of a Symbol being emitted to it being%0A   * emitted by the null model.%0A   *%0A
    * @author Mat
@@ -2196,24 +2196,138 @@
 );%0A  %0A  /**%0A
+   * In this class, calculateScore returns the probability of%0A   * a Symbol being emitted by the null model.%0A   *%0A
    * @author

improve the javadocs slightly