当前位置: 首页>>代码示例>>Java>>正文


Java Collator.PRIMARY属性代码示例

本文整理汇总了Java中com.ibm.icu.text.Collator.PRIMARY属性的典型用法代码示例。如果您正苦于以下问题:Java Collator.PRIMARY属性的具体用法?Java Collator.PRIMARY怎么用?Java Collator.PRIMARY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.ibm.icu.text.Collator的用法示例。


在下文中一共展示了Collator.PRIMARY属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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);
    }
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:14,代码来源:CollationSettings.java

示例2: parseResetAndPosition

private int parseResetAndPosition() throws ParseException {
    int i = skipWhiteSpace(ruleIndex + 1);
    int j;
    char c;
    int resetStrength;
    if(rules.regionMatches(i, BEFORE, 0, BEFORE.length()) &&
            (j = i + BEFORE.length()) < rules.length() &&
            PatternProps.isWhiteSpace(rules.charAt(j)) &&
            ((j = skipWhiteSpace(j + 1)) + 1) < rules.length() &&
            0x31 <= (c = rules.charAt(j)) && c <= 0x33 &&
            rules.charAt(j + 1) == 0x5d) {
        // &[before n] with n=1 or 2 or 3
        resetStrength = Collator.PRIMARY + (c - 0x31);
        i = skipWhiteSpace(j + 2);
    } else {
        resetStrength = Collator.IDENTICAL;
    }
    if(i >= rules.length()) {
        setParseError("reset without position");
        return UCOL_DEFAULT;
    }
    if(rules.charAt(i) == 0x5b) {  // '['
        i = parseSpecialPosition(i, rawBuilder);
    } else {
        i = parseTailoringString(i, rawBuilder);
    }
    try {
        sink.addReset(resetStrength, rawBuilder);
    } catch(Exception e) {
        setParseError("adding reset failed", e);
        return UCOL_DEFAULT;
    }
    ruleIndex = i;
    return resetStrength;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:35,代码来源:CollationRuleParser.java

示例3: 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;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:8,代码来源:CollationBuilder.java

示例4: 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;
}
 
开发者ID:vespa-engine,项目名称:vespa,代码行数:11,代码来源:Sorting.java

示例5: 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;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:47,代码来源:CollationRuleParser.java

示例6: 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;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:45,代码来源:CollationBuilder.java


注:本文中的com.ibm.icu.text.Collator.PRIMARY属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。