Class CharMatcher.Negated

java.lang.Object
com.google.common.base.CharMatcher
com.google.common.base.CharMatcher.Negated
All Implemented Interfaces:
Predicate<Character>, Predicate<Character>
Direct Known Subclasses:
CharMatcher.NegatedFastMatcher
Enclosing class:
CharMatcher

private static class CharMatcher.Negated extends CharMatcher
Implementation of negate().
  • Field Details

  • Constructor Details

  • Method Details

    • 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 class CharMatcher
    • matchesAllOf

      public boolean matchesAllOf(CharSequence sequence)
      Description copied from class: CharMatcher
      Returns true 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 returns false or the end is reached.

      Overrides:
      matchesAllOf in class CharMatcher
      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(CharSequence sequence)
      Description copied from class: CharMatcher
      Returns true 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 returns true or the end is reached.

      Overrides:
      matchesNoneOf in class CharMatcher
      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(CharSequence sequence)
      Description copied from class: CharMatcher
      Returns the number of matching chars found in a character sequence.

      Counts 2 per supplementary character, such as for CharMatcher.whitespace()().CharMatcher.negate()().

      Overrides:
      countIn in class CharMatcher
    • setBits

      void setBits(BitSet table)
      Description copied from class: CharMatcher
      Sets bits in table matched by this matcher.
      Overrides:
      setBits in class CharMatcher
    • 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 interface Predicate<Character>
      Overrides:
      negate in class CharMatcher
    • toString

      public String toString()
      Description copied from class: CharMatcher
      Returns a string representation of this CharMatcher, such as CharMatcher.or(WHITESPACE, JAVA_DIGIT).
      Overrides:
      toString in class CharMatcher