本文整理汇总了Java中com.ibm.icu.text.Collator.clone方法的典型用法代码示例。如果您正苦于以下问题:Java Collator.clone方法的具体用法?Java Collator.clone怎么用?Java Collator.clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.ibm.icu.text.Collator
的用法示例。
在下文中一共展示了Collator.clone方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ICUCollationKeyFilter
import com.ibm.icu.text.Collator; //导入方法依赖的package包/类
/**
*
* @param input Source token stream
* @param collator CollationKey generator
*/
public ICUCollationKeyFilter(TokenStream input, Collator collator) {
super(input);
// clone the collator: see http://userguide.icu-project.org/collation/architecture
try {
this.collator = (Collator) collator.clone();
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
}
示例2: setCollator
import com.ibm.icu.text.Collator; //导入方法依赖的package包/类
/**
* Explicitly set the collator for this object.
* @param collator The collator object to be passed.
* @return this, for chaining
* @draft ICU 3.6
* @provisional This API might change or be removed in a future release.
*/
public GlobalizationPreferences setCollator(Collator collator) {
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify immutable object");
}
try {
this.collator = (Collator) collator.clone(); // clone for safety
} catch (CloneNotSupportedException e) {
throw new ICUCloneNotSupportedException("Error in cloning collator", e);
}
return this;
}
示例3: ICUCollatedTermAttributeImpl
import com.ibm.icu.text.Collator; //导入方法依赖的package包/类
/**
* Create a new ICUCollatedTermAttributeImpl
* @param collator Collation key generator
*/
public ICUCollatedTermAttributeImpl(Collator collator) {
// clone the collator: see http://userguide.icu-project.org/collation/architecture
try {
this.collator = (Collator) collator.clone();
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
}
示例4: ICUCollationDocValuesField
import com.ibm.icu.text.Collator; //导入方法依赖的package包/类
/**
* Create a new ICUCollationDocValuesField.
* <p>
* NOTE: you should not create a new one for each document, instead
* just make one and reuse it during your indexing process, setting
* the value via {@link #setStringValue(String)}.
* @param name field name
* @param collator Collator for generating collation keys.
*/
// TODO: can we make this trap-free? maybe just synchronize on the collator
// instead?
public ICUCollationDocValuesField(String name, Collator collator) {
super(name, SortedDocValuesField.TYPE);
this.name = name;
try {
this.collator = (Collator) collator.clone();
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
fieldsData = bytes; // so wrong setters cannot be called
}
示例5: ICUCollationKeyFilter
import com.ibm.icu.text.Collator; //导入方法依赖的package包/类
/**
*
* @param input Source token stream
* @param collator CollationKey generator
*/
public ICUCollationKeyFilter(TokenStream input, Collator collator) {
super(input);
// clone the collator: see http://userguide.icu-project.org/collation/architecture
try {
this.collator = (Collator) collator.clone();
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
}
示例6: IcuCollatedTermAttributeImpl
import com.ibm.icu.text.Collator; //导入方法依赖的package包/类
/**
* Create a new ICU c ollated term attribute implementation.
* @param collator Collation key generator
*/
IcuCollatedTermAttributeImpl(Collator collator) {
// clone the collator: see http://userguide.icu-project.org/collation/architecture
try {
this.collator = (Collator) collator.clone();
} catch (CloneNotSupportedException e) {
throw new UnsupportedOperationException(e);
}
}
示例7: makeCheck
import com.ibm.icu.text.Collator; //导入方法依赖的package包/类
@Override
protected void makeCheck(Placeholder target, ImmutableList<String> tokenizedInput, ULocale locale,
String message) {
if (tokenizedInput.size() < 2) {
// Test passed. Nothing to sort.
return;
}
int strength = Collator.SECONDARY;
if (!target.isLenient()) {
if (!target.isStrict()) {
strength = Collator.TERTIARY;
} else {
strength = Collator.IDENTICAL;
}
}
// Init collators.
Collator collator = Collator.getInstance(locale);
ImmutableList.Builder<Collator> collators = ImmutableList.builder();
collators.add(collator);
try {
Collator collator2 = (RuleBasedCollator) collator.clone();
collator2.setStrength(strength);
collators.add(collator2);
RuleBasedCollator collator3 = (RuleBasedCollator) collator.clone();
collator3.setStrength(strength);
collator3.setAlternateHandlingShifted(true);
collators.add(collator3);
RuleBasedCollator collator4 = (RuleBasedCollator) collator.clone();
collator4.setStrength(strength);
collator4.setNumericCollation(true);
collators.add(collator4);
RuleBasedCollator collator5 = (RuleBasedCollator) collator.clone();
collator5.setStrength(strength);
collator5.setAlternateHandlingShifted(true);
collator5.setNumericCollation(true);
collators.add(collator5);
} catch (CloneNotSupportedException e) {
// Do nothing.
}
makeCheck(collators.build(), tokenizedInput, locale, message);
}