001/*
002 *                    BioJava development code
003 *
004 * This code may be freely distributed and modified under the
005 * terms of the GNU Lesser General Public Licence.  This should
006 * be distributed with the code.  If you do not have a copy,
007 * see:
008 *
009 *      http://www.gnu.org/copyleft/lesser.html
010 *
011 * Copyright for this code is held jointly by the individual
012 * authors.  These should be listed in @author doc comments.
013 *
014 * For more information on the BioJava project and its aims,
015 * or to join the biojava-l mailing list, visit the home page
016 * at:
017 *
018 *      http://www.biojava.org/
019 *
020 */
021
022package org.biojava.bio.dp.twohead;
023
024import org.biojava.bio.dp.IllegalTransitionException;
025import org.biojava.bio.symbol.IllegalAlphabetException;
026import org.biojava.bio.symbol.IllegalSymbolException;
027
028/**
029 * <p>
030 * The interface for all functions that can calculate the 'scores' array for
031 * a given cell.
032 * </p>
033 *
034 * <p>
035 * The methods in this interface work on a square matrix of cells. The cell at
036 * 0,0 is considered the 'target' cell to which data can be written. The other cells
037 * are the neighbours to this cell in the DP matrix.
038 * </p>
039 *
040 * @author Matthew Pocock
041 * @since 1.2
042 */
043public interface CellCalculator {
044  /**
045   * Initialize the cell at [0][0] to the recursion initial parameters.
046   *
047   * @param cells  the 2-D array of cells
048   */
049  public void initialize(Cell [][] cells)
050  throws
051    IllegalSymbolException,
052    IllegalAlphabetException,
053    IllegalTransitionException;
054
055  /**
056   * <p>
057   * Calculate the 'scores' array in the cell at cells[0][0].
058   * </p>
059   *
060   * <p>
061   * These objects implement the actual cell-by-cell recursions, such as
062   * forwards or viterbi.
063   * </p>
064   *
065   * @param cells the array of cells to read from, with the cell to update
066   *        at 0,0
067   */
068  public void calcCell(Cell [][] cells)
069  throws
070    IllegalSymbolException,
071    IllegalAlphabetException,
072    IllegalTransitionException;
073}