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


Java Collator.IDENTICAL属性代码示例

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


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

private void parseRuleChain() throws ParseException {
    int resetStrength = parseResetAndPosition();
    boolean isFirstRelation = true;
    for(;;) {
        int result = parseRelationOperator();
        if(result < 0) {
            if(ruleIndex < rules.length() && rules.charAt(ruleIndex) == 0x23) {
                // '#' starts a comment, until the end of the line
                ruleIndex = skipComment(ruleIndex + 1);
                continue;
            }
            if(isFirstRelation) {
                setParseError("reset not followed by a relation");
            }
            return;
        }
        int strength = result & STRENGTH_MASK;
        if(resetStrength < Collator.IDENTICAL) {
            // reset-before rule chain
            if(isFirstRelation) {
                if(strength != resetStrength) {
                    setParseError("reset-before strength differs from its first relation");
                    return;
                }
            } else {
                if(strength < resetStrength) {
                    setParseError("reset-before strength followed by a stronger relation");
                    return;
                }
            }
        }
        int i = ruleIndex + (result >> OFFSET_SHIFT);  // skip over the relation operator
        if((result & STARRED_FLAG) == 0) {
            parseRelationStrings(strength, i);
        } else {
            parseStarredCharacters(strength, i);
        }
        isFirstRelation = false;
    }
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:40,代码来源:CollationRuleParser.java

示例3: 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

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

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

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

示例7: 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);
}
 
开发者ID:googlei18n,项目名称:i18n_sanitycheck,代码行数:42,代码来源:OrderingChecker.java


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