001package org.biojava.bio.program.ssaha;
002
003import org.biojava.bio.symbol.FiniteAlphabet;
004import org.biojava.bio.symbol.IllegalAlphabetException;
005import org.biojava.bio.symbol.SymbolList;
006
007/**
008 * A repository that can be searched with a sequence.
009 *
010 * @author Matthew Pocock
011 */
012public interface DataStore {
013  /**
014   * The alphabet of symbol lists that can be searched against this
015   * DataStore.
016   *
017   * @return a FiniteAlphabet search types of SymbolList
018   */
019  public FiniteAlphabet getAlphabet();
020  
021  /**
022   * Search the DataStore with a symbol list.
023   *
024   * @param id  the ID to report the symbol list by e.g. 'test' or 'foo1'
025   * @param symList  the symbol list to search with
026   * @param listener  the listener to inform of hits
027   *
028   * @throws IllegalAlphabetException if the symbol list is of a type that
029   *         is not compatible with this data store
030   */
031  public void search(String id, SymbolList symList, SearchListener listener)
032  throws IllegalAlphabetException, SearchException;
033  
034  /**
035   * Resolve an ID to a sequence name.
036   *
037   * @param id  the int number of the sequence name to resolve
038   * @return the name of that sequence as a String
039   * @throws IndexOutOfBoundsException if id is negative or too large
040   */
041  public String seqNameForID(int id)
042  throws IndexOutOfBoundsException, SearchException;
043}