Package com.google.common.base
Class CharMatcher.Negated
- java.lang.Object
-
- com.google.common.base.CharMatcher
-
- com.google.common.base.CharMatcher.Negated
-
- All Implemented Interfaces:
Predicate<java.lang.Character>
,java.util.function.Predicate<java.lang.Character>
- Direct Known Subclasses:
CharMatcher.NegatedFastMatcher
- Enclosing class:
- CharMatcher
private static class CharMatcher.Negated extends CharMatcher
Implementation ofnegate()
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.common.base.CharMatcher
CharMatcher.FastMatcher, CharMatcher.NamedFastMatcher, CharMatcher.NegatedFastMatcher, CharMatcher.Whitespace
-
-
Field Summary
Fields Modifier and Type Field Description (package private) CharMatcher
original
-
Constructor Summary
Constructors Constructor Description Negated(CharMatcher original)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
countIn(java.lang.CharSequence sequence)
Returns the number of matchingchar
s found in a character sequence.boolean
matches(char c)
Determines a true or false value for the given character.boolean
matchesAllOf(java.lang.CharSequence sequence)
Returnstrue
if a character sequence contains only matching BMP characters.boolean
matchesNoneOf(java.lang.CharSequence sequence)
Returnstrue
if a character sequence contains no matching BMP characters.CharMatcher
negate()
Returns a matcher that matches any character not matched by this matcher.(package private) void
setBits(java.util.BitSet table)
Sets bits intable
matched by this matcher.java.lang.String
toString()
Returns a string representation of thisCharMatcher
, such asCharMatcher.or(WHITESPACE, JAVA_DIGIT)
.-
Methods inherited from class com.google.common.base.CharMatcher
and, any, anyOf, apply, ascii, breakingWhitespace, collapseFrom, digit, forPredicate, indexIn, indexIn, inRange, invisible, is, isNot, javaDigit, javaIsoControl, javaLetter, javaLetterOrDigit, javaLowerCase, javaUpperCase, lastIndexIn, matchesAnyOf, none, noneOf, or, precomputed, precomputedInternal, removeFrom, replaceFrom, replaceFrom, retainFrom, singleWidth, trimAndCollapseFrom, trimFrom, trimLeadingFrom, trimTrailingFrom, whitespace
-
-
-
-
Field Detail
-
original
final CharMatcher original
-
-
Constructor Detail
-
Negated
Negated(CharMatcher original)
-
-
Method Detail
-
matches
public boolean matches(char c)
Description copied from class:CharMatcher
Determines a true or false value for the given character.- Specified by:
matches
in classCharMatcher
-
matchesAllOf
public boolean matchesAllOf(java.lang.CharSequence sequence)
Description copied from class:CharMatcher
Returnstrue
if a character sequence contains only matching BMP characters.The default implementation iterates over the sequence, invoking
CharMatcher.matches(char)
for each character, until this returnsfalse
or the end is reached.- Overrides:
matchesAllOf
in classCharMatcher
- Parameters:
sequence
- the character sequence to examine, possibly empty- Returns:
true
if this matcher matches every character in the sequence, including when the sequence is empty
-
matchesNoneOf
public boolean matchesNoneOf(java.lang.CharSequence sequence)
Description copied from class:CharMatcher
Returnstrue
if a character sequence contains no matching BMP characters. Equivalent to!matchesAnyOf(sequence)
.The default implementation iterates over the sequence, invoking
CharMatcher.matches(char)
for each character, until this returnstrue
or the end is reached.- Overrides:
matchesNoneOf
in classCharMatcher
- Parameters:
sequence
- the character sequence to examine, possibly empty- Returns:
true
if this matcher matches no characters in the sequence, including when the sequence is empty
-
countIn
public int countIn(java.lang.CharSequence sequence)
Description copied from class:CharMatcher
Returns the number of matchingchar
s found in a character sequence.Counts 2 per supplementary character, such as for
CharMatcher.whitespace()
().CharMatcher.negate()
().- Overrides:
countIn
in classCharMatcher
-
setBits
void setBits(java.util.BitSet table)
Description copied from class:CharMatcher
Sets bits intable
matched by this matcher.- Overrides:
setBits
in classCharMatcher
-
negate
public CharMatcher negate()
Description copied from class:CharMatcher
Returns a matcher that matches any character not matched by this matcher.- Specified by:
negate
in interfacejava.util.function.Predicate<java.lang.Character>
- Overrides:
negate
in classCharMatcher
-
toString
public java.lang.String toString()
Description copied from class:CharMatcher
Returns a string representation of thisCharMatcher
, such asCharMatcher.or(WHITESPACE, JAVA_DIGIT)
.- Overrides:
toString
in classCharMatcher
-
-