Package com.ibm.icu.impl
Class Norm2AllModes.NoopNormalizer2
- java.lang.Object
-
- com.ibm.icu.text.Normalizer2
-
- com.ibm.icu.impl.Norm2AllModes.NoopNormalizer2
-
- Enclosing class:
- Norm2AllModes
public static final class Norm2AllModes.NoopNormalizer2 extends Normalizer2
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.ibm.icu.text.Normalizer2
Normalizer2.Mode
-
-
Constructor Summary
Constructors Constructor Description NoopNormalizer2()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringBuilder
append(java.lang.StringBuilder first, java.lang.CharSequence second)
Appends the second string to the first string (merging them at the boundary) and returns the first string.java.lang.String
getDecomposition(int c)
Gets the decomposition mapping of c.boolean
hasBoundaryAfter(int c)
Tests if the character always has a normalization boundary after it, regardless of context.boolean
hasBoundaryBefore(int c)
Tests if the character always has a normalization boundary before it, regardless of context.boolean
isInert(int c)
Tests if the character is normalization-inert.boolean
isNormalized(java.lang.CharSequence s)
Tests if the string is normalized.java.lang.Appendable
normalize(java.lang.CharSequence src, java.lang.Appendable dest)
Writes the normalized form of the source string to the destination Appendable and returns the destination Appendable.java.lang.StringBuilder
normalize(java.lang.CharSequence src, java.lang.StringBuilder dest)
Writes the normalized form of the source string to the destination string (replacing its contents) and returns the destination string.java.lang.StringBuilder
normalizeSecondAndAppend(java.lang.StringBuilder first, java.lang.CharSequence second)
Appends the normalized form of the second string to the first string (merging them at the boundary) and returns the first string.Normalizer.QuickCheckResult
quickCheck(java.lang.CharSequence s)
Tests if the string is normalized.int
spanQuickCheckYes(java.lang.CharSequence s)
Returns the end of the normalized substring of the input string.-
Methods inherited from class com.ibm.icu.text.Normalizer2
composePair, getCombiningClass, getInstance, getNFCInstance, getNFDInstance, getNFKCCasefoldInstance, getNFKCInstance, getNFKCSimpleCasefoldInstance, getNFKDInstance, getRawDecomposition, normalize
-
-
-
-
Method Detail
-
normalize
public java.lang.StringBuilder normalize(java.lang.CharSequence src, java.lang.StringBuilder dest)
Description copied from class:Normalizer2
Writes the normalized form of the source string to the destination string (replacing its contents) and returns the destination string. The source and destination strings must be different objects.- Specified by:
normalize
in classNormalizer2
- Parameters:
src
- source stringdest
- destination string; its contents is replaced with normalized src- Returns:
- dest
-
normalize
public java.lang.Appendable normalize(java.lang.CharSequence src, java.lang.Appendable dest)
Description copied from class:Normalizer2
Writes the normalized form of the source string to the destination Appendable and returns the destination Appendable. The source and destination strings must be different objects.Any
IOException
is wrapped into aICUUncheckedIOException
.- Specified by:
normalize
in classNormalizer2
- Parameters:
src
- source stringdest
- destination Appendable; gets normalized src appended- Returns:
- dest
-
normalizeSecondAndAppend
public java.lang.StringBuilder normalizeSecondAndAppend(java.lang.StringBuilder first, java.lang.CharSequence second)
Description copied from class:Normalizer2
Appends the normalized form of the second string to the first string (merging them at the boundary) and returns the first string. The result is normalized if the first string was normalized. The first and second strings must be different objects.- Specified by:
normalizeSecondAndAppend
in classNormalizer2
- Parameters:
first
- string, should be normalizedsecond
- string, will be normalized- Returns:
- first
-
append
public java.lang.StringBuilder append(java.lang.StringBuilder first, java.lang.CharSequence second)
Description copied from class:Normalizer2
Appends the second string to the first string (merging them at the boundary) and returns the first string. The result is normalized if both the strings were normalized. The first and second strings must be different objects.- Specified by:
append
in classNormalizer2
- Parameters:
first
- string, should be normalizedsecond
- string, should be normalized- Returns:
- first
-
getDecomposition
public java.lang.String getDecomposition(int c)
Description copied from class:Normalizer2
Gets the decomposition mapping of c. Roughly equivalent to normalizing the String form of c on a DECOMPOSE Normalizer2 instance, but much faster, and except that this function returns null if c does not have a decomposition mapping in this instance's data. This function is independent of the mode of the Normalizer2.- Specified by:
getDecomposition
in classNormalizer2
- Parameters:
c
- code point- Returns:
- c's decomposition mapping, if any; otherwise null
-
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.- Specified by:
isNormalized
in classNormalizer2
- 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.- Specified by:
quickCheck
in classNormalizer2
- 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, withend=spanQuickCheckYes(s);
the substrings.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 classNormalizer2
- 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 classNormalizer2
- 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 classNormalizer2
- 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 classNormalizer2
- Parameters:
c
- character to test- Returns:
- true if c is normalization-inert
-
-