本文整理了Java中com.ibm.icu.text.Collator.setStrength()
方法的一些代码示例,展示了Collator.setStrength()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Collator.setStrength()
方法的具体详情如下:
包路径:com.ibm.icu.text.Collator
类名称:Collator
方法名:setStrength
[英]Sets this Collator's strength attribute. The strength attribute determines the minimum level of difference considered significant during comparison.
The base class method does nothing. Subclasses should override it if appropriate.
See the Collator class description for an example of use.
[中]设置此折叠器的“强度”属性。“强度”属性确定比较期间被视为显著差异的最小水平。
基类方法什么也不做。如果合适的话,子类应该覆盖它。
有关使用示例,请参见Collator类描述。
代码示例来源:origin: io.virtdata/virtdata-lib-realer
/**
* @return this, for chaining
* @internal Used in UnicodeTools
* @deprecated This API is ICU internal only.
*/
@Deprecated
public Collator setStrength2(int newStrength)
{
setStrength(newStrength);
return this;
}
代码示例来源:origin: com.ibm.icu/icu4j-localespi
@Override
public void setStrength(int newStrength) {
switch (newStrength) {
case java.text.Collator.IDENTICAL:
fIcuCollator.setStrength(Collator.IDENTICAL);
break;
case java.text.Collator.PRIMARY:
fIcuCollator.setStrength(Collator.PRIMARY);
break;
case java.text.Collator.SECONDARY:
fIcuCollator.setStrength(Collator.SECONDARY);
break;
case java.text.Collator.TERTIARY:
fIcuCollator.setStrength(Collator.TERTIARY);
break;
default:
throw new IllegalArgumentException("Invalid strength.");
}
}
代码示例来源: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: com.yahoo.vespa/container-search
public void setLocale(String locale, Strength strength) {
this.locale = locale;
this.strength = strength;
ULocale uloc;
try {
uloc = new ULocale(locale);
} catch (Throwable e) {
throw new RuntimeException("ULocale("+locale+") failed with exception " + e.toString());
}
try {
collator = Collator.getInstance(uloc);
if (collator == null) {
throw new RuntimeException("No collator available for: " + locale);
}
} catch (Throwable e) {
throw new RuntimeException("Collator.getInstance(ULocale("+locale+")) failed with exception " + e.toString());
}
collator.setStrength(strength2Collator(strength));
// collator.setDecomposition(Collator.CANONICAL_DECOMPOSITION);
}
public String getLocale() { return locale; }
代码示例来源:origin: org.elasticsearch.plugin/analysis-icu
if (strength != null) {
if (strength.equalsIgnoreCase("primary")) {
collator.setStrength(Collator.PRIMARY);
} else if (strength.equalsIgnoreCase("secondary")) {
collator.setStrength(Collator.SECONDARY);
} else if (strength.equalsIgnoreCase("tertiary")) {
collator.setStrength(Collator.TERTIARY);
} else if (strength.equalsIgnoreCase("quaternary")) {
collator.setStrength(Collator.QUATERNARY);
} else if (strength.equalsIgnoreCase("identical")) {
collator.setStrength(Collator.IDENTICAL);
} else {
throw new IllegalArgumentException("Invalid strength: " + strength);
代码示例来源:origin: org.elasticsearch/elasticsearch-analysis-icu
if (strength != null) {
if (strength.equalsIgnoreCase("primary")) {
collator.setStrength(Collator.PRIMARY);
} else if (strength.equalsIgnoreCase("secondary")) {
collator.setStrength(Collator.SECONDARY);
} else if (strength.equalsIgnoreCase("tertiary")) {
collator.setStrength(Collator.TERTIARY);
} else if (strength.equalsIgnoreCase("quaternary")) {
collator.setStrength(Collator.QUATERNARY);
} else if (strength.equalsIgnoreCase("identical")) {
collator.setStrength(Collator.IDENTICAL);
} else {
throw new ElasticsearchIllegalArgumentException("Invalid strength: " + strength);
代码示例来源:origin: io.virtdata/virtdata-lib-realer
coll.setStrength(strength <= Collator.QUATERNARY ? strength : Collator.IDENTICAL);
内容来源于网络,如有侵权,请联系作者删除!