JAL-1683 replace year/version strings with tokens in source
[jalview.git] / src / jalview / io / SequenceAnnotationReport.java
index 74cfa86..610c03f 100644 (file)
@@ -1,25 +1,28 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1)
- * Copyright (C) 2014 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
  * Jalview is free software: you can redistribute it and/or
  * modify it under the terms of the GNU General Public License 
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
  *  
  * Jalview is distributed in the hope that it will be useful, but 
  * WITHOUT ANY WARRANTY; without even the implied warranty 
  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
  * PURPOSE.  See the GNU General Public License for more details.
  * 
- * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
  * The Jalview Authors are detailed in the 'AUTHORS' file.
  */
 package jalview.io;
 
 import java.util.ArrayList;
 import java.util.Hashtable;
+import java.util.List;
 import java.util.Vector;
 
 import jalview.datamodel.DBRefEntry;
@@ -52,30 +55,30 @@ public class SequenceAnnotationReport
    *          TODO refactor to Jalview 'utilities' somehow.
    */
   public void appendFeatures(final StringBuffer tooltipText2, int rpos,
-          SequenceFeature[] features)
+          List<SequenceFeature> features)
   {
     appendFeatures(tooltipText2, rpos, features, null);
   }
 
   public void appendFeatures(final StringBuffer tooltipText2, int rpos,
-          SequenceFeature[] features, Hashtable minmax)
+          List<SequenceFeature> features, Hashtable minmax)
   {
     String tmpString;
     if (features != null)
     {
-      for (int i = 0; i < features.length; i++)
+      for (SequenceFeature feature:features)
       {
-        if (features[i].getType().equals("disulfide bond"))
+        if (feature.getType().equals("disulfide bond"))
         {
-          if (features[i].getBegin() == rpos
-                  || features[i].getEnd() == rpos)
+          if (feature.getBegin() == rpos
+                  || feature.getEnd() == rpos)
           {
             if (tooltipText2.length() > 6)
             {
               tooltipText2.append("<br>");
             }
-            tooltipText2.append("disulfide bond " + features[i].getBegin()
-                    + ":" + features[i].getEnd());
+            tooltipText2.append("disulfide bond " + feature.getBegin()
+                    + ":" + feature.getEnd());
           }
         }
         else
@@ -85,25 +88,25 @@ public class SequenceAnnotationReport
             tooltipText2.append("<br>");
           }
           // TODO: remove this hack to display link only features
-          boolean linkOnly = features[i].getValue("linkonly") != null;
+          boolean linkOnly = feature.getValue("linkonly") != null;
           if (!linkOnly)
           {
-            tooltipText2.append(features[i].getType() + " ");
+            tooltipText2.append(feature.getType() + " ");
             if (rpos != 0)
             {
               // we are marking a positional feature
-              tooltipText2.append(features[i].begin);
+              tooltipText2.append(feature.begin);
             }
-            if (features[i].begin != features[i].end)
+            if (feature.begin != feature.end)
             {
-              tooltipText2.append(" " + features[i].end);
+              tooltipText2.append(" " + feature.end);
             }
 
-            if (features[i].getDescription() != null
-                    && !features[i].description.equals(features[i]
+            if (feature.getDescription() != null
+                    && !feature.description.equals(feature
                             .getType()))
             {
-              tmpString = features[i].getDescription();
+              tmpString = feature.getDescription();
               String tmp2up = tmpString.toUpperCase();
               int startTag = tmp2up.indexOf("<HTML>");
               if (startTag > -1)
@@ -148,27 +151,27 @@ public class SequenceAnnotationReport
               }
             }
             // check score should be shown
-            if (features[i].getScore() != Float.NaN)
+            if (feature.getScore() != Float.NaN)
             {
               float[][] rng = (minmax == null) ? null : ((float[][]) minmax
-                      .get(features[i].getType()));
+                      .get(feature.getType()));
               if (rng != null && rng[0] != null && rng[0][0] != rng[0][1])
               {
-                tooltipText2.append(" Score=" + features[i].getScore());
+                tooltipText2.append(" Score=" + feature.getScore());
               }
             }
-            if (features[i].getValue("status") != null)
+            if (feature.getValue("status") != null)
             {
-              String status = features[i].getValue("status").toString();
+              String status = feature.getValue("status").toString();
               if (status.length() > 0)
               {
-                tooltipText2.append("; (" + features[i].getValue("status")
+                tooltipText2.append("; (" + feature.getValue("status")
                         + ")");
               }
             }
           }
         }
-        if (features[i].links != null)
+        if (feature.links != null)
         {
           if (linkImageURL != null)
           {
@@ -176,7 +179,7 @@ public class SequenceAnnotationReport
           }
           else
           {
-            for (String urlstring : (Vector<String>) features[i].links)
+            for (String urlstring : (Vector<String>) feature.links)
             {
               try
               {
@@ -362,7 +365,6 @@ public class SequenceAnnotationReport
 
     // ADD NON POSITIONAL SEQUENCE INFO
     SequenceFeature[] features = ds.getSequenceFeatures();
-    SequenceFeature[] tfeat = new SequenceFeature[1];
     if (showNpFeats && features != null)
     {
       for (int i = 0; i < features.length; i++)
@@ -370,7 +372,8 @@ public class SequenceAnnotationReport
         if (features[i].begin == 0 && features[i].end == 0)
         {
           int sz = -tip.length();
-          tfeat[0] = features[i];
+          List<SequenceFeature> tfeat = new ArrayList<SequenceFeature>();
+          tfeat.add(features[i]);
           appendFeatures(tip, 0, tfeat, minmax);
           sz += tip.length();
           maxWidth = Math.max(maxWidth, sz);