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 022 023package org.biojava.bio.dp.onehead; 024 025import org.biojava.bio.symbol.Symbol; 026import org.biojava.bio.symbol.SymbolList; 027 028/** 029 * Encapsulates the dynamic programmming matrix, and the context within algorithms work. 030 * The cursor should put DP.MAGICAL_SYMBOL symbols at either end of the sequence. 031 * 032 * @author Matthew Pocock 033 */ 034public interface DPCursor { 035 /** 036 * The symbol list being looped over. 037 */ 038 SymbolList symList(); 039 040 /** 041 * <p> 042 * The length of the sequence. 043 * </p> 044 * 045 * <p> 046 * The matrix may allocate length+1 columns. 047 * </p> 048 */ 049 int length(); 050 051 /** 052 * The current column of the matrix. 053 */ 054 double [] currentCol(); 055 056 /** 057 * The previous column. 058 */ 059 double [] lastCol(); 060 061 /** 062 * The current symbol. 063 */ 064 Symbol currentRes(); 065 066 /** 067 * The previous symbol. 068 */ 069 Symbol lastRes(); 070 071 /** 072 * Can we advance? 073 */ 074 boolean canAdvance(); 075 076 /** 077 * Advance. 078 */ 079 void advance(); 080}