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


Java UScript.getScript方法代码示例

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


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

示例1: getScript

import com.ibm.icu.lang.UScript; //导入方法依赖的package包/类
/**
 * fast version of UScript.getScript(). Basic Latin is an array lookup
 */
private int getScript(int codepoint) {
    if (0 <= codepoint && codepoint < basicLatin.length) {
        return basicLatin[codepoint];
    } else {
        int script = UScript.getScript(codepoint);
        if (combineCJ) {
            if (script == UScript.HAN || script == UScript.HIRAGANA || script == UScript.KATAKANA) {
                return UScript.JAPANESE;
            } else if (codepoint >= 0xFF10 && codepoint <= 0xFF19) {
                // when using CJK dictionary breaking, don't let full width numbers go to it, otherwise
                // they are treated as punctuation. we currently have no cleaner way to fix this!
                return UScript.LATIN;
            } else {
                return script;
            }
        } else {
            return script;
        }
    }
}
 
开发者ID:jprante,项目名称:elasticsearch-icu,代码行数:24,代码来源:ScriptIterator.java

示例2: getScript

import com.ibm.icu.lang.UScript; //导入方法依赖的package包/类
/** fast version of UScript.getScript(). Basic Latin is an array lookup */
private int getScript(int codepoint) {
  if (0 <= codepoint && codepoint < basicLatin.length) {
    return basicLatin[codepoint];
  } else {
    int script = UScript.getScript(codepoint);
    if (combineCJ) {
      if (script == UScript.HAN || script == UScript.HIRAGANA || script == UScript.KATAKANA) {
        return UScript.JAPANESE;
      } else if (codepoint >= 0xFF10 && codepoint <= 0xFF19) {
        // when using CJK dictionary breaking, don't let full width numbers go to it, otherwise
        // they are treated as punctuation. we currently have no cleaner way to fix this!
        return UScript.LATIN; 
      } else {
        return script;
      }
    } else {
      return script;
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:22,代码来源:ScriptIterator.java

示例3: buildScores

import com.ibm.icu.lang.UScript; //导入方法依赖的package包/类
private static void buildScores(String text, Map<Integer, AtomicInteger> scores) {
    try {
        char[] chararray = text.toCharArray();
        for (int i = 0; i < text.length(); i++) {
            int code = UScript.getScript(UCharacter.codePointAt(chararray, i));
            increaseScoreFor(scores, code);
        }
    } catch (Exception ignored) {
    }
}
 
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:11,代码来源:MCRLanguageDetector.java

示例4: getScript

import com.ibm.icu.lang.UScript; //导入方法依赖的package包/类
/** fast version of UScript.getScript(). Basic Latin is an array lookup */
private static int getScript(int codepoint) {
  if (0 <= codepoint && codepoint < basicLatin.length)
    return basicLatin[codepoint];
  else
    return UScript.getScript(codepoint);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:8,代码来源:ScriptIterator.java

示例5: next

import com.ibm.icu.lang.UScript; //导入方法依赖的package包/类
/**
 * Returns TRUE if there are any more runs.  TRUE is always
 * returned at least once.  Upon return, the caller should
 * examine scriptCode, start, and limit.
 */
public boolean next() {
    int ch;
    int s;

    scriptCode = UScript.INVALID_CODE; // don't know script yet
    start = limit;

    // Are we done?
    if (start == textLimit) {
        return false;
    }

    // Move start back to include adjacent COMMON or INHERITED
    // characters
    while (start > textStart) {
        ch = text.char32At(start - 1); // look back
        s = UScript.getScript(ch);
        if (s == UScript.COMMON || s == UScript.INHERITED) {
            --start;
        } else {
            break;
        }
    }

    // Move limit ahead to include COMMON, INHERITED, and characters
    // of the current script.
    while (limit < textLimit) {
        ch = text.char32At(limit); // look ahead
        s = UScript.getScript(ch);
        if (s != UScript.COMMON && s != UScript.INHERITED) {
            if (scriptCode == UScript.INVALID_CODE) {
                scriptCode = s;
            } else if (s != scriptCode) {
                break;
            }
        }
        ++limit;
    }

    // Return TRUE even if the entire text is COMMON / INHERITED, in
    // which case scriptCode will be UScript.INVALID_CODE.
    return true;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:49,代码来源:AnyTransliterator.java

示例6: getValue

import com.ibm.icu.lang.UScript; //导入方法依赖的package包/类
@Override
int getValue(int c) {
    return UScript.getScript(c);
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:5,代码来源:UCharacterProperty.java

示例7: includesCharacter

import com.ibm.icu.lang.UScript; //导入方法依赖的package包/类
public boolean includesCharacter(int codePoint)
{
	if (includedScripts == null && excludedScripts == null)
	{
		return true;
	}
	
	int codeScript = UScript.getScript(codePoint);
	if (codeScript == UScript.UNKNOWN)
	{
		//include by default
		return true;
	}
	
	if (codeScript == UScript.COMMON)
	{
		//COMMON is included unless explicitly excluded
		return !excludedCommon;
	}
	
	if (codeScript == UScript.INHERITED)
	{
		//INHERITED is included unless explicitly excluded
		return !excludedInherited;
	}
	
	if (includedScripts != null && includedScripts.contains(codeScript))
	{
		//the codepoint script is explicitly included
		return true;
	}
	
	if (excludedScripts != null && excludedScripts.contains(codeScript))
	{
		//the codepoint script is explicitly excluded
		return false;
	}
	
	if (includedScripts == null)
	{
		//not excluded
		return true;
	}
	
	for (Integer script : includedScripts)
	{
		if (UScript.hasScript(codePoint, script))
		{
			//included as a secondary/extension script
			return true;
		}
	}
	
	//not included
	return false;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:57,代码来源:CharScriptsSet.java


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