Package org.biojava.bio.seq.db
Class SimpleSequenceDBInstallation
- java.lang.Object
-
- org.biojava.bio.seq.db.SimpleSequenceDBInstallation
-
- All Implemented Interfaces:
SequenceDBInstallation
public class SimpleSequenceDBInstallation extends Object implements SequenceDBInstallation
This class is an implementation of interface SequenceDBInstallation that manages a set of SequenceDB objects. The set of SequenceDB objects is initially empty and can be expanded by the user through the addSequenceDB() method. This SequenceDBInstallation is then able to serve the SequenceDB objects in this set.- Author:
- Keith James, Gerald Loeffler (primary author) for the IMP
-
-
Constructor Summary
Constructors Constructor Description SimpleSequenceDBInstallation()
create an initially empty SimpleSequenceDBInstallation
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSequenceDB(String name, Set otherIdentifiers)
This method creates a new (and empty) HashSequenceDB with the given name that will be accessible through this sequence db installation through this name and all given other identifiers.void
addSequenceDB(SequenceDBLite sequenceDB, Set otherIdentifiers)
addSequenceDB
adds a new SequenceDB which will be accessible via the name returned by its getName() method and via all other given identifiers.boolean
equals(Object o)
SequenceDBLite
getSequenceDB(String identifier)
If the given identifier is known to this sequence db installation because it has been used in a call to addSequenceDB(), then this method returns the SequenceDB associated with this identifier.Set
getSequenceDBs()
Return a newly created set of the SequenceDB objects that were already created through method addSequenceDB().int
hashCode()
static void
main(String[] args)
Test this classString
toString()
-
-
-
Constructor Detail
-
SimpleSequenceDBInstallation
public SimpleSequenceDBInstallation()
create an initially empty SimpleSequenceDBInstallation
-
-
Method Detail
-
addSequenceDB
public void addSequenceDB(String name, Set otherIdentifiers)
This method creates a new (and empty) HashSequenceDB with the given name that will be accessible through this sequence db installation through this name and all given other identifiers.- Parameters:
name
- the name of the SequenceDB to create. Not null. If this name is already used by this sequence db installation, an IllegalArgumentException is thrown.otherIdentifiers
- a set of String objects that also serve as identifiers for the newly created SequenceDB object. This set should not contain the name of the SequenceDB, but if if does, it is just ignored because the name is an identifier by definition. The parameter may be empty or the empty set, in which case the name is the only identifier for the newly created SequenceDB. If any of the given identifiers (including the name) is already used by this SimpleSequenceDBInstallation, an IllegalArgumentException is thrown.
-
addSequenceDB
public void addSequenceDB(SequenceDBLite sequenceDB, Set otherIdentifiers)
addSequenceDB
adds a new SequenceDB which will be accessible via the name returned by its getName() method and via all other given identifiers.- Specified by:
addSequenceDB
in interfaceSequenceDBInstallation
- Parameters:
sequenceDB
- aSequenceDB
object to add. Although a SequenceDB may normally have a null name this is not acceptable when it is added to a SimpleSequenceDBInstallation as the name is used as its primary identifier. If the name is already used by this SimpleSequenceDBInstallation, an IllegalArgumentException is thrown.otherIdentifiers
- aSet
of String objects that also serve as identifiers for the newly created SequenceDB. This set should not contain the name of the SequenceDB, but if if does, it is just ignored because the name is an identifier by definition. The parameter may be empty or the empty set, in which case the name is the only identifier for the newly created SequenceDB. If any of the given identifiers (including the name) is already used by this sequence db installation, an IllegalArgumentException is thrown.
-
getSequenceDBs
public Set getSequenceDBs()
Return a newly created set of the SequenceDB objects that were already created through method addSequenceDB(). This set itself is not part of the state of this object (i.e. modifying the set does not modify this object) but the SequenceDB objects contained in the set are the same objects managed by this object.- Specified by:
getSequenceDBs
in interfaceSequenceDBInstallation
- Returns:
- a set of SequenceDB objects which may be empty. An implementation may also return null if it is not at all possible to determine which sequence dbs are part of this installation.
-
getSequenceDB
public SequenceDBLite getSequenceDB(String identifier)
If the given identifier is known to this sequence db installation because it has been used in a call to addSequenceDB(), then this method returns the SequenceDB associated with this identifier. Otherwise, null is returned.- Specified by:
getSequenceDB
in interfaceSequenceDBInstallation
- Parameters:
identifier
- the string that identifies the sequence db. May not be null.- Returns:
- the SequenceDB object that matches the given identifier or null if no such SequenceDB object could be found. (It is the responsibility of the implementation to take care that all identifiers are unique so if it turns out that the given identifier identifies more than one sequence db, this method should throw a RuntimeException.)
-
-