Package org.biojava.bio.seq.db
Class DummySequenceDB
- java.lang.Object
-
- org.biojava.utils.AbstractChangeable
-
- org.biojava.bio.seq.db.AbstractSequenceDB
-
- org.biojava.bio.seq.db.DummySequenceDB
-
- All Implemented Interfaces:
SequenceDB,SequenceDBLite,Changeable
public class DummySequenceDB extends AbstractSequenceDB implements SequenceDB
DummySequenceDBis an implementation which contains only aDummySequence. It will return the sameDummySequenceinstance 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
Constructors Constructor Description DummySequenceDB(String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSequence(Sequence seq)Adds a sequence to the database.StringgetName()Get the name of this sequence database.SequencegetSequence(String id)Retrieve a single sequence by its id.Setids()Get an immutable set of all of the IDs in the database.voidremoveSequence(String id)Remove the sequence associated with an ID from the database.SequenceIteratorsequenceIterator()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, 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.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
-
Methods inherited from interface org.biojava.bio.seq.db.SequenceDB
filter
-
-
-
-
Constructor Detail
-
DummySequenceDB
public DummySequenceDB(String name)
-
-
Method Detail
-
ids
public Set ids()
Description copied from interface:SequenceDBGet an immutable set of all of the IDs in the database. The ids are legal arguments to getSequence.- Specified by:
idsin interfaceSequenceDB- Returns:
- a Set of ids - at the moment, strings
-
sequenceIterator
public SequenceIterator sequenceIterator()
Description copied from interface:SequenceDBReturns a SequenceIterator over all sequences in the database. The order of retrieval is undefined.- Specified by:
sequenceIteratorin interfaceSequenceDB- Overrides:
sequenceIteratorin classAbstractSequenceDB- Returns:
- a SequenceIterator over all sequences
-
getName
public String getName()
Description copied from interface:SequenceDBLiteGet the name of this sequence database.- Specified by:
getNamein interfaceSequenceDBLite- Returns:
- the name of the sequence database, which may be null.
-
getSequence
public Sequence getSequence(String id) throws IllegalIDException, BioException
Description copied from interface:SequenceDBLiteRetrieve a single sequence by its id.- Specified by:
getSequencein interfaceSequenceDBLite- Parameters:
id- the id to retrieve by- Returns:
- the Sequence with that id
- Throws:
IllegalIDException- if the database doesn't know about the idBioException- if there was a failure in retrieving the sequence
-
addSequence
public void addSequence(Sequence seq) throws IllegalIDException, BioException, ChangeVetoException
Description copied from interface:SequenceDBLiteAdds a sequence to the database.- Specified by:
addSequencein interfaceSequenceDBLite- Overrides:
addSequencein classAbstractSequenceDB- Parameters:
seq- the Sequence to add- Throws:
IllegalIDException- if a uniqe ID could not be generated for seqBioException- if something goes wrong with adding the sequenceChangeVetoException- if either the database does not allow sequences to be added or the modification was vetoed
-
removeSequence
public void removeSequence(String id) throws IllegalIDException, BioException, ChangeVetoException
Description copied from interface:SequenceDBLiteRemove the sequence associated with an ID from the database.- Specified by:
removeSequencein interfaceSequenceDBLite- Overrides:
removeSequencein classAbstractSequenceDB- Parameters:
id- the ID of the sequence to remove- Throws:
IllegalIDException- if there is no sequence for the IDBioException- if something failed while removing the sequence for that IDChangeVetoException- if either the database does not allow sequences to be removed or the modification was vetoed
-
-