## 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.biojava.bio.seq.db.SequenceDBLite
`SEQUENCES`

Fields inherited from interface org.biojavax.bio.db.BioEntryDBLite
`BIOENTRYS`

Fields inherited from interface org.biojavax.bio.db.BioEntryDBLite
`BIOENTRYS`

Fields inherited from interface org.biojava.bio.seq.db.SequenceDBLite
`SEQUENCES`

Constructor Summary
`HashRichSequenceDB()` Generate a HashRichSequenceDB object that will use byName to generate ids for sequences and have a null 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.
`HashRichSequenceDB(String name)` Generate a HashRichSequenceDB object that will use byName to generate ids and will have the requested name.

Method Summary
`void` `addRichSequence(RichSequence seq)` Add a sequence.
`protected void` `addRichSequence(String id, RichSequence seq)`
`IDMaker` `getIDMaker()` Retrieve the IDMaker associated with this database.
`String` `getName()` Get the name of this sequence database.
`RichSequence` `getRichSequence(String id)` Retrieve a single RichSequence by its id.
`RichSequenceDB` `getRichSequences(Set ids)` Retrieve multiple RichSequence by its id.
`RichSequenceDB` `getRichSequences(Set ids, RichSequenceDB db)` Retrieve multiple RichSequence into a specific sequence database.
`Set` `ids()` Get an immutable set of all of the IDs in the database.
`void` `removeSequence(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.RichSequenceDB
`getRichSequenceIterator, sequenceIterator`

Methods inherited from interface org.biojava.bio.seq.db.SequenceDB
`filter`

Methods inherited from interface org.biojava.bio.seq.db.SequenceDBLite
`addSequence, getSequence`

Methods inherited from interface org.biojava.utils.Changeable
`addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener`

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.biojavax.bio.db.RichSequenceDBLite
`removeRichSequence`

Methods inherited from interface org.biojavax.bio.db.BioEntryDBLite
`addBioEntry, getBioEntry, getBioEntrys, getBioEntrys, removeBioEntry`

Methods inherited from interface org.biojava.bio.seq.db.SequenceDBLite
`addSequence, getSequence`

Methods inherited from interface org.biojava.utils.Changeable
`addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener`

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 sequence
    `name` - the name for this database

Method Detail

### getName

    public String getName()

  Description copied from interface: `SequenceDBLite`
  Get the name of this sequence database.

  Specified by:
    `getName` in interface `SequenceDBLite`
  Specified by:
    `getName` in interface `BioEntryDBLite`
  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: `RichSequenceDBLite`
  Retrieve a single RichSequence by its id.

  Specified by:
    `getRichSequence` in interface `RichSequenceDBLite`
  Parameters:
    `id` - the id to retrieve by
  Returns:
    the Sequence with that id
  Throws:
    `IllegalIDException` - if the database doesn't know about the id
    `BioException`

### getRichSequences

    public RichSequenceDB getRichSequences(Set ids)
                                    throws BioException,
                                           IllegalIDException

  Description copied from interface: `RichSequenceDBLite`
  Retrieve multiple RichSequence by its id.

  Specified by:
    `getRichSequences` in interface `RichSequenceDBLite`
  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 id
    `BioException`

### getRichSequences

    public RichSequenceDB getRichSequences(Set ids,
                                           RichSequenceDB db)
                                    throws BioException,
                                           IllegalIDException

  Description copied from interface: `RichSequenceDBLite`
  Retrieve multiple RichSequence into a specific sequence database. If that database is null, a new HashRichSequenceDB is used.

  Specified by:
    `getRichSequences` in interface `RichSequenceDBLite`
  Parameters:
    `ids` - a set of ids to retrieve by
    `db` - a database to load the seqs into
  Returns:
    the RichSequences with that id
  Throws:
    `IllegalIDException` - if the database doesn't know about the id
    `BioException`

### ids

    public 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`
  Specified by:
    `ids` in interface `BioEntryDB`
  Returns:
    a Set of ids - at the moment, strings

### addRichSequence

    public void addRichSequence(RichSequence seq)
                         throws IllegalIDException,
                                BioException,
                                ChangeVetoException

  Add a sequence.

  Specified by:
    `addRichSequence` in interface `RichSequenceDBLite`
  Overrides:
    `addRichSequence` in class `AbstractRichSequenceDB`
  Parameters:
    `seq` - the RichSequence to add
  Throws:
    `ChangeVetoException` - if this addition was vetoed
    `IllegalIDException` - if a uniqe ID could not be generated for RichSequence
    `BioException` - if something goes wrong with adding the RichSequence

### addRichSequence

    protected void addRichSequence(String id,
                                   RichSequence seq)
                            throws IllegalIDException,
                                   BioException,
                                   ChangeVetoException

  Throws:
    `IllegalIDException`
    `BioException`
    `ChangeVetoException`

### removeSequence

    public void removeSequence(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 `AbstractRichSequenceDB`
  Parameters:
    `id` - the ID of the sequence to remove
  Throws:
    `IllegalIDException` - if there is no sequence for the ID
    `BioException` - if something failed while removing the sequence for that ID
    `ChangeVetoException` - if either the database does not allow sequences to be removed or the modification was vetoed