static int complexity(CharRanges ranges) { int complexity = 0; for (int i = 0, n = ranges.getNumRanges(); i < n; ++i) { int start = ranges.start(i); int end = ranges.end(i) - 1; if (start < 0x20 || start >= 0x7f) { complexity += start >= 0x100 ? 6 : 4; } else { ++complexity; } switch (end - start) { case 0: continue; case 1: break; default: complexity += 1; } if (end < 0x20 || end >= 0x7f) { complexity += end >= 0x100 ? 6 : 4; } else { ++complexity; } } return complexity; }
static int complexity(CharRanges ranges) { int complexity = 0; for (int i = 0, n = ranges.getNumRanges(); i < n; ++i) { int start = ranges.start(i); int end = ranges.end(i) - 1; if (start < 0x20 || start >= 0x7f) { complexity += start >= 0x100 ? 6 : 4; } else { ++complexity; } switch (end - start) { case 0: continue; case 1: break; default: complexity += 1; } if (end < 0x20 || end >= 0x7f) { complexity += end >= 0x100 ? 6 : 4; } else { ++complexity; } } return complexity; }
boolean rangesStartCharset = !inverted && namedGroups.isEmpty(); boolean emitDashAtEnd = false; for (int i = 0, n = ranges.getNumRanges(); i < n; ++i) { char start = (char) ranges.start(i); char end = (char) (ranges.end(i) - 1);
boolean rangesStartCharset = !inverted && namedGroups.isEmpty(); boolean emitDashAtEnd = false; for (int i = 0, n = ranges.getNumRanges(); i < n; ++i) { char start = (char) ranges.start(i); char end = (char) (ranges.end(i) - 1);
if (best.getNumRanges() == 1 && best.end(0) - best.start(0) == 1) { return new Text(Character.toString((char) best.start(0)));
if (best.getNumRanges() == 1 && best.end(0) - best.start(0) == 1) { return new Text(Character.toString((char) best.start(0)));