JAL-961 store result of conservation analysis worker on the alignment viewport
[jalview.git] / src / jalview / viewmodel / AlignmentViewport.java
index cceff86..7e383a9 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
- * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
+ * Copyright (C) 2014 The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
@@ -14,6 +14,7 @@
  * 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/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
  */
 package jalview.viewmodel;
 
@@ -42,6 +43,7 @@ import jalview.workers.StrucConsensusThread;
 
 import java.awt.Color;
 import java.util.ArrayList;
+import java.util.BitSet;
 import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
@@ -297,7 +299,13 @@ public abstract class AlignmentViewport implements AlignViewportI
    * view
    */
   protected Hashtable[] hStrucConsensus = null;
-
+  
+  protected Conservation hconservation = null;
+  @Override
+  public void setConservation(Conservation cons)
+  {
+    hconservation = cons;
+  }
   /**
    * percentage gaps allowed in a column before all amino acid properties should
    * be considered unconserved
@@ -1416,7 +1424,7 @@ public abstract class AlignmentViewport implements AlignViewportI
     int charHeight = getCharHeight();
     if (aa != null)
     {
-      boolean graphgrp[] = null;
+      BitSet graphgrp = new BitSet();
       for (int i = 0; i < aa.length; i++)
       {
         if (aa[i] == null)
@@ -1430,17 +1438,13 @@ public abstract class AlignmentViewport implements AlignViewportI
         }
         if (aa[i].graphGroup > -1)
         {
-          if (graphgrp == null)
-          {
-            graphgrp = new boolean[aa.length];
-          }
-          if (graphgrp[aa[i].graphGroup])
+          if (graphgrp.get(aa[i].graphGroup))
           {
             continue;
           }
           else
           {
-            graphgrp[aa[i].graphGroup] = true;
+            graphgrp.set(aa[i].graphGroup);
           }
         }
         aa[i].height = 0;
@@ -1507,8 +1511,7 @@ public abstract class AlignmentViewport implements AlignViewportI
         if (aan[an].autoCalculated && aan[an].groupRef != null)
         {
           oldrfs.add(aan[an].groupRef);
-          alignment.deleteAnnotation(aan[an]);
-          aan[an] = null;
+          alignment.deleteAnnotation(aan[an],false);
         }
       }
     }