com.ibm.icu.text.Collator.setDecomposition()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(137)

本文整理了Java中com.ibm.icu.text.Collator.setDecomposition()方法的一些代码示例,展示了Collator.setDecomposition()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Collator.setDecomposition()方法的具体详情如下:
包路径:com.ibm.icu.text.Collator
类名称:Collator
方法名:setDecomposition

Collator.setDecomposition介绍

[英]Sets the decomposition mode of this Collator. Setting this decomposition attribute with CANONICAL_DECOMPOSITION allows the Collator to handle un-normalized text properly, producing the same results as if the text were normalized. If NO_DECOMPOSITION is set, it is the user's responsibility to insure that all text is already in the appropriate form before a comparison or before getting a CollationKey. Adjusting decomposition mode allows the user to select between faster and more complete collation behavior.

Since a great many of the world's languages do not require text normalization, most locales set NO_DECOMPOSITION as the default decomposition mode.

The base class method does nothing. Subclasses should override it if appropriate.

See getDecomposition for a description of decomposition mode.
[中]设置此折叠器的分解模式。将此分解属性设置为CANONICAL_decomposition可以使Collator正确处理未规范化的文本,产生与文本规范化相同的结果。如果未设置_分解,则用户有责任确保在进行比较或获取排序规则键之前,所有文本都已采用适当的形式。调整分解模式允许用户在更快和更完整的排序行为之间进行选择。
由于世界上许多语言都不需要文本规范化,因此大多数地区都将NO_分解设置为默认分解模式。
基类方法什么也不做。如果合适的话,子类应该覆盖它。
有关分解模式的描述,请参见getDecomposition。

代码示例

代码示例来源:origin: com.ibm.icu/icu4j-localespi

@Override
public void setDecomposition(int decompositionMode) {
  switch (decompositionMode) {
  case java.text.Collator.CANONICAL_DECOMPOSITION:
    fIcuCollator.setDecomposition(Collator.CANONICAL_DECOMPOSITION);
    break;
  case java.text.Collator.NO_DECOMPOSITION:
    fIcuCollator.setDecomposition(Collator.NO_DECOMPOSITION);
    break;
  case java.text.Collator.FULL_DECOMPOSITION:
    // Not supported by ICU.
    // This option is interpreted as IDENTICAL strength.
    fIcuCollator.setStrength(Collator.IDENTICAL);
    break;
  default:
    throw new IllegalArgumentException("Invalid decomposition mode.");
  }
}

代码示例来源:origin: org.elasticsearch.plugin/analysis-icu

if (decomposition != null) {
  if (decomposition.equalsIgnoreCase("no")) {
    collator.setDecomposition(Collator.NO_DECOMPOSITION);
  } else if (decomposition.equalsIgnoreCase("canonical")) {
    collator.setDecomposition(Collator.CANONICAL_DECOMPOSITION);
  } else {
    throw new IllegalArgumentException("Invalid decomposition: " + decomposition);

代码示例来源:origin: io.virtdata/virtdata-lib-realer

coll.setDecomposition(getYesOrNo("colNormalization", value) ?
    Collator.CANONICAL_DECOMPOSITION : Collator.NO_DECOMPOSITION);

代码示例来源:origin: org.elasticsearch/elasticsearch-analysis-icu

if (decomposition != null) {
  if (decomposition.equalsIgnoreCase("no")) {
    collator.setDecomposition(Collator.NO_DECOMPOSITION);
  } else if (decomposition.equalsIgnoreCase("canonical")) {
    collator.setDecomposition(Collator.CANONICAL_DECOMPOSITION);
  } else {
    throw new ElasticsearchIllegalArgumentException("Invalid decomposition: " + decomposition);

相关文章