\r
private static Range parseRange(String unit) {\r
Matcher matcher = Pattern.compile(\r
- "\\["+MdlUtil.DBL_G+",(\\?|"+MdlUtil.DBL_G+"|"+MdlUtil.DBL_G+","+MdlUtil.DBL_G+")\\]"\r
+ "\\[(\\?|"+MdlUtil.DBL+"),(\\?|"+MdlUtil.DBL+")(,(\\?|"+MdlUtil.DBL+"))?\\]"\r
).matcher(unit);\r
if (matcher.find()) {\r
- Double start, end, step;\r
- start = Double.parseDouble(matcher.group(1));\r
- if (matcher.group(2).equals("?")) {\r
- end = null;\r
- step = null;\r
+ Double start = null;\r
+ if (!matcher.group(1).equals("?")) {\r
+ start = Double.parseDouble(matcher.group(1));\r
}\r
- else if (matcher.group(2).contains(",")){\r
- end = Double.parseDouble(matcher.group(4));\r
- step = Double.parseDouble(matcher.group(5));\r
+ Double end = null;\r
+ if (!matcher.group(2).equals("?")) {\r
+ end = Double.parseDouble(matcher.group(2));\r
}\r
- else {\r
- end = Double.parseDouble(matcher.group(3));\r
- step = null; \r
+ Double step = null;\r
+ if (matcher.group(3) != null && !matcher.group(4).equals("?")) {\r
+ step = Double.parseDouble(matcher.group(4));\r
}\r
return new Range(start, end, step);\r
}\r
// bar[b] = 2\r
// bar[c] = 3\r
\r
+ // remove spaces, should maybe remove all whitespace\r
+ String exprstr = getExpressionString().replaceAll(" ", "");\r
+ \r
valuearray:\r
if (next == null) {\r
// number(,number)*\r
if (enumerations.size() == 1 && \r
- Pattern.matches(MdlUtil.DBL+"(,"+MdlUtil.DBL+")*", getExpressionString())) {\r
+ Pattern.matches(MdlUtil.DBL+"(,"+MdlUtil.DBL+")*", exprstr)) {\r
EnumerationExpression expr = new EnumerationExpression(enumerations);\r
\r
- String[] values = getExpressionString().split(",");\r
+ String[] values = exprstr.split(",");\r
if (enumerations.get(0).getValues().size() != values.length) {\r
// could not find a value for each enumeration index, \r
// attempt to parse the equation normally\r
}\r
// (number(,number)*;)*\r
else if (enumerations.size() == 2 && \r
- Pattern.matches("("+MdlUtil.DBL+"(,"+MdlUtil.DBL+")*;)+", getExpressionString())) {\r
+ Pattern.matches("("+MdlUtil.DBL+"(,"+MdlUtil.DBL+")*;)+", exprstr)) {\r
EnumerationExpression expr = new EnumerationExpression(enumerations);\r
\r
- String[] rows = getExpressionString().split(";");\r
+ String[] rows = exprstr.split(";");\r
if (enumerations.get(0).getValues().size() != rows.length) {\r
// could not find a value for each enumeration index \r
// in the first enumeration, attempt to parse the equation \r