JAL-2015 JAL-1956 rollout of FeatureColourI in place of
[jalview.git] / src / jalview / io / SequenceAnnotationReport.java
index 07cfa8b..6573a7f 100644 (file)
  */
 package jalview.io;
 
-
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Vector;
-
 import jalview.datamodel.DBRefEntry;
 import jalview.datamodel.SequenceFeature;
 import jalview.datamodel.SequenceI;
 import jalview.util.UrlLink;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
 /**
  * generate HTML reports for a sequence
  * 
@@ -62,17 +60,16 @@ public class SequenceAnnotationReport
   }
 
   public void appendFeatures(final StringBuffer tooltipText2, int rpos,
-          List<SequenceFeature> features, Hashtable minmax)
+          List<SequenceFeature> features, Map<String, float[][]> map)
   {
     String tmpString;
     if (features != null)
     {
-      for (SequenceFeature feature:features)
+      for (SequenceFeature feature : features)
       {
         if (feature.getType().equals("disulfide bond"))
         {
-          if (feature.getBegin() == rpos
-                  || feature.getEnd() == rpos)
+          if (feature.getBegin() == rpos || feature.getEnd() == rpos)
           {
             if (tooltipText2.length() > 6)
             {
@@ -104,8 +101,7 @@ public class SequenceAnnotationReport
             }
 
             if (feature.getDescription() != null
-                    && !feature.description.equals(feature
-                            .getType()))
+                    && !feature.description.equals(feature.getType()))
             {
               tmpString = feature.getDescription();
               String tmp2up = tmpString.toUpperCase();
@@ -152,10 +148,10 @@ public class SequenceAnnotationReport
               }
             }
             // check score should be shown
-            if (feature.getScore() != Float.NaN)
+            if (!Float.isNaN(feature.getScore()))
             {
-              float[][] rng = (minmax == null) ? null : ((float[][]) minmax
-                      .get(feature.getType()));
+              float[][] rng = (map == null) ? null : (map.get(feature
+                      .getType()));
               if (rng != null && rng[0] != null && rng[0][0] != rng[0][1])
               {
                 tooltipText2.append(" Score=" + feature.getScore());
@@ -180,7 +176,7 @@ public class SequenceAnnotationReport
           }
           else
           {
-            for (String urlstring : (Vector<String>) feature.links)
+            for (String urlstring : feature.links)
             {
               try
               {
@@ -234,9 +230,8 @@ public class SequenceAnnotationReport
     {
 
       // collect matching db-refs
-      DBRefEntry[] dbr = jalview.util.DBRefUtils.selectRefs(seq.getDBRef(),
-              new String[]
-              { target });
+      DBRefEntry[] dbr = jalview.util.DBRefUtils.selectRefs(seq.getDBRefs(),
+              new String[] { target });
       // collect id string too
       String id = seq.getName();
       String descr = seq.getDescription();
@@ -263,8 +258,8 @@ public class SequenceAnnotationReport
               String unq = urls[u] + "|" + urls[u + 1];
               if (!uniques.contains(unq))
               {
-                urlSets.add(new String[]
-                { target, label, urls[u], urls[u + 1] });
+                urlSets.add(new String[] { target, label, urls[u],
+                    urls[u + 1] });
                 uniques.add(unq);
               }
             }
@@ -282,8 +277,8 @@ public class SequenceAnnotationReport
             String unq = urls[u] + "|" + urls[u + 1];
             if (!uniques.contains(unq))
             {
-              urlSets.add(new String[]
-              { target, label, urls[u], urls[u + 1] });
+              urlSets.add(new String[] { target, label, urls[u],
+                  urls[u + 1] });
               uniques.add(unq);
             }
           }
@@ -300,8 +295,8 @@ public class SequenceAnnotationReport
             String unq = urls[u] + "|" + urls[u + 1];
             if (!uniques.contains(unq))
             {
-              urlSets.add(new String[]
-              { target, label, urls[u], urls[u + 1] });
+              urlSets.add(new String[] { target, label, urls[u],
+                  urls[u + 1] });
               uniques.add(unq);
             }
           }
@@ -316,18 +311,17 @@ public class SequenceAnnotationReport
       {
         uniques.add(unq);
         // Add a non-dynamic link
-        urlSets.add(new String[]
-        { target, label, null, urlLink.getUrl_prefix() });
+        urlSets.add(new String[] { target, label, null,
+            urlLink.getUrl_prefix() });
       }
     }
 
-    return urlSets.toArray(new String[][]
-    {});
+    return urlSets.toArray(new String[][] {});
   }
 
   public void createSequenceAnnotationReport(final StringBuffer tip,
           SequenceI sequence, boolean showDbRefs, boolean showNpFeats,
-          Hashtable minmax)
+          Map<String, float[][]> minmax)
   {
     createSequenceAnnotationReport(tip, sequence, showDbRefs, showNpFeats,
             true, minmax);
@@ -335,7 +329,7 @@ public class SequenceAnnotationReport
 
   public void createSequenceAnnotationReport(final StringBuffer tip,
           SequenceI sequence, boolean showDbRefs, boolean showNpFeats,
-          boolean tableWrap, Hashtable minmax)
+          boolean tableWrap, Map<String, float[][]> map)
   {
     String tmp;
     tip.append("<i>");
@@ -352,7 +346,7 @@ public class SequenceAnnotationReport
     {
       ds = ds.getDatasetSequence();
     }
-    DBRefEntry[] dbrefs = ds.getDBRef();
+    DBRefEntry[] dbrefs = ds.getDBRefs();
     if (showDbRefs && dbrefs != null)
     {
       for (int i = 0; i < dbrefs.length; i++)
@@ -375,7 +369,7 @@ public class SequenceAnnotationReport
           int sz = -tip.length();
           List<SequenceFeature> tfeat = new ArrayList<SequenceFeature>();
           tfeat.add(features[i]);
-          appendFeatures(tip, 0, tfeat, minmax);
+          appendFeatures(tip, 0, tfeat, map);
           sz += tip.length();
           maxWidth = Math.max(maxWidth, sz);
         }