org.biojava.bio.seq.db
Class DummySequenceDB

java.lang.Object
  extended byorg.biojava.utils.AbstractChangeable
      extended byorg.biojava.bio.seq.db.AbstractSequenceDB
          extended byorg.biojava.bio.seq.db.DummySequenceDB
All Implemented Interfaces:
Changeable, SequenceDB, SequenceDBLite

public class DummySequenceDB
extends AbstractSequenceDB
implements SequenceDB

DummySequenceDB is an implementation which contains only a DummySequence. It will return the same DummySequence instance regardless of the sequence id used to retrieve a sequence.

Since:
1.2
Author:
Keith James

Field Summary
 
Fields inherited from interface org.biojava.bio.seq.db.SequenceDBLite
SEQUENCES
 
Constructor Summary
DummySequenceDB(java.lang.String name)
           
 
Method Summary
 void addSequence(Sequence seq)
          Adds a sequence to the database.
 java.lang.String getName()
          Get the name of this sequence database.
 Sequence getSequence(java.lang.String id)
          Retrieve a single sequence by its id.
 java.util.Set ids()
          Get an immutable set of all of the IDs in the database.
 void removeSequence(java.lang.String id)
          Remove the sequence associated with an ID from the database.
 SequenceIterator sequenceIterator()
          Returns a SequenceIterator over all sequences in the database.
 
Methods inherited from class org.biojava.bio.seq.db.AbstractSequenceDB
filter
 
Methods inherited from class org.biojava.utils.AbstractChangeable
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.biojava.bio.seq.db.SequenceDB
filter
 
Methods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
 

Constructor Detail

DummySequenceDB

public DummySequenceDB(java.lang.String name)
Method Detail

ids

public java.util.Set ids()
Description copied from interface: SequenceDB
Get an immutable set of all of the IDs in the database. The ids are legal arguments to getSequence.

Specified by:
ids in interface SequenceDB
Returns:
a Set of ids - at the moment, strings

sequenceIterator

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

Specified by:
sequenceIterator in interface SequenceDB
Overrides:
sequenceIterator in class AbstractSequenceDB

getName

public java.lang.String getName()
Description copied from interface: SequenceDBLite
Get the name of this sequence database.

Specified by:
getName in interface SequenceDBLite
Returns:
the name of the sequence database, which may be null.

getSequence

public Sequence getSequence(java.lang.String id)
                     throws IllegalIDException,
                            BioException
Description copied from interface: SequenceDBLite
Retrieve a single sequence by its id.

Specified by:
getSequence in interface SequenceDBLite
Returns:
the Sequence with that id
Throws:
BioException - if there was a failure in retrieving the sequence
IllegalIDException - if the database doesn't know about the id

addSequence

public void addSequence(Sequence seq)
                 throws IllegalIDException,
                        BioException,
                        ChangeVetoException
Description copied from interface: SequenceDBLite
Adds a sequence to the database.

Specified by:
addSequence in interface SequenceDBLite
Overrides:
addSequence in class AbstractSequenceDB
Throws:
IllegalIDException
BioException
ChangeVetoException

removeSequence

public void removeSequence(java.lang.String id)
                    throws IllegalIDException,
                           BioException,
                           ChangeVetoException
Description copied from interface: SequenceDBLite
Remove the sequence associated with an ID from the database.

Specified by:
removeSequence in interface SequenceDBLite
Overrides:
removeSequence in class AbstractSequenceDB
Throws:
IllegalIDException
BioException
ChangeVetoException