Class Norm2AllModes.ComposeNormalizer2

    • Field Detail

      • onlyContiguous

        private final boolean onlyContiguous
    • Constructor Detail

      • ComposeNormalizer2

        public ComposeNormalizer2​(Normalizer2Impl ni,
                                  boolean fcc)
    • Method Detail

      • isNormalized

        public boolean isNormalized​(java.lang.CharSequence s)
        Description copied from class: Normalizer2
        Tests if the string is normalized. Internally, in cases where the quickCheck() method would return "maybe" (which is only possible for the two COMPOSE modes) this method resolves to "yes" or "no" to provide a definitive result, at the cost of doing more work in those cases.
        Overrides:
        isNormalized in class Norm2AllModes.Normalizer2WithImpl
        Parameters:
        s - input string
        Returns:
        true if s is normalized
      • quickCheck

        public Normalizer.QuickCheckResult quickCheck​(java.lang.CharSequence s)
        Description copied from class: Normalizer2
        Tests if the string is normalized. For the two COMPOSE modes, the result could be "maybe" in cases that would take a little more work to resolve definitively. Use spanQuickCheckYes() and normalizeSecondAndAppend() for a faster combination of quick check + normalization, to avoid re-checking the "yes" prefix.
        Overrides:
        quickCheck in class Norm2AllModes.Normalizer2WithImpl
        Parameters:
        s - input string
        Returns:
        the quick check result
      • spanQuickCheckYes

        public int spanQuickCheckYes​(java.lang.CharSequence s)
        Description copied from class: Normalizer2
        Returns the end of the normalized substring of the input string. In other words, with end=spanQuickCheckYes(s); the substring s.subSequence(0, end) will pass the quick check with a "yes" result.

        The returned end index is usually one or more characters before the "no" or "maybe" character: The end index is at a normalization boundary. (See the class documentation for more about normalization boundaries.)

        When the goal is a normalized string and most input strings are expected to be normalized already, then call this method, and if it returns a prefix shorter than the input string, copy that prefix and use normalizeSecondAndAppend() for the remainder.

        Specified by:
        spanQuickCheckYes in class Normalizer2
        Parameters:
        s - input string
        Returns:
        "yes" span end index
      • hasBoundaryBefore

        public boolean hasBoundaryBefore​(int c)
        Description copied from class: Normalizer2
        Tests if the character always has a normalization boundary before it, regardless of context. If true, then the character does not normalization-interact with preceding characters. In other words, a string containing this character can be normalized by processing portions before this character and starting from this character independently. This is used for iterative normalization. See the class documentation for details.
        Specified by:
        hasBoundaryBefore in class Normalizer2
        Parameters:
        c - character to test
        Returns:
        true if c has a normalization boundary before it
      • hasBoundaryAfter

        public boolean hasBoundaryAfter​(int c)
        Description copied from class: Normalizer2
        Tests if the character always has a normalization boundary after it, regardless of context. If true, then the character does not normalization-interact with following characters. In other words, a string containing this character can be normalized by processing portions up to this character and after this character independently. This is used for iterative normalization. See the class documentation for details.

        Note that this operation may be significantly slower than hasBoundaryBefore().

        Specified by:
        hasBoundaryAfter in class Normalizer2
        Parameters:
        c - character to test
        Returns:
        true if c has a normalization boundary after it
      • isInert

        public boolean isInert​(int c)
        Description copied from class: Normalizer2
        Tests if the character is normalization-inert. If true, then the character does not change, nor normalization-interact with preceding or following characters. In other words, a string containing this character can be normalized by processing portions before this character and after this character independently. This is used for iterative normalization. See the class documentation for details.

        Note that this operation may be significantly slower than hasBoundaryBefore().

        Specified by:
        isInert in class Normalizer2
        Parameters:
        c - character to test
        Returns:
        true if c is normalization-inert