*/
package jalview.ws.seqfetcher;
+import jalview.bin.Cache;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.DBRefEntry;
import jalview.datamodel.SequenceI;
import jalview.util.DBRefUtils;
import jalview.util.MessageManager;
+import jalview.util.QuickSort;
import java.util.ArrayList;
import java.util.Enumeration;
return null;
}
String[] sf = new String[FETCHABLEDBS.size()];
- Enumeration e = FETCHABLEDBS.keys();
+ Enumeration<String> e = FETCHABLEDBS.keys();
int i = 0;
while (e.hasMoreElements())
{
- sf[i++] = (String) e.nextElement();
+ sf[i++] = e.nextElement();
}
;
return sf;
public boolean isFetchable(String source)
{
- Enumeration e = FETCHABLEDBS.keys();
+ Enumeration<String> e = FETCHABLEDBS.keys();
while (e.hasMoreElements())
{
- String db = (String) e.nextElement();
+ String db = e.nextElement();
if (source.compareToIgnoreCase(db) == 0)
{
return true;
}
}
- jalview.bin.Cache.log.warn("isFetchable doesn't know about '" + source
+ Cache.log.warn("isFetchable doesn't know about '" + source
+ "'");
return false;
}
- public SequenceI[] getSequences(jalview.datamodel.DBRefEntry[] refs)
+ public SequenceI[] getSequences(DBRefEntry[] refs)
{
SequenceI[] ret = null;
- Vector<SequenceI> rseqs = new Vector();
- Hashtable<String, List<String>> queries = new Hashtable();
+ Vector<SequenceI> rseqs = new Vector<SequenceI>();
+ Hashtable<String, List<String>> queries = new Hashtable<String, List<String>>();
for (int r = 0; r < refs.length; r++)
{
if (!queries.containsKey(refs[r].getSource()))
while (fetchers.hasNext())
{
List<String> queriesMade = new ArrayList<String>();
- HashSet queriesFound = new HashSet<String>();
+ HashSet<String> queriesFound = new HashSet<String>();
try
{
DbSourceProxy fetcher = fetchers.next();
- boolean doMultiple = fetcher.getAccessionSeparator() != null; // No
- // separator
- // - no
- // Multiple
- // Queries
+ boolean doMultiple = fetcher.getAccessionSeparator() != null;
+ // No separator - no Multiple Queries
while (!queriesLeft.isEmpty())
{
StringBuffer qsb = new StringBuffer();
if (rseqs.size() > 0)
{
ret = new SequenceI[rseqs.size()];
- Enumeration sqs = rseqs.elements();
+ Enumeration<SequenceI> sqs = rseqs.elements();
int si = 0;
while (sqs.hasMoreElements())
{
- SequenceI s = (SequenceI) sqs.nextElement();
+ SequenceI s = sqs.nextElement();
ret[si++] = s;
s.updatePDBIds();
}
{
nm[i++] = "" + s.getTier() + s.getDbName().toLowerCase();
}
- jalview.util.QuickSort.sort(nm, l);
+ QuickSort.sort(nm, l);
dbs = new ArrayList<DbSourceProxy>();
for (i = l.length - 1; i >= 0; i--)
{
}
/**
- * constructs and instance of the proxy and registers it as a valid
- * dbrefsource
+ * constructs an instance of the proxy and registers it as a valid dbrefsource
*
* @param dbSourceProxy
* reference for class implementing
*/
protected void addDBRefSourceImpl(
Class<? extends DbSourceProxy> dbSourceProxy)
- throws java.lang.IllegalArgumentException
+ throws IllegalArgumentException
{
DbSourceProxy proxy = null;
try
}
/**
- * test if the database handler for dbName contains the given dbProperty when
- * a dbName resolves to a set of proxies - this method will return the result
- * of the test for the first instance. TODO implement additional method to
- * query all sources for a db to find one with a particular property
- *
- * @param dbName
- * @param dbProperty
- * @return true if proxy has the given property
- */
- public boolean hasDbSourceProperty(String dbName, String dbProperty)
- {
- // TODO: decide if invalidDbName exception is thrown here.
-
- List<DbSourceProxy> proxies = getSourceProxy(dbName);
- if (proxies != null)
- {
- for (DbSourceProxy proxy : proxies)
- {
- if (proxy.getDbSourceProperties() != null)
- {
- return proxy.getDbSourceProperties().containsKey(dbProperty);
- }
- }
- }
- return false;
- }
-
- /**
* select sources which are implemented by instances of the given class
*
* @param class that implements DbSourceProxy
*/
public String[] getDbInstances(Class class1)
{
- if (!jalview.ws.seqfetcher.DbSourceProxy.class.isAssignableFrom(class1))
+ if (!DbSourceProxy.class.isAssignableFrom(class1))
{
throw new Error(
MessageManager
return null;
}
String[] sources = null;
- Vector src = new Vector();
- Enumeration dbs = FETCHABLEDBS.keys();
+ Vector<String> src = new Vector<String>();
+ Enumeration<String> dbs = FETCHABLEDBS.keys();
while (dbs.hasMoreElements())
{
- String dbn = (String) dbs.nextElement();
+ String dbn = dbs.nextElement();
for (DbSourceProxy dbp : FETCHABLEDBS.get(dbn).values())
{
if (class1.isAssignableFrom(dbp.getClass()))
public DbSourceProxy[] getDbSourceProxyInstances(Class class1)
{
- ArrayList<DbSourceProxy> prlist = new ArrayList<DbSourceProxy>();
+ List<DbSourceProxy> prlist = new ArrayList<DbSourceProxy>();
for (String fetchable : getSupportedDb())
{
for (DbSourceProxy pr : getSourceProxy(fetchable))