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


Java UProperty类代码示例

本文整理汇总了Java中com.ibm.icu.lang.UProperty的典型用法代码示例。如果您正苦于以下问题:Java UProperty类的具体用法?Java UProperty怎么用?Java UProperty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getReorderCode

import com.ibm.icu.lang.UProperty; //导入依赖的package包/类
/**
 * Gets a script or reorder code from its string representation.
 * @return the script/reorder code, or
 * -1 if not recognized
 */
public static int getReorderCode(String word) {
    for(int i = 0; i < gSpecialReorderCodes.length; ++i) {
        if(word.equalsIgnoreCase(gSpecialReorderCodes[i])) {
            return Collator.ReorderCodes.FIRST + i;
        }
    }
    try {
        int script = UCharacter.getPropertyValueEnum(UProperty.SCRIPT, word);
        if(script >= 0) {
            return script;
        }
    } catch (IllegalIcuArgumentException e) {
        // fall through
    }
    if(word.equalsIgnoreCase("others")) {
        return Collator.ReorderCodes.OTHERS;  // same as Zzzz = USCRIPT_UNKNOWN 
    }
    return -1;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:25,代码来源:CollationRuleParser.java

示例2: getMaxValue

import com.ibm.icu.lang.UProperty; //导入依赖的package包/类
public final int getMaxValue(int which) {
    int max;

    max=indexes[IX_MAX_VALUES];
    switch(which) {
    case UProperty.BIDI_CLASS:
        return (max&CLASS_MASK);
    case UProperty.JOINING_GROUP:
        return (max&MAX_JG_MASK)>>MAX_JG_SHIFT;
    case UProperty.JOINING_TYPE:
        return (max&JT_MASK)>>JT_SHIFT;
    case UProperty.BIDI_PAIRED_BRACKET_TYPE:
        return (max&BPT_MASK)>>BPT_SHIFT;
    default:
        return -1; /* undefined */
    }
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:18,代码来源:UBiDiProps.java

示例3: ICUTokenizerFactory

import com.ibm.icu.lang.UProperty; //导入依赖的package包/类
/** Creates a new ICUTokenizerFactory */
public ICUTokenizerFactory(Map<String,String> args) {
  super(args);
  tailored = new HashMap<>();
  String rulefilesArg = get(args, RULEFILES);
  if (rulefilesArg != null) {
    List<String> scriptAndResourcePaths = splitFileNames(rulefilesArg);
    for (String scriptAndResourcePath : scriptAndResourcePaths) {
      int colonPos = scriptAndResourcePath.indexOf(":");
      String scriptCode = scriptAndResourcePath.substring(0, colonPos).trim();
      String resourcePath = scriptAndResourcePath.substring(colonPos+1).trim();
      tailored.put(UCharacter.getPropertyValueEnum(UProperty.SCRIPT, scriptCode), resourcePath);
    }
  }
  cjkAsWords = getBoolean(args, "cjkAsWords", true);
  if (!args.isEmpty()) {
    throw new IllegalArgumentException("Unknown parameters: " + args);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:20,代码来源:ICUTokenizerFactory.java

示例4: ICUTokenizerFactory

import com.ibm.icu.lang.UProperty; //导入依赖的package包/类
/** Creates a new ICUTokenizerFactory */
public ICUTokenizerFactory(Map<String,String> args) {
  super(args);
  tailored = new HashMap<Integer,String>();
  String rulefilesArg = get(args, RULEFILES);
  if (rulefilesArg != null) {
    List<String> scriptAndResourcePaths = splitFileNames(rulefilesArg);
    for (String scriptAndResourcePath : scriptAndResourcePaths) {
      int colonPos = scriptAndResourcePath.indexOf(":");
      String scriptCode = scriptAndResourcePath.substring(0, colonPos).trim();
      String resourcePath = scriptAndResourcePath.substring(colonPos+1).trim();
      tailored.put(UCharacter.getPropertyValueEnum(UProperty.SCRIPT, scriptCode), resourcePath);
    }
  }
  cjkAsWords = getBoolean(args, "cjkAsWords", true);
  if (!args.isEmpty()) {
    throw new IllegalArgumentException("Unknown parameters: " + args);
  }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:20,代码来源:ICUTokenizerFactory.java

示例5: isValue

import com.ibm.icu.lang.UProperty; //导入依赖的package包/类
public boolean isValue(String valueAlias) {
    // Don't allow loose matching.
    try {
        int value = UCharacter.getPropertyValueEnum(propertyId, valueAlias);
        String shortName = UCharacter.getPropertyValueName(propertyId, value, UProperty.NameChoice.SHORT);
        if (shortName != null && shortName.equals(valueAlias)) {
            return true;
        }
        for (int i = 0;; ++i) {
            String longName = UCharacter.getPropertyValueName(propertyId, value, UProperty.NameChoice.LONG + i);
            if (longName != null && longName.equals(valueAlias)) {
                return true;
            }
        }
    } catch (IllegalArgumentException e) {
        return false;
    }
}
 
开发者ID:anba,项目名称:es6draft,代码行数:19,代码来源:UnicodeData.java

示例6: testAllICUBinaryProperties

import com.ibm.icu.lang.UProperty; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Test
public void testAllICUBinaryProperties() {
    for (int p = UProperty.BINARY_START; p < UProperty.BINARY_LIMIT; ++p) {
        String shortName = UCharacter.getPropertyName(p, UProperty.NameChoice.SHORT);
        if (shortName != null) {
            // Does not throw.
            isBinaryProperty(shortName);
        }
        String longName = UCharacter.getPropertyName(p, UProperty.NameChoice.LONG);
        if (longName != null) {
            // Does not throw.
            isBinaryProperty(longName);
        }
    }
}
 
开发者ID:anba,项目名称:es6draft,代码行数:17,代码来源:UnicodeDataTest.java

示例7: ICUTokenizerFactory

import com.ibm.icu.lang.UProperty; //导入依赖的package包/类
/** Creates a new ICUTokenizerFactory */
public ICUTokenizerFactory(Map<String,String> args) {
  super(args);
  tailored = new HashMap<Integer,String>();
  String rulefilesArg = get(args, RULEFILES);
  if (rulefilesArg != null) {
    List<String> scriptAndResourcePaths = splitFileNames(rulefilesArg);
    for (String scriptAndResourcePath : scriptAndResourcePaths) {
      int colonPos = scriptAndResourcePath.indexOf(":");
      String scriptCode = scriptAndResourcePath.substring(0, colonPos).trim();
      String resourcePath = scriptAndResourcePath.substring(colonPos+1).trim();
      tailored.put(UCharacter.getPropertyValueEnum(UProperty.SCRIPT, scriptCode), resourcePath);
    }
  }
  if (!args.isEmpty()) {
    throw new IllegalArgumentException("Unknown parameters: " + args);
  }
}
 
开发者ID:jimaguere,项目名称:Maskana-Gestor-de-Conocimiento,代码行数:19,代码来源:ICUTokenizerFactory.java

示例8: handles

import com.ibm.icu.lang.UProperty; //导入依赖的package包/类
public boolean handles(int c, int breakType) {
    if (breakType == BreakIterator.KIND_WORD || breakType == BreakIterator.KIND_LINE) {
        int script = UCharacter.getIntPropertyValue(c, UProperty.SCRIPT);
        return (script == UScript.KHMER);
    }
    return false;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:8,代码来源:KhmerBreakEngine.java

示例9: handles

import com.ibm.icu.lang.UProperty; //导入依赖的package包/类
@Override
public boolean handles(int c, int breakType) {
    if (breakType == BreakIterator.KIND_WORD || breakType == BreakIterator.KIND_LINE) {
        int script = UCharacter.getIntPropertyValue(c, UProperty.SCRIPT);
        return (script == UScript.MYANMAR);
    }
    return false;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:9,代码来源:BurmeseBreakEngine.java

示例10: handleChar

import com.ibm.icu.lang.UProperty; //导入依赖的package包/类
public synchronized void handleChar(int c, int breakType) {
    if (breakType >= 0 && breakType < fHandled.length && c != DONE32) {
        if (!fHandled[breakType].contains(c)) {
            int script = UCharacter.getIntPropertyValue(c, UProperty.SCRIPT);
            fHandled[breakType].applyIntPropertyValue(UProperty.SCRIPT, script);
        }
    }
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:9,代码来源:UnhandledBreakEngine.java

示例11: handles

import com.ibm.icu.lang.UProperty; //导入依赖的package包/类
public boolean handles(int c, int breakType) {
    if (breakType == BreakIterator.KIND_WORD || breakType == BreakIterator.KIND_LINE) {
        int script = UCharacter.getIntPropertyValue(c, UProperty.SCRIPT);
        return (script == UScript.LAO);
    }
    return false;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:8,代码来源:LaoBreakEngine.java

示例12: setAllowedLocales

import com.ibm.icu.lang.UProperty; //导入依赖的package包/类
/**
 * Limit characters that are acceptable in identifiers being checked to those normally used with the languages
 * associated with the specified locales. Any previously specified list of locales is replaced by the new
 * settings.
 *
 * A set of languages is determined from the locale(s), and from those a set of acceptable Unicode scripts is
 * determined. Characters from this set of scripts, along with characters from the "common" and "inherited"
 * Unicode Script categories will be permitted.
 *
 * Supplying an empty string removes all restrictions; characters from any script will be allowed.
 *
 * The {@link #CHAR_LIMIT} test is automatically enabled for this SpoofChecker when calling this function with a
 * non-empty list of locales.
 *
 * The Unicode Set of characters that will be allowed is accessible via the {@link #getAllowedChars} function.
 * setAllowedLocales() will <i>replace</i> any previously applied set of allowed characters.
 *
 * Adjustments, such as additions or deletions of certain classes of characters, can be made to the result of
 * {@link #setAllowedChars} by fetching the resulting set with {@link #getAllowedChars}, manipulating it with
 * the Unicode Set API, then resetting the spoof detectors limits with {@link #setAllowedChars}.
 *
 * @param locales
 *            A Set of ULocales, from which the language and associated script are extracted. If the locales Set
 *            is null, no restrictions will be placed on the allowed characters.
 *
 * @return self
 * @stable ICU 4.6
 */
public Builder setAllowedLocales(Set<ULocale> locales) {
    fAllowedCharsSet.clear();

    for (ULocale locale : locales) {
        // Add the script chars for this locale to the accumulating set
        // of allowed chars.
        addScriptChars(locale, fAllowedCharsSet);
    }

    // If our caller provided an empty list of locales, we disable the
    // allowed characters checking
    fAllowedLocales.clear();
    if (locales.size() == 0) {
        fAllowedCharsSet.add(0, 0x10ffff);
        fChecks &= ~CHAR_LIMIT;
        return this;
    }

    // Add all common and inherited characters to the set of allowed
    // chars.
    UnicodeSet tempSet = new UnicodeSet();
    tempSet.applyIntPropertyValue(UProperty.SCRIPT, UScript.COMMON);
    fAllowedCharsSet.addAll(tempSet);
    tempSet.applyIntPropertyValue(UProperty.SCRIPT, UScript.INHERITED);
    fAllowedCharsSet.addAll(tempSet);

    // Store the updated spoof checker state.
    fAllowedLocales.clear();
    fAllowedLocales.addAll(locales);
    fChecks |= CHAR_LIMIT;
    return this;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:61,代码来源:SpoofChecker.java

示例13: addScriptChars

import com.ibm.icu.lang.UProperty; //导入依赖的package包/类
private void addScriptChars(ULocale locale, UnicodeSet allowedChars) {
    int scripts[] = UScript.getCode(locale);
    if (scripts != null) {
        UnicodeSet tmpSet = new UnicodeSet();
        for (int i = 0; i < scripts.length; i++) {
            tmpSet.applyIntPropertyValue(UProperty.SCRIPT, scripts[i]);
            allowedChars.addAll(tmpSet);
        }
    }
    // else it's an unknown script.
    // Maybe they asked for the script of "zxx", which refers to no linguistic content.
    // Maybe they asked for the script of a newer locale that we don't know in the older version of ICU.
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:14,代码来源:SpoofChecker.java

示例14: handles

import com.ibm.icu.lang.UProperty; //导入依赖的package包/类
public boolean handles(int c, int breakType) {
    if (breakType == BreakIterator.KIND_WORD || breakType == BreakIterator.KIND_LINE) {
        int script = UCharacter.getIntPropertyValue(c, UProperty.SCRIPT);
        return (script == UScript.THAI);
    }
    return false;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:8,代码来源:ThaiBreakEngine.java

示例15: getPropertyOrValueEnum

import com.ibm.icu.lang.UProperty; //导入依赖的package包/类
private int getPropertyOrValueEnum(int bytesTrieOffset, CharSequence alias) {
    BytesTrie trie=new BytesTrie(bytesTries, bytesTrieOffset);
    if(containsName(trie, alias)) {
        return trie.getValue();
    } else {
        return UProperty.UNDEFINED;
    }
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:9,代码来源:UPropertyAliases.java


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