JAL-4446 .. missing methods for cancellable pasimap
authorJim Procter <jprocter@dundee.ac.uk>
Mon, 5 Aug 2024 17:41:40 +0000 (18:41 +0100)
committerJim Procter <jprocter@dundee.ac.uk>
Mon, 5 Aug 2024 17:41:40 +0000 (18:41 +0100)
src/jalview/analysis/PaSiMap.java

index 5be8c7b..b2a17ac 100755 (executable)
@@ -60,6 +60,8 @@ public class PaSiMap implements Runnable
    * outputs
    */
   final private PairwiseAlignPanel alignment;
+  
+  private boolean cancelled=false;
 
   private MatrixI pairwiseScores;
 
@@ -230,6 +232,11 @@ public class PaSiMap implements Runnable
     {
       // alignment = new PairwiseAlignPanel(seqs, true, 100, 5);
       alignment.calculate(scoreMatrix);
+      if (alignment.isCancelled())
+      {
+        cancel();
+        return;
+      }
       float[][] scores = alignment.getAlignmentScores(); // bigger index first
                                                          // -- eg scores[14][13]
       SequenceI[] iseqs = alignment.getInputSequences();
@@ -249,6 +256,22 @@ public class PaSiMap implements Runnable
       q.printStackTrace();
     }
   }
+  
+  
+
+  public void cancel()
+  {
+    if (alignment!=null)
+    {
+      alignment.cancel();
+    }
+    cancelled=true;
+  }
+  
+  public boolean isCancelled()
+  {
+    return cancelled;
+  }
 
   /**
    * Returns a PrintStream that wraps (appends its output to) the given