@Override public boolean isCaseSensitive() { // We could test // !ranges.equals(CaseCanonicalize.expandToAllMatched(ranges)) // but we get better optimizations by leaving the 'i' flag on in most // cases. // Check whether skipping all the character groups that are known // case-insensitive leaves us with something that matches the above // definition. CharRanges withoutNamedGroups = decompose().ranges; return !withoutNamedGroups.equals( CaseCanonicalize.expandToAllMatched(withoutNamedGroups)); }
@Override public boolean isCaseSensitive() { // We could test // !ranges.equals(CaseCanonicalize.expandToAllMatched(ranges)) // but we get better optimizations by leaving the 'i' flag on in most // cases. // Check whether skipping all the character groups that are known // case-insensitive leaves us with something that matches the above // definition. CharRanges withoutNamedGroups = decompose().ranges; return !withoutNamedGroups.equals( CaseCanonicalize.expandToAllMatched(withoutNamedGroups)); }
if (flags.indexOf('i') >= 0) { Set<CharRanges> options = new LinkedHashSet<>(); options.add(CaseCanonicalize.expandToAllMatched(ranges)); options.add(CaseCanonicalize.reduceToMinimum(ranges));
if (flags.indexOf('i') >= 0) { Set<CharRanges> options = new LinkedHashSet<CharRanges>(); options.add(CaseCanonicalize.expandToAllMatched(ranges)); options.add(CaseCanonicalize.reduceToMinimum(ranges));