Class Norm2AllModes.Normalizer2WithImpl
- java.lang.Object
-
- com.ibm.icu.text.Normalizer2
-
- com.ibm.icu.impl.Norm2AllModes.Normalizer2WithImpl
-
- Direct Known Subclasses:
Norm2AllModes.ComposeNormalizer2
,Norm2AllModes.DecomposeNormalizer2
,Norm2AllModes.FCDNormalizer2
- Enclosing class:
- Norm2AllModes
public abstract static class Norm2AllModes.Normalizer2WithImpl extends Normalizer2
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.ibm.icu.text.Normalizer2
Normalizer2.Mode
-
-
Field Summary
Fields Modifier and Type Field Description Normalizer2Impl
impl
-
Constructor Summary
Constructors Constructor Description Normalizer2WithImpl(Normalizer2Impl ni)
-
Method Summary
All Methods Instance Methods Abstract 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.int
composePair(int a, int b)
Performs pairwise composition of a & b and returns the composite if there is one.int
getCombiningClass(int c)
Gets the combining class of c.java.lang.String
getDecomposition(int c)
Gets the decomposition mapping of c.abstract int
getQuickCheck(int c)
java.lang.String
getRawDecomposition(int c)
Gets the raw decomposition mapping of c.boolean
isNormalized(java.lang.CharSequence s)
Tests if the string is normalized.protected abstract void
normalize(java.lang.CharSequence src, Normalizer2Impl.ReorderingBuffer buffer)
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.protected abstract void
normalizeAndAppend(java.lang.CharSequence src, boolean doNormalize, Normalizer2Impl.ReorderingBuffer buffer)
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.java.lang.StringBuilder
normalizeSecondAndAppend(java.lang.StringBuilder first, java.lang.CharSequence second, boolean doNormalize)
Normalizer.QuickCheckResult
quickCheck(java.lang.CharSequence s)
Tests if the string is normalized.-
Methods inherited from class com.ibm.icu.text.Normalizer2
getInstance, getNFCInstance, getNFDInstance, getNFKCCasefoldInstance, getNFKCInstance, getNFKCSimpleCasefoldInstance, getNFKDInstance, hasBoundaryAfter, hasBoundaryBefore, isInert, normalize, spanQuickCheckYes
-
-
-
-
Field Detail
-
impl
public final Normalizer2Impl impl
-
-
Constructor Detail
-
Normalizer2WithImpl
public Normalizer2WithImpl(Normalizer2Impl ni)
-
-
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
-
normalize
protected abstract void normalize(java.lang.CharSequence src, Normalizer2Impl.ReorderingBuffer buffer)
-
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
-
normalizeSecondAndAppend
public java.lang.StringBuilder normalizeSecondAndAppend(java.lang.StringBuilder first, java.lang.CharSequence second, boolean doNormalize)
-
normalizeAndAppend
protected abstract void normalizeAndAppend(java.lang.CharSequence src, boolean doNormalize, Normalizer2Impl.ReorderingBuffer buffer)
-
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
-
getRawDecomposition
public java.lang.String getRawDecomposition(int c)
Description copied from class:Normalizer2
Gets the raw decomposition mapping of c.This is similar to the getDecomposition() method but returns the raw decomposition mapping as specified in UnicodeData.txt or (for custom data) in the mapping files processed by the gennorm2 tool. By contrast, getDecomposition() returns the processed, recursively-decomposed version of this mapping.
When used on a standard NFKC Normalizer2 instance, getRawDecomposition() returns the Unicode Decomposition_Mapping (dm) property.
When used on a standard NFC Normalizer2 instance, it returns the Decomposition_Mapping only if the Decomposition_Type (dt) is Canonical (Can); in this case, the result contains either one or two code points (=1..4 Java chars).
This function is independent of the mode of the Normalizer2. The default implementation returns null.
- Overrides:
getRawDecomposition
in classNormalizer2
- Parameters:
c
- code point- Returns:
- c's raw decomposition mapping, if any; otherwise null
-
composePair
public int composePair(int a, int b)
Description copied from class:Normalizer2
Performs pairwise composition of a & b and returns the composite if there is one.Returns a composite code point c only if c has a two-way mapping to a+b. In standard Unicode normalization, this means that c has a canonical decomposition to a+b and c does not have the Full_Composition_Exclusion property.
This function is independent of the mode of the Normalizer2. The default implementation returns a negative value.
- Overrides:
composePair
in classNormalizer2
- Parameters:
a
- A (normalization starter) code point.b
- Another code point.- Returns:
- The non-negative composite code point if there is one; otherwise a negative value.
-
getCombiningClass
public int getCombiningClass(int c)
Description copied from class:Normalizer2
Gets the combining class of c. The default implementation returns 0 but all standard implementations return the Unicode Canonical_Combining_Class value.- Overrides:
getCombiningClass
in classNormalizer2
- Parameters:
c
- code point- Returns:
- c's combining class
-
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
-
getQuickCheck
public abstract int getQuickCheck(int c)
-
-