FilePosition (File toTest, Matcher matcher) { if (matcher.groupCount() == 2) { return new FilePosition(toTest, atoi(matcher.group(1)) - 1, atoi(matcher.group(2)) - 1); } else if (matcher.groupCount() == 1) { return new FilePosition(toTest, atoi(matcher.group(1)) - 1, 0); } else { return new FilePosition(toTest, 0, 0); } }