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


Java UScript.INVALID_CODE属性代码示例

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


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

示例1: scriptNameToCode

/**
 * Return the script code for a given name, or
 * UScript.INVALID_CODE if not found.
 */
private static int scriptNameToCode(String name) {
    try{
        int[] codes = UScript.getCode(name);
        return codes != null ? codes[0] : UScript.INVALID_CODE;
    }catch( MissingResourceException e){
        ///CLOVER:OFF
        return UScript.INVALID_CODE;
        ///CLOVER:ON
    }
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:14,代码来源:AnyTransliterator.java

示例2: Spec

public Spec(String theSpec) {
    top = theSpec;
    spec = null;
    scriptName = null;
    try{
        // Canonicalize script name.  If top is a script name then
        // script != UScript.INVALID_CODE.
        int script = UScript.getCodeFromName(top);

        // Canonicalize script name -or- do locale->script mapping
        int[] s = UScript.getCode(top);
        if (s != null) {
            scriptName = UScript.getName(s[0]);
            // If the script name is the same as top then it's redundant
            if (scriptName.equalsIgnoreCase(top)) {
                scriptName = null;
            }
        }

        isSpecLocale = false;
        res = null;
        // If 'top' is not a script name, try a locale lookup
        if (script == UScript.INVALID_CODE) {
            Locale toploc = LocaleUtility.getLocaleFromName(top);
            res  = (ICUResourceBundle)UResourceBundle.getBundleInstance(ICUData.ICU_TRANSLIT_BASE_NAME,toploc);
            // Make sure we got the bundle we wanted; otherwise, don't use it
            if (res!=null && LocaleUtility.isFallbackOf(res.getULocale().toString(), top)) {
                isSpecLocale = true;
            }
        }
    }catch(MissingResourceException e){
        ///CLOVER:OFF
        // The constructor is called from multiple private methods
        //  that protects an invalid scriptName
        scriptName = null;
        ///CLOVER:ON
    }
    // assert(spec != top);
    reset();
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:40,代码来源:TransliteratorRegistry.java

示例3: setText

/**
 * Set a new region of text to be examined by this iterator
 *
 * @param text   text buffer to examine
 * @param start  offset into buffer
 * @param length maximum length to examine
 */
void setText(char text[], int start, int length) {
    this.text = text;
    this.start = start;
    this.index = start;
    this.limit = start + length;
    this.scriptStart = start;
    this.scriptLimit = start;
    this.scriptCode = UScript.INVALID_CODE;
}
 
开发者ID:jprante,项目名称:elasticsearch-icu,代码行数:16,代码来源:ScriptIterator.java

示例4: setText

/**
 * Set a new region of text to be examined by this iterator
 * 
 * @param text text buffer to examine
 * @param start offset into buffer
 * @param length maximum length to examine
 */
void setText(char text[], int start, int length) {
  this.text = text;
  this.start = start;
  this.index = start;
  this.limit = start + length;
  this.scriptStart = start;
  this.scriptLimit = start;
  this.scriptCode = UScript.INVALID_CODE;
}
 
开发者ID:europeana,项目名称:search,代码行数:16,代码来源:ScriptIterator.java

示例5: setText

/**
 * Set a new region of text to be examined by this iterator.
 *
 * @param text   text buffer to examine
 * @param start  offset into buffer
 * @param length maximum length to examine
 */
void setText(char[] text, int start, int length) {
    this.text = text;
    this.start = start;
    this.index = start;
    this.limit = start + length;
    this.scriptStart = start;
    this.scriptLimit = start;
    this.scriptCode = UScript.INVALID_CODE;
}
 
开发者ID:jprante,项目名称:elasticsearch-plugin-bundle,代码行数:16,代码来源:ScriptIterator.java

示例6: register

/**
 * Registers standard transliterators with the system.  Called by
 * Transliterator during initialization.  Scan all current targets
 * and register those that are scripts T as Any-T/V.
 */
static void register() {

    HashMap<String, Set<String>> seen = new HashMap<String, Set<String>>(); // old code used set, but was dependent on order

    for (Enumeration<String> s = Transliterator.getAvailableSources(); s.hasMoreElements(); ) {
        String source = s.nextElement();

        // Ignore the "Any" source
        if (source.equalsIgnoreCase(ANY)) continue;

        for (Enumeration<String> t = Transliterator.getAvailableTargets(source);
             t.hasMoreElements(); ) {
            String target = t.nextElement();

            // Get the script code for the target.  If not a script, ignore.
            int targetScript = scriptNameToCode(target);
            if (targetScript == UScript.INVALID_CODE) {
                continue;
            }

            Set<String> seenVariants = seen.get(target);
            if (seenVariants == null) {
                seen.put(target, seenVariants = new HashSet<String>());
            }

            for (Enumeration<String> v = Transliterator.getAvailableVariants(source, target);
                 v.hasMoreElements(); ) {
                String variant = v.nextElement();

                // Only process each target/variant pair once
                if (seenVariants.contains(variant)) {
                    continue;
                }
                seenVariants.add(variant);

                String id;
                id = TransliteratorIDParser.STVtoID(ANY, target, variant);
                AnyTransliterator trans = new AnyTransliterator(id, target, variant,
                                                                targetScript);
                Transliterator.registerInstance(trans);
                Transliterator.registerSpecialInverse(target, NULL_ID, false);
            }
        }
    }
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:50,代码来源:AnyTransliterator.java

示例7: next

/**
 * 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,代码行数:48,代码来源:AnyTransliterator.java


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