JAL-1292 avoid exception by using bitset of arbitrary width for remembering which...
authorJim Procter <jprocter@compbio.dundee.ac.uk>
Tue, 21 May 2013 08:33:56 +0000 (09:33 +0100)
committerJim Procter <jprocter@compbio.dundee.ac.uk>
Fri, 24 May 2013 14:10:54 +0000 (15:10 +0100)
src/jalview/renderer/AnnotationRenderer.java

index ab27d8a..7598f5f 100644 (file)
@@ -35,6 +35,7 @@ import java.awt.Image;
 import java.awt.font.LineMetrics;
 import java.awt.geom.AffineTransform;
 import java.awt.image.ImageObserver;
+import java.util.BitSet;
 import java.util.Hashtable;
 
 import com.stevesoft.pat.Regex;
@@ -272,7 +273,8 @@ public class AnnotationRenderer
     boolean centreColLabels, centreColLabelsDef = av
             .getCentreColumnLabels();
     boolean scaleColLabel = false;
-    boolean[] graphGroupDrawn = new boolean[aa.length];
+
+    BitSet graphGroupDrawn = new BitSet();
     int charOffset = 0; // offset for a label
     float fmWidth, fmScaling = 1f; // scaling for a label to fit it into a
     // column.
@@ -293,8 +295,7 @@ public class AnnotationRenderer
       lastSSX = 0;
       if (row.graph > 0)
       {
-        if (row.graphGroup > -1 && graphGroupDrawn[row.graphGroup])
-        {
+        if (row.graphGroup > -1 && graphGroupDrawn.get(row.graphGroup)) {
           continue;
         }
 
@@ -569,7 +570,7 @@ public class AnnotationRenderer
       {
         if (row.graph == AlignmentAnnotation.LINE_GRAPH)
         {
-          if (row.graphGroup > -1 && !graphGroupDrawn[row.graphGroup])
+          if (row.graphGroup > -1 && !graphGroupDrawn.get(row.graphGroup))
           {
             float groupmax = -999999, groupmin = 9999999;
             for (int gg = 0; gg < aa.length; gg++)
@@ -602,7 +603,7 @@ public class AnnotationRenderer
               }
             }
 
-            graphGroupDrawn[row.graphGroup] = true;
+            graphGroupDrawn.set(row.graphGroup);
           }
           else
           {