## org.biojava.bio.seq.db
Class HashSequenceDB

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

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

An implementation of SequenceDB that uses an underlying HashMap to store the sequence objects.

Author:
  Matthew Pocock, Gerald Loeffler
See Also:
  Serialized Form

Constructor Summary
`HashSequenceDB()` Generate a HashSequenceDB object that will use byName to generate ids for sequences and have a null name.
`HashSequenceDB(IDMaker idMaker)` Generate a HashSequenceDB object that will use idMaker to generate ids for sequences and have a null name.
`HashSequenceDB(IDMaker idMaker, java.lang.String name)` Generate a HashSequenceDB object that will use idMaker to generate ids for sequences and have the requested name.
`HashSequenceDB(java.lang.String name)` Generate a HashSequenceDB object that will use byName to generate ids and will have the requested name.

Method Summary
`void` `addSequence(Sequence seq)` Add a sequence under its default id.
`void` `addSequence(java.lang.String id, Sequence seq)` Add a sequence under a particular id.
`IDMaker` `getIDMaker()` Retrieve the IDMaker associated with this 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 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

### HashSequenceDB

    public HashSequenceDB()

  Generate a HashSequenceDB object that will use byName to generate ids for sequences and have a null name.

### HashSequenceDB

    public HashSequenceDB(IDMaker idMaker)

  Generate a HashSequenceDB 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

### HashSequenceDB

    public HashSequenceDB(java.lang.String name)

  Generate a HashSequenceDB object that will use byName to generate ids and will have the requested name.
  Parameters:
    `name` - the name for this database

### HashSequenceDB

    public HashSequenceDB(IDMaker idMaker,
                          java.lang.String name)

  Generate a HashSequenceDB 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 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)

  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

### addSequence

    public void addSequence(java.lang.String id,
                            Sequence seq)

  Add a sequence under a particular id.
  Parameters:
    `id` - the id to use
    `seq` - the Sequence to add

### getIDMaker

    public IDMaker getIDMaker()

  Retrieve the IDMaker associated with this database.
  Returns:
    the current IDMaker object

### addSequence

    public void addSequence(Sequence seq)

  Add a sequence under its default id.
  Parameters:
    `seq` - the Sequence to add