formatting
[jalview.git] / src / jalview / ws / seqfetcher / ASequenceFetcher.java
index 09a7a95..05d541f 100644 (file)
@@ -113,7 +113,7 @@ public class ASequenceFetcher
       }\r
       Iterator<DbSourceProxy> fetchers = getSourceProxy(db).iterator();\r
       Stack<String> queriesLeft = new Stack<String>();\r
-//      List<String> queriesFailed = new ArrayList<String>();\r
+      // List<String> queriesFailed = new ArrayList<String>();\r
       queriesLeft.addAll(query);\r
       while (fetchers.hasNext())\r
       {\r
@@ -146,7 +146,7 @@ public class ASequenceFetcher
             {\r
               // create a fetcher and go to it\r
               seqset = fetcher.getSequenceRecords(qsb.toString()); // ,\r
-                      // queriesFailed);\r
+              // queriesFailed);\r
             } catch (Exception ex)\r
             {\r
               System.err.println("Failed to retrieve the following from "\r
@@ -262,23 +262,30 @@ public class ASequenceFetcher
   public List<DbSourceProxy> getSourceProxy(String db)\r
   {\r
     List<DbSourceProxy> dbs;\r
-    Map<String,DbSourceProxy> dblist = FETCHABLEDBS.get(db);\r
-    if (dblist==null) {return new ArrayList<DbSourceProxy>();};\r
-    if (dblist.size()>1) {\r
-      DbSourceProxy[] l=dblist.values().toArray(new DbSourceProxy[0]);\r
-      int i=0;\r
-      String[] nm=new String[l.length];\r
-      for (DbSourceProxy s:l)\r
+    Map<String, DbSourceProxy> dblist = FETCHABLEDBS.get(db);\r
+    if (dblist == null)\r
+    {\r
+      return new ArrayList<DbSourceProxy>();\r
+    }\r
+    ;\r
+    if (dblist.size() > 1)\r
+    {\r
+      DbSourceProxy[] l = dblist.values().toArray(new DbSourceProxy[0]);\r
+      int i = 0;\r
+      String[] nm = new String[l.length];\r
+      for (DbSourceProxy s : l)\r
       {\r
-        nm[i++]=s.getDbName().toLowerCase();\r
+        nm[i++] = s.getDbName().toLowerCase();\r
       }\r
-      jalview.util.QuickSort.sort(nm,l);\r
+      jalview.util.QuickSort.sort(nm, l);\r
       dbs = new ArrayList<DbSourceProxy>();\r
-      for (i=l.length-1;i>=0; i--)\r
+      for (i = l.length - 1; i >= 0; i--)\r
       {\r
         dbs.add(l[i]);\r
       }\r
-    } else {\r
+    }\r
+    else\r
+    {\r
       dbs = new ArrayList<DbSourceProxy>(dblist.values());\r
     }\r
     return dbs;\r
@@ -332,22 +339,25 @@ public class ASequenceFetcher
     {\r
       if (FETCHABLEDBS == null)\r
       {\r
-        FETCHABLEDBS = new Hashtable<String, Map<String,DbSourceProxy>>();\r
+        FETCHABLEDBS = new Hashtable<String, Map<String, DbSourceProxy>>();\r
       }\r
-      Map<String,DbSourceProxy> slist = FETCHABLEDBS.get(proxy.getDbSource());\r
+      Map<String, DbSourceProxy> slist = FETCHABLEDBS.get(proxy\r
+              .getDbSource());\r
       if (slist == null)\r
       {\r
         FETCHABLEDBS.put(proxy.getDbSource(),\r
-                slist = new Hashtable<String,DbSourceProxy>());\r
+                slist = new Hashtable<String, DbSourceProxy>());\r
       }\r
-      slist.put(proxy.getDbName(),proxy);\r
+      slist.put(proxy.getDbName(), proxy);\r
     }\r
   }\r
 \r
   /**\r
-   * test if the database handler for dbName contains the given dbProperty\r
-   * when a dbName resolves to a set of proxies - this method will return the result of the test for the first instance.\r
-   * TODO implement additional method to query all sources for a db to find one with a particular property\r
+   * test if the database handler for dbName contains the given dbProperty when\r
+   * a dbName resolves to a set of proxies - this method will return the result\r
+   * of the test for the first instance. TODO implement additional method to\r
+   * query all sources for a db to find one with a particular property\r
+   * \r
    * @param dbName\r
    * @param dbProperty\r
    * @return true if proxy has the given property\r
@@ -408,16 +418,19 @@ public class ASequenceFetcher
     }\r
     return sources;\r
   }\r
-  public DbSourceProxy[] getDbSourceProxyInstances(\r
-          Class class1)\r
+\r
+  public DbSourceProxy[] getDbSourceProxyInstances(Class class1)\r
   {\r
-    ArrayList<DbSourceProxy> prlist=new ArrayList<DbSourceProxy>();\r
-    for (String fetchable:getSupportedDb())\r
-    for (DbSourceProxy pr:getSourceProxy(fetchable))\r
-    {\r
-      if (class1.isInstance(pr)) {prlist.add(pr);}\r
-    }\r
-    if (prlist.size()==0)\r
+    ArrayList<DbSourceProxy> prlist = new ArrayList<DbSourceProxy>();\r
+    for (String fetchable : getSupportedDb())\r
+      for (DbSourceProxy pr : getSourceProxy(fetchable))\r
+      {\r
+        if (class1.isInstance(pr))\r
+        {\r
+          prlist.add(pr);\r
+        }\r
+      }\r
+    if (prlist.size() == 0)\r
     {\r
       return null;\r
     }\r