@Override protected void setBits(LookupTable table) { for (char base : ZEROES.toCharArray()) { for (char value = 0; value < 10; value++) { table.set((char) (base + value)); } } } @Override public boolean matches(char c) {
/** * Returns a {@code char} matcher functionally equivalent to this one, but * with its configuration cached in an eight-kilobyte bit array. In some * situations this produces a matcher which is faster to query than the * original; your mileage may vary. * * <p>The default implementation creates a new bit array and passes it to * {@link #setBits(LookupTable)}. */ public CharMatcher precomputed() { final LookupTable table = new LookupTable(); setBits(table); return new CharMatcher() { @Override public boolean matches(char c) { return table.get(c); } @Override public CharMatcher precomputed() { return this; } }; }
/** * Returns a {@code char} matcher functionally equivalent to this one, but * with its configuration cached in an eight-kilobyte bit array. In some * situations this produces a matcher which is faster to query than the * original; your mileage may vary. * * <p>The default implementation creates a new bit array and passes it to * {@link #setBits(LookupTable)}. */ public CharMatcher precomputed() { final LookupTable table = new LookupTable(); setBits(table); return new CharMatcher() { @Override public boolean matches(char c) { return table.get(c); } @Override public CharMatcher precomputed() { return this; } }; }
/** * Returns a {@code char} matcher functionally equivalent to this one, but * with its configuration cached in an eight-kilobyte bit array. In some * situations this produces a matcher which is faster to query than the * original; your mileage may vary. * * <p>The default implementation creates a new bit array and passes it to * {@link #setBits(LookupTable)}. */ public CharMatcher precomputed() { final LookupTable table = new LookupTable(); setBits(table); return new CharMatcher() { @Override public boolean matches(char c) { return table.get(c); } @Override public CharMatcher precomputed() { return this; } }; }
/** * For use by implementors; sets the bit corresponding to each character ('\0' * to '\uFFFF') that matches this matcher in the given bit array, leaving all * other bits untouched. * * <p>The default implementation loops over every possible character value, * invoking {@link #matches} for each one. */ protected void setBits(LookupTable table) { char c = Character.MIN_VALUE; while (true) { if (matches(c)) { table.set(c); } if (c++ == Character.MAX_VALUE) { break; } } }
/** * For use by implementors; sets the bit corresponding to each character ('\0' * to '\uFFFF') that matches this matcher in the given bit array, leaving all * other bits untouched. * * <p>The default implementation loops over every possible character value, * invoking {@link #matches} for each one. */ protected void setBits(LookupTable table) { char c = Character.MIN_VALUE; while (true) { if (matches(c)) { table.set(c); } if (c++ == Character.MAX_VALUE) { break; } } }
/** * For use by implementors; sets the bit corresponding to each character ('\0' * to '\uFFFF') that matches this matcher in the given bit array, leaving all * other bits untouched. * * <p>The default implementation loops over every possible character value, * invoking {@link #matches} for each one. */ protected void setBits(LookupTable table) { char c = Character.MIN_VALUE; while (true) { if (matches(c)) { table.set(c); } if (c++ == Character.MAX_VALUE) { break; } } }
@Override public boolean matches(char c) { return table.get(c); }
@Override public boolean matches(char c) { return table.get(c); }
@Override public boolean matches(char c) { return table.get(c); }
@Override protected void setBits(LookupTable table) { table.set(match); } };
@Override protected void setBits(LookupTable table) { table.set(match); } };
@Override protected void setBits(LookupTable table) { table.set(match); } };
@Override protected void setBits(LookupTable table) { for (char c : chars) { table.set(c); } } };
@Override protected void setBits(LookupTable table) { for (char c : chars) { table.set(c); } } };
@Override protected void setBits(LookupTable table) { for (char base : ZEROES.toCharArray()) { for (char value = 0; value < 10; value++) { table.set((char) (base + value)); } } } @Override public boolean matches(char c) {
@Override protected void setBits(LookupTable table) { char c = startInclusive; while (true) { table.set(c); if (c++ == endInclusive) { break; } } } };
@Override protected void setBits(LookupTable table) { for (char c : chars) { table.set(c); } } };