// TODO: Extended SequenceNodeI to hold parsed NHX strings
package jalview.io;
+import java.util.Locale;
+
import jalview.datamodel.SequenceNode;
import jalview.util.MessageManager;
String nodename = null;
String commentString2 = null; // comments after simple node props
- float DefDistance = (float) 0.001; // @param Default distance for a node -
+ double DefDistance = (float) 0.001; // @param Default distance for a node -
// very very small
int DefBootstrap = -1; // @param Default bootstrap for a node
- float distance = DefDistance;
+ double distance = DefDistance;
int bootstrap = DefBootstrap;
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;
continue;
}
-
- ;
d++;
if (c.right() == null)
// Deal with quoted fields
case '\'':
- Regex qnodename = new Regex(
- "'([^']|'')+'");
+ Regex qnodename = new Regex("'([^']|'')+'");
if (qnodename.searchFrom(nf, fcp))
{
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
* '"+nf.substring(cp,fcp)+"'"); }
*/
// verify termination.
- Regex comment = new Regex(
- "]");
+ Regex comment = new Regex("]");
if (comment.searchFrom(nf, fcp))
{
// Skip the comment field
Error = ErrorStringrange(Error, "Unterminated comment", 3, fcp,
nf);
}
-
- ;
}
// Parse simpler field strings
String fstring = nf.substring(ncp, fcp);
+ 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
{
try
{
- bootstrap = (new Integer(nbootstrap.stringMatched(1)))
+ bootstrap = (Integer.valueOf(nbootstrap.stringMatched(1)))
.intValue();
HasBootstrap = true;
} catch (Exception e)
{
try
{
- distance = (new Float(ndist.stringMatched(1))).floatValue();
+ distance = (Double.valueOf(ndist.stringMatched(1))).floatValue();
HasDistances = true;
nodehasdistance = true;
} catch (Exception e)
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);
}
}
- // Test
+ /**
+ *
+ * @param args
+ * @j2sIgnore
+ */
public static void main(String[] args)
{
try