Merge branch 'patch/JAL-4024_jumpScrollHang' into develop
[jalview.git] / src / jalview / io / NewickFile.java
index 517701b..4a30d73 100755 (executable)
@@ -26,6 +26,8 @@
 // TODO: Extended SequenceNodeI to hold parsed NHX strings
 package jalview.io;
 
+import java.util.Locale;
+
 import jalview.datamodel.SequenceNode;
 import jalview.util.MessageManager;
 
@@ -294,8 +296,7 @@ public class NewickFile extends FileParse
     boolean ascending = false; // flag indicating that we are leaving the
     // current node
 
-    Regex majorsyms = new Regex(
-            "[(\\['),;]");
+    Regex majorsyms = new Regex("[(\\['),;]");
 
     int nextcp = 0;
     int ncp = cp;
@@ -316,8 +317,6 @@ public class NewickFile extends FileParse
 
           continue;
         }
-
-        ;
         d++;
 
         if (c.right() == null)
@@ -356,8 +355,7 @@ public class NewickFile extends FileParse
       // Deal with quoted fields
       case '\'':
 
-        Regex qnodename = new Regex(
-                "'([^']|'')+'");
+        Regex qnodename = new Regex("'([^']|'')+'");
 
         if (qnodename.searchFrom(nf, fcp))
         {
@@ -365,8 +363,7 @@ public class NewickFile extends FileParse
           nodename = new String(
                   qnodename.stringMatched().substring(1, nl - 1));
           // unpack any escaped colons
-          Regex xpandquotes = Regex
-                  .perlCode("s/''/'/");
+          Regex xpandquotes = Regex.perlCode("s/''/'/");
           String widernodename = xpandquotes.replaceAll(nodename);
           nodename = widernodename;
           // jump to after end of quoted nodename
@@ -400,8 +397,7 @@ public class NewickFile extends FileParse
            * '"+nf.substring(cp,fcp)+"'"); }
            */
           // verify termination.
-          Regex comment = new Regex(
-                  "]");
+          Regex comment = new Regex("]");
           if (comment.searchFrom(nf, fcp))
           {
             // Skip the comment field
@@ -417,8 +413,6 @@ public class NewickFile extends FileParse
             Error = ErrorStringrange(Error, "Unterminated comment", 3, fcp,
                     nf);
           }
-
-          ;
         }
         // Parse simpler field strings
         String fstring = nf.substring(ncp, fcp);
@@ -434,12 +428,9 @@ public class NewickFile extends FileParse
                   + fstring.substring(cend + 1);
 
         }
-        Regex uqnodename = new Regex(
-                "\\b([^' :;\\](),]+)");
-        Regex nbootstrap = new Regex(
-                "\\s*([0-9+]+)\\s*:");
-        Regex ndist = new Regex(
-                ":([-0-9Ee.+]+)");
+        Regex uqnodename = new Regex("\\b([^' :;\\](),]+)");
+        Regex nbootstrap = new Regex("\\s*([0-9+]+)\\s*:");
+        Regex ndist = new Regex(":([-0-9Ee.+]+)");
 
         if (!parsednodename && uqnodename.search(fstring)
                 && ((uqnodename.matchedFrom(1) == 0) || (fstring
@@ -479,7 +470,7 @@ public class NewickFile extends FileParse
           {
             try
             {
-              bootstrap = (new Integer(nbootstrap.stringMatched(1)))
+              bootstrap = (Integer.valueOf(nbootstrap.stringMatched(1)))
                       .intValue();
               HasBootstrap = true;
             } catch (Exception e)
@@ -496,7 +487,7 @@ public class NewickFile extends FileParse
         {
           try
           {
-            distance = (new Float(ndist.stringMatched(1))).floatValue();
+            distance = (Float.valueOf(ndist.stringMatched(1))).floatValue();
             HasDistances = true;
             nodehasdistance = true;
           } catch (Exception e)
@@ -660,10 +651,10 @@ public class NewickFile extends FileParse
           try
           {
             // parse out code/value pairs
-            if (code.toLowerCase().equals("b"))
+            if (code.toLowerCase(Locale.ROOT).equals("b"))
             {
               int v = -1;
-              Float iv = new Float(value);
+              Float iv = Float.valueOf(value);
               v = iv.intValue(); // jalview only does integer bootstraps
               // currently
               c.setBootstrap(v);
@@ -942,7 +933,11 @@ public class NewickFile extends FileParse
     }
   }
 
-  // Test
+  /**
+   * 
+   * @param args
+   * @j2sIgnore
+   */
   public static void main(String[] args)
   {
     try