BitClass add(int c, int flags) { assert c >= 0 && c <= 255; if ((flags & CASE_INSENSITIVE) != 0) { if (ASCII.isAscii(c)) { bits[ASCII.toUpper(c)] = true; bits[ASCII.toLower(c)] = true; } else if ((flags & UNICODE_CASE) != 0) { bits[Character.toLowerCase(c)] = true; bits[Character.toUpperCase(c)] = true; } } bits[c] = true; return this; } boolean isSatisfiedBy(int ch) {
BitClass add(int c, int flags) { assert c >= 0 && c <= 255; if ((flags & CASE_INSENSITIVE) != 0) { if (ASCII.isAscii(c)) { bits[ASCII.toUpper(c)] = true; bits[ASCII.toLower(c)] = true; } else if ((flags & UNICODE_CASE) != 0) { bits[Character.toLowerCase(c)] = true; bits[Character.toUpperCase(c)] = true; } } bits[c] = true; return this; } boolean isSatisfiedBy(int ch) {
boolean isSatisfiedBy(int ch) { return inRange(lower, ch, upper) || ASCII.isAscii(ch) && (inRange(lower, ASCII.toUpper(ch), upper) || inRange(lower, ASCII.toLower(ch), upper)); }}; }
boolean isSatisfiedBy(int ch) { return inRange(lower, ch, upper) || ASCII.isAscii(ch) && (inRange(lower, ASCII.toUpper(ch), upper) || inRange(lower, ASCII.toLower(ch), upper)); }}; }
/** * Returns a suitably optimized, single character matcher. */ private CharProperty newSingle(final int ch) { if (has(CASE_INSENSITIVE)) { int lower, upper; if (has(UNICODE_CASE)) { upper = Character.toUpperCase(ch); lower = Character.toLowerCase(upper); if (upper != lower) return new SingleU(lower); } else if (ASCII.isAscii(ch)) { lower = ASCII.toLower(ch); upper = ASCII.toUpper(ch); if (lower != upper) return new SingleI(lower, upper); } } if (isSupplementary(ch)) return new SingleS(ch); // Match a given Unicode character return new Single(ch); // Match a given BMP character }
/** * Returns a suitably optimized, single character matcher. */ private CharProperty newSingle(final int ch) { if (has(CASE_INSENSITIVE)) { int lower, upper; if (has(UNICODE_CASE)) { upper = Character.toUpperCase(ch); lower = Character.toLowerCase(upper); if (upper != lower) return new SingleU(lower); } else if (ASCII.isAscii(ch)) { lower = ASCII.toLower(ch); upper = ASCII.toUpper(ch); if (lower != upper) return new SingleI(lower, upper); } } if (isSupplementary(ch)) return new SingleS(ch); // Match a given Unicode character return new Single(ch); // Match a given BMP character }