From be7a79e1fa45453d8916841c9cb0e5e70621d844 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Tue, 21 May 2013 09:33:56 +0100 Subject: [PATCH] JAL-1292 avoid exception by using bitset of arbitrary width for remembering which graphgroups have been drawn --- src/jalview/renderer/AnnotationRenderer.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/jalview/renderer/AnnotationRenderer.java b/src/jalview/renderer/AnnotationRenderer.java index ab27d8a..7598f5f 100644 --- a/src/jalview/renderer/AnnotationRenderer.java +++ b/src/jalview/renderer/AnnotationRenderer.java @@ -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 { -- 1.7.10.2