JAL-3070 pull up sequence anonymisation hash, presets and params list.
[jalview.git] / src / jalview / ws / jws2 / MsaWSThread.java
index db6e03f..b1d6452 100644 (file)
@@ -38,12 +38,11 @@ import jalview.ws.AWsJob;
 import jalview.ws.JobStateSummary;
 import jalview.ws.WSClientI;
 import jalview.ws.jws2.dm.JabaWsParamSet;
+import jalview.ws.params.ArgumentI;
 import jalview.ws.params.WsParamSetI;
 
 import java.util.ArrayList;
-import java.util.Hashtable;
 import java.util.List;
-import java.util.Map;
 import java.util.Vector;
 
 import javax.swing.JInternalFrame;
@@ -68,14 +67,10 @@ class MsaWSThread extends AWS2Thread implements WSClientI
   {
     long lastChunk = 0;
 
-    WsParamSetI preset = null;
-
-    List<Argument> arguments = null;
-
     /**
      * input
      */
-    ArrayList<compbio.data.sequence.FastaSequence> seqs = new ArrayList<compbio.data.sequence.FastaSequence>();
+    ArrayList<compbio.data.sequence.FastaSequence> seqs = new ArrayList<>();
 
     /**
      * output
@@ -106,8 +101,6 @@ class MsaWSThread extends AWS2Thread implements WSClientI
 
     }
 
-    Hashtable<String, Map> SeqNames = new Hashtable();
-
     Vector<String[]> emptySeqs = new Vector();
 
     /**
@@ -139,7 +132,6 @@ class MsaWSThread extends AWS2Thread implements WSClientI
       compbio.data.sequence.FastaSequence seq;
       for (int i = 0, n = 0; i < seqs.length; i++)
       {
-
         String newname = jalview.analysis.SeqsetUtils.unique_name(i); // same
         // for
         // any
@@ -379,14 +371,14 @@ class MsaWSThread extends AWS2Thread implements WSClientI
 
     public List<Argument> getJabaArguments()
     {
-      List<Argument> newargs = new ArrayList<Argument>();
+      List<Argument> newargs = new ArrayList<>();
       if (preset != null && preset instanceof JabaWsParamSet)
       {
         newargs.addAll(((JabaWsParamSet) preset).getjabaArguments());
       }
       if (arguments != null && arguments.size() > 0)
       {
-        newargs.addAll(arguments);
+        newargs.addAll(JabaParamStore.getJabafromJwsArgs(arguments));
       }
       return newargs;
     }
@@ -403,7 +395,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI
                 + "Preset: " + preset.getName());
         if (preset instanceof JabaWsParamSet)
         {
-          for (Argument opt : ((JabaWsParamSet) preset).getjabaArguments())
+          for (Argument opt : getJabaArguments())
           {
             jobProgress.append(
                     opt.getName() + " " + opt.getDefaultValue() + "\n");
@@ -414,7 +406,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI
       {
         jobProgress.append("With custom parameters : \n");
         // merge arguments with preset's own arguments.
-        for (Argument opt : arguments)
+        for (Argument opt : getJabaArguments())
         {
           jobProgress.append(
                   opt.getName() + " " + opt.getDefaultValue() + "\n");
@@ -475,7 +467,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI
    * @param seqset
    *          Alignment
    */
-  MsaWSThread(MsaWS server2, WsParamSetI preset, List<Argument> paramset,
+  MsaWSThread(MsaWS server2, WsParamSetI preset, List<ArgumentI> paramset,
           String wsUrl, WebserviceInfo wsinfo,
           jalview.gui.AlignFrame alFrame, String wsname, String title,
           AlignmentView _msa, boolean subgaps, boolean presorder,
@@ -490,7 +482,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI
     if (conmsa != null)
     {
       int nvalid = 0, njobs = conmsa.length;
-      jobs = new MsaWSJob[njobs];
+      jobs = new AWsJob[njobs];
       for (int j = 0; j < njobs; j++)
       {
         if (j != 0)
@@ -501,12 +493,12 @@ class MsaWSThread extends AWS2Thread implements WSClientI
         {
           jobs[j] = new MsaWSJob(0, conmsa[j]);
         }
-        if (((MsaWSJob) jobs[j]).hasValidInput())
+        if (jobs[j].hasValidInput())
         {
           nvalid++;
         }
-        ((MsaWSJob) jobs[j]).preset = preset;
-        ((MsaWSJob) jobs[j]).arguments = paramset;
+        jobs[j].setPreset(preset);
+        jobs[j].setArguments(paramset);
         ((MsaWSJob) jobs[j]).alignmentProgram = wsname;
         if (njobs > 0)
         {
@@ -931,7 +923,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI
   void displayResults(boolean newFrame)
   {
     // view input or result data for each block
-    List<AlignmentOrder> alorders = new ArrayList<AlignmentOrder>();
+    List<AlignmentOrder> alorders = new ArrayList<>();
     SequenceI[][] results = new SequenceI[jobs.length][];
     AlignmentOrder[] orders = new AlignmentOrder[jobs.length];
     String lastProgram = null;
@@ -981,7 +973,6 @@ class MsaWSThread extends AWS2Thread implements WSClientI
     if (newFrame)
     {
       displayInNewFrame(al, alorders, hidden);
-
     }
     else
     {
@@ -1077,7 +1068,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI
     else
     {
       // construct a non-redundant ordering set
-      List<String> names = new ArrayList<String>();
+      List<String> names = new ArrayList<>();
       for (int i = 0, l = alorders.size(); i < l; i++)
       {
         String orderName = " Region " + i;