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

Method precomputedPositive

output/java_guava/1.4.13/CharMatcher.java:592–608  ·  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

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