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


Java UCharacter.getDirectionality方法代码示例

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


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

示例1: dirTypeForward

import com.ibm.icu.lang.UCharacter; //导入方法依赖的package包/类
/**
 * Returns the UCharacter.DIRECTIONALITY_... value of the next codepoint and advances charIndex.
 * If isHtml, and the codepoint is '<' or '&', advances through the tag/entity, and returns an
 * appropriate dirtype.
 *
 * @throws java.lang.IndexOutOfBoundsException if called when charIndex >= length or < 0.
 */
@VisibleForTesting
byte dirTypeForward() {
  lastChar = text.charAt(charIndex);
  if (UCharacter.isHighSurrogate(lastChar)) {
    int codePoint = UCharacter.codePointAt(text, charIndex);
    charIndex += UCharacter.charCount(codePoint);
    return UCharacter.getDirectionality(codePoint);
  }
  charIndex++;
  byte dirType = getCachedDirectionality(lastChar);
  if (isHtml) {
    // Process tags and entities.
    if (lastChar == '<') {
      dirType = skipTagForward();
    } else if (lastChar == '&') {
      dirType = skipEntityForward();
    }
  }
  return dirType;
}
 
开发者ID:google,项目名称:closure-templates,代码行数:28,代码来源:BidiUtils.java

示例2: dirTypeBackward

import com.ibm.icu.lang.UCharacter; //导入方法依赖的package包/类
/**
 * Returns the UCharacter.DIRECTIONALITY_... value of the preceding codepoint and advances
 * charIndex backwards. If isHtml, and the codepoint is the end of a complete HTML tag or
 * entity, advances over the whole tag/entity and returns an appropriate dirtype.
 *
 * @throws java.lang.IndexOutOfBoundsException if called when charIndex > length or <= 0.
 */
@VisibleForTesting
byte dirTypeBackward() {
  lastChar = text.charAt(charIndex - 1);
  if (UCharacter.isLowSurrogate(lastChar)) {
    int codePoint = UCharacter.codePointBefore(text, charIndex);
    charIndex -= UCharacter.charCount(codePoint);
    return UCharacter.getDirectionality(codePoint);
  }
  charIndex--;
  byte dirType = getCachedDirectionality(lastChar);
  if (isHtml) {
    // Process tags and entities.
    if (lastChar == '>') {
      dirType = skipTagBackward();
    } else if (lastChar == ';') {
      dirType = skipEntityBackward();
    }
  }
  return dirType;
}
 
开发者ID:google,项目名称:closure-templates,代码行数:28,代码来源:BidiUtils.java

示例3: getDirectionality

import com.ibm.icu.lang.UCharacter; //导入方法依赖的package包/类
/**
 * Gets the Unicode directionality of the specified character.
 * 
 * @param codePoint
 *            the Unicode code point to get the directionality of.
 * @return the Unicode directionality of {@code codePoint}.
 */
public static byte getDirectionality(int codePoint) {
    if (getType(codePoint) == Character.UNASSIGNED) {
        return Character.DIRECTIONALITY_UNDEFINED;
    }
    
    byte UCDirectionality = UCharacter.getDirectionality(codePoint);       
    if (UCDirectionality == -1) {
        return -1;
    }
    return DIRECTIONALITY[UCDirectionality];
}
 
开发者ID:shannah,项目名称:cn1,代码行数:19,代码来源:Character.java

示例4: isRtl

import com.ibm.icu.lang.UCharacter; //导入方法依赖的package包/类
/**
 * @param ch
 * @return
 */
private boolean isRtl( char ch )
{
	byte direction = UCharacter.getDirectionality( ch );
	return UCharacter.DIRECTIONALITY_RIGHT_TO_LEFT == direction
			|| UCharacter.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC == direction;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:11,代码来源:BidiEngine.java

示例5: getDirectionality

import com.ibm.icu.lang.UCharacter; //导入方法依赖的package包/类
/**
 * Gets the Unicode directionality of the specified character.
 * 
 * @param codePoint
 *            the character, including supplementary characters
 * @return the Unicode directionality
 */
public static byte getDirectionality(int codePoint) {
    if (getType(codePoint) == Character.UNASSIGNED) {
        return Character.DIRECTIONALITY_UNDEFINED;
    }
    
    byte UCDirectionality = UCharacter.getDirectionality(codePoint);       
    if (UCDirectionality == -1) {
        return -1;
    }
    return DIRECTIONALITY[UCDirectionality];
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:19,代码来源:Character.java

示例6: isLtr

import com.ibm.icu.lang.UCharacter; //导入方法依赖的package包/类
/**
 * @param ch
 * @return
 */
private boolean isLtr( char ch )
{
	return UCharacter.DIRECTIONALITY_LEFT_TO_RIGHT == UCharacter
			.getDirectionality( ch );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:10,代码来源:BidiEngine.java

示例7: getCachedDirectionality

import com.ibm.icu.lang.UCharacter; //导入方法依赖的package包/类
/**
 * Gets the bidi character class, i.e. UCharacter.getDirectionality(), of a given char, using a
 * cache for speed. Not designed for supplementary codepoints, whose results we do not cache.
 */
private static byte getCachedDirectionality(char c) {
  return c < DIR_TYPE_CACHE_SIZE ? DIR_TYPE_CACHE[c] : UCharacter.getDirectionality(c);
}
 
开发者ID:google,项目名称:closure-templates,代码行数:8,代码来源:BidiUtils.java


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