MCPcopy Create free account
hub / github.com/antlr/codebuff / precomputedPositive

Method precomputedPositive

output/java_guava/1.4.19/CharMatcher.java:594–610  ·  view source on GitHub ↗

Helper method for #precomputedInternal that doesn't test if the negation is cheaper.

(int totalCharacters, BitSet table, String description)

Source from the content-addressed store, hash-verified

592 */
593
594 @GwtIncompatible // java.util.BitSet
595 private static CharMatcher precomputedPositive(int totalCharacters, BitSet table, String description) {
596 switch (totalCharacters) {
597 case 0:
598 return none();
599 case 1:
600 return is((char) table.nextSetBit(0));
601 case 2:
602 char c1 = (char) table.nextSetBit(0);
603char c2 = (char) table.nextSetBit(c1 + 1);
604 return isEither(c1, c2);
605 default:
606 return isSmall(totalCharacters, table.length())
607 ? SmallCharMatcher.from(table, description)
608 : new BitSetMatcher(table, description);
609 }
610 }
611
612 @GwtIncompatible // SmallCharMatcher
613 private static boolean isSmall(int totalCharacters, int tableLength) {

Callers 1

precomputedInternalMethod · 0.95

Calls 6

noneMethod · 0.95
isMethod · 0.95
isEitherMethod · 0.95
isSmallMethod · 0.95
fromMethod · 0.95
lengthMethod · 0.45

Tested by

no test coverage detected