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


Java UTF16.LEAD_SURROGATE_MAX_VALUE属性代码示例

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


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

示例1: getType

/**
* Gets the character extended type
* @param ch character to be tested
* @return extended type it is associated with
*/
private static int getType(int ch)
{
    if (UCharacterUtility.isNonCharacter(ch)) {
        // not a character we return a invalid category count
        return NON_CHARACTER_;
    }
    int result = UCharacter.getType(ch);
    if (result == UCharacterCategory.SURROGATE) {
        if (ch <= UTF16.LEAD_SURROGATE_MAX_VALUE) {
            result = LEAD_SURROGATE_;
        }
        else {
            result = TRAIL_SURROGATE_;
        }
    }
    return result;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:22,代码来源:UCharacterName.java

示例2: nextTrail32

public static int nextTrail32(CharacterIterator ci, int lead) {
    if (lead == CharacterIterator.DONE && ci.getIndex() >= ci.getEndIndex()) {
        return DONE32;
    }
    int retVal = lead;
    if (lead <= UTF16.LEAD_SURROGATE_MAX_VALUE) {
        char  cTrail = ci.next();
        if (UTF16.isTrailSurrogate(cTrail)) {
            retVal = ((lead  - UTF16.LEAD_SURROGATE_MIN_VALUE) << 10) +
                        (cTrail - UTF16.TRAIL_SURROGATE_MIN_VALUE) +
                        UTF16.SUPPLEMENTARY_MIN_VALUE;
        } else {
            ci.previous();
        }
    }
    return retVal;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:17,代码来源:CharacterIteration.java

示例3: getBMPOffset

/**
* Gets the offset to data which the BMP character points to
* Treats a lead surrogate as a normal code point.
* @param ch BMP character
* @return offset to data
*/
protected final int getBMPOffset(char ch)
{
    return (ch >= UTF16.LEAD_SURROGATE_MIN_VALUE
            && ch <= UTF16.LEAD_SURROGATE_MAX_VALUE)
            ? getRawOffset(LEAD_INDEX_OFFSET_, ch)
            : getRawOffset(0, ch);
            // using a getRawOffset(ch) makes no diff
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:14,代码来源:Trie.java

示例4: next32

/**
  * Move the iterator forward to the next code point, and return that code point,
  *   leaving the iterator positioned at char returned.
  *   For Supplementary chars, the iterator is left positioned at the lead surrogate.
  * @param ci  The character iterator
  * @return    The next code point.
  */
 public static int next32(CharacterIterator ci) {
     // If the current position is at a surrogate pair, move to the trail surrogate
     //   which leaves it in position for underlying iterator's next() to work.
     int c = ci.current();
     if (c >= UTF16.LEAD_SURROGATE_MIN_VALUE && c<=UTF16.LEAD_SURROGATE_MAX_VALUE) {
         c = ci.next();   
         if (c<UTF16.TRAIL_SURROGATE_MIN_VALUE || c>UTF16.TRAIL_SURROGATE_MAX_VALUE) {
             ci.previous();   
         }
     }

     // For BMP chars, this next() is the real deal.
     c = ci.next();
     
     // If we might have a lead surrogate, we need to peak ahead to get the trail 
     //  even though we don't want to really be positioned there.
     if (c >= UTF16.LEAD_SURROGATE_MIN_VALUE) {
         c = nextTrail32(ci, c);   
     }
     
     if (c >= UTF16.SUPPLEMENTARY_MIN_VALUE && c != DONE32) {
         // We got a supplementary char.  Back the iterator up to the postion
         // of the lead surrogate.
         ci.previous();   
     }
     return c;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:34,代码来源:CharacterIteration.java


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