本文整理汇总了Java中com.ibm.icu.text.Collator.TERTIARY属性的典型用法代码示例。如果您正苦于以下问题:Java Collator.TERTIARY属性的具体用法?Java Collator.TERTIARY怎么用?Java Collator.TERTIARY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.ibm.icu.text.Collator
的用法示例。
在下文中一共展示了Collator.TERTIARY属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findOrInsertNodeForRootCE
private int findOrInsertNodeForRootCE(long ce, int strength) {
assert((int)(ce >>> 56) != Collation.UNASSIGNED_IMPLICIT_BYTE);
// Find or insert the node for each of the root CE's weights,
// down to the requested level/strength.
// Root CEs must have common=zero quaternary weights (for which we never insert any nodes).
assert((ce & 0xc0) == 0);
int index = findOrInsertNodeForPrimary(ce >>> 32);
if(strength >= Collator.SECONDARY) {
int lower32 = (int)ce;
index = findOrInsertWeakNode(index, lower32 >>> 16, Collator.SECONDARY);
if(strength >= Collator.TERTIARY) {
index = findOrInsertWeakNode(index, lower32 & Collation.ONLY_TERTIARY_MASK,
Collator.TERTIARY);
}
}
return index;
}
示例2: insertTailoredNodeAfter
/**
* Makes and inserts a new tailored node into the list, after the one at index.
* Skips over nodes of weaker strength to maintain collation order
* ("postpone insertion").
* @return the new node's index
*/
private int insertTailoredNodeAfter(int index, int strength) {
assert(0 <= index && index < nodes.size());
if(strength >= Collator.SECONDARY) {
index = findCommonNode(index, Collator.SECONDARY);
if(strength >= Collator.TERTIARY) {
index = findCommonNode(index, Collator.TERTIARY);
}
}
// Postpone insertion:
// Insert the new node before the next one with a strength at least as strong.
long node = nodes.elementAti(index);
int nextIndex;
while((nextIndex = nextIndexFromNode(node)) != 0) {
node = nodes.elementAti(nextIndex);
if(strengthFromNode(node) <= strength) { break; }
// Skip the next node which has a weaker (larger) strength than the new one.
index = nextIndex;
}
node = IS_TAILORED | nodeFromStrength(strength);
return insertNodeBetween(index, nextIndex, node);
}
示例3: setStrength
public void setStrength(int value) {
int noStrength = options & ~STRENGTH_MASK;
switch(value) {
case Collator.PRIMARY:
case Collator.SECONDARY:
case Collator.TERTIARY:
case Collator.QUATERNARY:
case Collator.IDENTICAL:
options = noStrength | (value << STRENGTH_SHIFT);
break;
default:
throw new IllegalArgumentException("illegal strength value " + value);
}
}
示例4: ceStrength
private static int ceStrength(long ce) {
return
isTempCE(ce) ? strengthFromTempCE(ce) :
(ce & 0xff00000000000000L) != 0 ? Collator.PRIMARY :
((int)ce & 0xff000000) != 0 ? Collator.SECONDARY :
ce != 0 ? Collator.TERTIARY :
Collator.IDENTICAL;
}
示例5: strength2Collator
static private int strength2Collator(Strength strength) {
switch (strength) {
case PRIMARY: return Collator.PRIMARY;
case SECONDARY: return Collator.SECONDARY;
case TERTIARY: return Collator.TERTIARY;
case QUATERNARY: return Collator.QUATERNARY;
case IDENTICAL: return Collator.IDENTICAL;
case UNDEFINED: return Collator.PRIMARY;
}
return Collator.PRIMARY;
}
示例6: parseRelationOperator
private int parseRelationOperator() {
ruleIndex = skipWhiteSpace(ruleIndex);
if(ruleIndex >= rules.length()) { return UCOL_DEFAULT; }
int strength;
int i = ruleIndex;
char c = rules.charAt(i++);
switch(c) {
case 0x3c: // '<'
if(i < rules.length() && rules.charAt(i) == 0x3c) { // <<
++i;
if(i < rules.length() && rules.charAt(i) == 0x3c) { // <<<
++i;
if(i < rules.length() && rules.charAt(i) == 0x3c) { // <<<<
++i;
strength = Collator.QUATERNARY;
} else {
strength = Collator.TERTIARY;
}
} else {
strength = Collator.SECONDARY;
}
} else {
strength = Collator.PRIMARY;
}
if(i < rules.length() && rules.charAt(i) == 0x2a) { // '*'
++i;
strength |= STARRED_FLAG;
}
break;
case 0x3b: // ';' same as <<
strength = Collator.SECONDARY;
break;
case 0x2c: // ',' same as <<<
strength = Collator.TERTIARY;
break;
case 0x3d: // '='
strength = Collator.IDENTICAL;
if(i < rules.length() && rules.charAt(i) == 0x2a) { // '*'
++i;
strength |= STARRED_FLAG;
}
break;
default:
return UCOL_DEFAULT;
}
return ((i - ruleIndex) << OFFSET_SHIFT) | strength;
}
示例7: getWeight16Before
/**
* Returns the secondary or tertiary weight preceding the current node's weight.
* node=nodes[index].
*/
private int getWeight16Before(int index, long node, int level) {
assert(strengthFromNode(node) < level || !isTailoredNode(node));
// Collect the root CE weights if this node is for a root CE.
// If it is not, then return the low non-primary boundary for a tailored CE.
int t;
if(strengthFromNode(node) == Collator.TERTIARY) {
t = weight16FromNode(node);
} else {
t = Collation.COMMON_WEIGHT16; // Stronger node with implied common weight.
}
while(strengthFromNode(node) > Collator.SECONDARY) {
index = previousIndexFromNode(node);
node = nodes.elementAti(index);
}
if(isTailoredNode(node)) {
return Collation.BEFORE_WEIGHT16;
}
int s;
if(strengthFromNode(node) == Collator.SECONDARY) {
s = weight16FromNode(node);
} else {
s = Collation.COMMON_WEIGHT16; // Stronger node with implied common weight.
}
while(strengthFromNode(node) > Collator.PRIMARY) {
index = previousIndexFromNode(node);
node = nodes.elementAti(index);
}
if(isTailoredNode(node)) {
return Collation.BEFORE_WEIGHT16;
}
// [p, s, t] is a root CE. Return the preceding weight for the requested level.
long p = weight32FromNode(node);
int weight16;
if(level == Collator.SECONDARY) {
weight16 = rootElements.getSecondaryBefore(p, s);
} else {
weight16 = rootElements.getTertiaryBefore(p, s, t);
assert((weight16 & ~Collation.ONLY_TERTIARY_MASK) == 0);
}
return weight16;
}
示例8: makeCheck
@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);
}