JAL-3152 holding patch for colour Jmol by sequence
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Wed, 14 Nov 2018 15:18:23 +0000 (15:18 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Wed, 14 Nov 2018 15:18:23 +0000 (15:18 +0000)
src/jalview/ext/jmol/JmolCommands.java

index 8fb0de6..603202a 100644 (file)
@@ -68,7 +68,7 @@ public class JmolCommands
     for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
     {
       StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]);
-      StringBuffer command = new StringBuffer();
+      StringBuilder command = new StringBuilder();
       StructureMappingcommandSet smc;
       ArrayList<String> str = new ArrayList<String>();
 
@@ -125,9 +125,12 @@ public class JmolCommands
                 col = Color.GRAY;
               }
 
-              String newSelcom = (mapping[m].getChain() != " "
+              // todo JAL-3152 handle 'no chain' case without errors
+              boolean hasChain = true || mapping[m].getChain() != " ";
+                         String chainSpec = hasChain
                       ? ":" + mapping[m].getChain()
-                      : "") + "/" + (pdbfnum + 1) + ".1" + ";color["
+                      : "";
+                         String newSelcom = chainSpec + "/" + (pdbfnum + 1) + ".1" + ";color["
                       + col.getRed() + "," + col.getGreen() + ","
                       + col.getBlue() + "]";
               if (command.length() > newSelcom.length() && command
@@ -172,7 +175,7 @@ public class JmolCommands
     return cset.toArray(new StructureMappingcommandSet[cset.size()]);
   }
 
-  public static StringBuffer condenseCommand(StringBuffer command, int pos)
+  public static StringBuilder condenseCommand(StringBuilder command, int pos)
   {
 
     // work back to last 'select'
@@ -187,7 +190,7 @@ public class JmolCommands
       ;
     } while ((q = command.indexOf("select", p)) == -1 && p > 0);
 
-    StringBuffer sb = new StringBuffer(command.substring(0, q + 7));
+    StringBuilder sb = new StringBuilder(command.substring(0, q + 7));
 
     command = command.delete(0, q + 7);