System.err.println(errorMessage);
return null;
}
+
+ /*
+ * try to parse m..n (or simply m)
+ */
String[] range = location.split("\\.\\.");
- if (range.length == 2)
+ if (range.length == 1 || range.length == 2)
{
try
{
int start = Integer.valueOf(range[0]);
- int end = Integer.valueOf(range[1]);
+ int end = range.length == 1 ? start : Integer.valueOf(range[1]);
return Collections.singletonList(new int[] { start, end });
} catch (NumberFormatException e)
{
/*
* take what is inside complement()
*/
+ if (!location.endsWith(")"))
+ {
+ return null;
+ }
String toComplement = location.substring("complement(".length(),
location.length() - 1);
List<int[]> ranges = parseLocation(toComplement);
/*
* take what is inside join()
*/
+ if (!location.endsWith(")"))
+ {
+ return null;
+ }
String joinedLocs = location.substring("join(".length(),
location.length() - 1);
String[] locations = joinedLocs.split(",");