Package org.biojavax.bio.db
Class HashRichSequenceDB
- java.lang.Object
 - 
- org.biojava.utils.AbstractChangeable
 - 
- org.biojavax.bio.db.AbstractBioEntryDB
 - 
- org.biojavax.bio.db.AbstractRichSequenceDB
 - 
- org.biojavax.bio.db.HashRichSequenceDB
 
 
 
 
 
- 
- All Implemented Interfaces:
 SequenceDB,SequenceDBLite,Changeable,BioEntryDB,BioEntryDBLite,RichSequenceDB,RichSequenceDBLite
public class HashRichSequenceDB extends AbstractRichSequenceDB implements RichSequenceDB
An implementation of RichSequenceDB that uses an underlying HashMap to store the RichSequence objects.- Since:
 - 1.5
 - Author:
 - Matthew Pocock, Gerald Loeffler, Richard Holland
 
 
- 
- 
Field Summary
- 
Fields inherited from interface org.biojavax.bio.db.BioEntryDBLite
BIOENTRYS 
- 
Fields inherited from interface org.biojava.bio.seq.db.SequenceDBLite
SEQUENCES 
 - 
 
- 
Constructor Summary
Constructors Constructor Description HashRichSequenceDB()Generate a HashRichSequenceDB object that will use byName to generate ids for sequences and have a null name.HashRichSequenceDB(String name)Generate a HashRichSequenceDB object that will use byName to generate ids and will have the requested name.HashRichSequenceDB(IDMaker idMaker)Generate a HashRichSequenceDB object that will use idMaker to generate ids for sequences and have a null name.HashRichSequenceDB(IDMaker idMaker, String name)Generate a HashRichSequenceDB object that will use idMaker to generate ids for sequences and have the requested name. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddRichSequence(String id, RichSequence seq)voidaddRichSequence(RichSequence seq)Add a sequence.IDMakergetIDMaker()Retrieve the IDMaker associated with this database.StringgetName()Get the name of this sequence database.RichSequencegetRichSequence(String id)Retrieve a single RichSequence by its id.RichSequenceDBgetRichSequences(Set ids)Retrieve multiple RichSequence by its id.RichSequenceDBgetRichSequences(Set ids, RichSequenceDB db)Retrieve multiple RichSequence into a specific sequence database.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.- 
Methods inherited from class org.biojavax.bio.db.AbstractRichSequenceDB
addBioEntry, addSequence, filter, getBioEntry, getBioEntryIterator, getBioEntrys, getBioEntrys, getRichSequenceIterator, getSequence, removeBioEntry, removeRichSequence, sequenceIterator 
- 
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.biojavax.bio.db.BioEntryDB
getBioEntryIterator 
- 
Methods inherited from interface org.biojavax.bio.db.BioEntryDBLite
addBioEntry, getBioEntry, getBioEntrys, getBioEntrys, removeBioEntry 
- 
Methods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener 
- 
Methods inherited from interface org.biojavax.bio.db.RichSequenceDB
getRichSequenceIterator, sequenceIterator 
- 
Methods inherited from interface org.biojavax.bio.db.RichSequenceDBLite
removeRichSequence 
- 
Methods inherited from interface org.biojava.bio.seq.db.SequenceDB
filter 
- 
Methods inherited from interface org.biojava.bio.seq.db.SequenceDBLite
addSequence, getSequence 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
HashRichSequenceDB
public HashRichSequenceDB()
Generate a HashRichSequenceDB object that will use byName to generate ids for sequences and have a null name. 
- 
HashRichSequenceDB
public HashRichSequenceDB(IDMaker idMaker)
Generate a HashRichSequenceDB object that will use idMaker to generate ids for sequences and have a null name.- Parameters:
 idMaker- the object that will work out the default id for a sequence
 
- 
HashRichSequenceDB
public HashRichSequenceDB(String name)
Generate a HashRichSequenceDB object that will use byName to generate ids and will have the requested name.- Parameters:
 name- the name for this database
 
- 
HashRichSequenceDB
public HashRichSequenceDB(IDMaker idMaker, String name)
Generate a HashRichSequenceDB object that will use idMaker to generate ids for sequences and have the requested name.- Parameters:
 idMaker- the object that will work out the default id for a sequencename- the name for this database
 
 - 
 
- 
Method Detail
- 
getName
public String getName()
Description copied from interface:SequenceDBLiteGet the name of this sequence database.- Specified by:
 getNamein interfaceBioEntryDBLite- Specified by:
 getNamein interfaceSequenceDBLite- Returns:
 - the name of the sequence database, which may be null.
 
 
- 
getIDMaker
public IDMaker getIDMaker()
Retrieve the IDMaker associated with this database.- Returns:
 - the current IDMaker object
 
 
- 
getRichSequence
public RichSequence getRichSequence(String id) throws BioException, IllegalIDException
Description copied from interface:RichSequenceDBLiteRetrieve a single RichSequence by its id.- Specified by:
 getRichSequencein interfaceRichSequenceDBLite- Parameters:
 id- the id to retrieve by- Returns:
 - the Sequence with that id
 - Throws:
 IllegalIDException- if the database doesn't know about the idBioException
 
- 
getRichSequences
public RichSequenceDB getRichSequences(Set ids) throws BioException, IllegalIDException
Description copied from interface:RichSequenceDBLiteRetrieve multiple RichSequence by its id.- Specified by:
 getRichSequencesin interfaceRichSequenceDBLite- Parameters:
 ids- a set of ids to retrieve by- Returns:
 - the RichSequences with that id
 - Throws:
 IllegalIDException- if the database doesn't know about the idBioException
 
- 
getRichSequences
public RichSequenceDB getRichSequences(Set ids, RichSequenceDB db) throws BioException, IllegalIDException
Description copied from interface:RichSequenceDBLiteRetrieve multiple RichSequence into a specific sequence database. If that database is null, a new HashRichSequenceDB is used.- Specified by:
 getRichSequencesin interfaceRichSequenceDBLite- Parameters:
 ids- a set of ids to retrieve bydb- a database to load the seqs into- Returns:
 - the RichSequences with that id
 - Throws:
 IllegalIDException- if the database doesn't know about the idBioException
 
- 
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 interfaceBioEntryDB- Specified by:
 idsin interfaceSequenceDB- Returns:
 - a Set of ids - at the moment, strings
 
 
- 
addRichSequence
public void addRichSequence(RichSequence seq) throws IllegalIDException, BioException, ChangeVetoException
Add a sequence.- Specified by:
 addRichSequencein interfaceRichSequenceDBLite- Overrides:
 addRichSequencein classAbstractRichSequenceDB- Parameters:
 seq- the RichSequence to add- Throws:
 ChangeVetoException- if this addition was vetoedIllegalIDException- if a uniqe ID could not be generated for RichSequenceBioException- if something goes wrong with adding the RichSequence
 
- 
addRichSequence
protected void addRichSequence(String id, RichSequence seq) throws IllegalIDException, BioException, ChangeVetoException
 
- 
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 classAbstractRichSequenceDB- 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
 
 - 
 
 -