org.biojava.bio.seq.db
Class CachingSequenceDB

java.lang.Object
  |
  +--org.biojava.bio.seq.db.CachingSequenceDB

public class CachingSequenceDB
extends java.lang.Object
implements SequenceDB, java.io.Serializable

SequenceDB implementation that caches the results of another SequenceDB.

Author:
Matthew Pocock
See Also:
Serialized Form

Constructor Summary
CachingSequenceDB(SequenceDB parent)
          Create a new CachingSequenceDB that caches the sequences in parent.
 
Method Summary
 java.lang.String getName()
          Get the name of this sequence database.
 SequenceDB getParent()
          Return the parent SequenceDB.
 Sequence getSequence(java.lang.String id)
          Retrieve a single sequence by its id.
 java.util.Set ids()
          Get an imutable set of all of the IDs in the database.
 SequenceIterator sequenceIterator()
          Returns a SequenceTterator over all sequences in the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingSequenceDB

public CachingSequenceDB(SequenceDB parent)
Create a new CachingSequenceDB that caches the sequences in parent.
Parameters:
parent - the SequenceDB to cache
Method Detail

getParent

public SequenceDB getParent()
Return the parent SequenceDB.
Returns:
the parent SequenceDB

getName

public java.lang.String getName()
Description copied from interface: SequenceDB
Get the name of this sequence database.
Specified by:
getName in interface SequenceDB
Tags copied from interface: SequenceDB
Returns:
the name of the sequence database, which may be null.

getSequence

public Sequence getSequence(java.lang.String id)
                     throws BioException
Description copied from interface: SequenceDB
Retrieve a single sequence by its id.
Specified by:
getSequence in interface SequenceDB
Tags copied from interface: SequenceDB
Parameters:
the - id to retrieve by
Returns:
the Sequence with that id
Throws:
BioException - if for any reason the sequence could not be retrieved

ids

public java.util.Set ids()
Description copied from interface: SequenceDB
Get an imutable set of all of the IDs in the database. The ids are legal arguments to getSequence.
Specified by:
ids in interface SequenceDB
Tags copied from interface: SequenceDB
Returns:
a Set of ids - at the moment, strings

sequenceIterator

public SequenceIterator sequenceIterator()
Description copied from interface: SequenceDB
Returns a SequenceTterator over all sequences in the database. The order of retrieval is undefined.
Specified by:
sequenceIterator in interface SequenceDB
Tags copied from interface: SequenceDB
Returns:
a SequenceIterator over all sequences