本文整理汇总了Java中com.ibm.icu.lang.UProperty.GENERAL_CATEGORY_MASK属性的典型用法代码示例。如果您正苦于以下问题:Java UProperty.GENERAL_CATEGORY_MASK属性的具体用法?Java UProperty.GENERAL_CATEGORY_MASK怎么用?Java UProperty.GENERAL_CATEGORY_MASK使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.ibm.icu.lang.UProperty
的用法示例。
在下文中一共展示了UProperty.GENERAL_CATEGORY_MASK属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getIntPropertyValue
public int getIntPropertyValue(int c, int which) {
if(which<UProperty.INT_START) {
if(UProperty.BINARY_START<=which && which<UProperty.BINARY_LIMIT) {
return binProps[which].contains(c) ? 1 : 0;
}
} else if(which<UProperty.INT_LIMIT) {
return intProps[which-UProperty.INT_START].getValue(c);
} else if (which == UProperty.GENERAL_CATEGORY_MASK) {
return getMask(getType(c));
}
return 0; // undefined
}
示例2: from
static Property from(String name) {
// Don't allow loose matching.
int property;
CHECK: try {
property = UCharacter.getPropertyEnum(name);
// Filter out synthetic names.
if (property == UProperty.GENERAL_CATEGORY_MASK) {
return null;
}
String shortName = UCharacter.getPropertyName(property, UProperty.NameChoice.SHORT);
if (shortName != null && shortName.equals(name)) {
break CHECK;
}
for (int i = 0;; ++i) {
String longName = UCharacter.getPropertyName(property, UProperty.NameChoice.LONG + i);
if (longName != null && longName.equals(name)) {
break CHECK;
}
}
} catch (IllegalArgumentException e) {
return null;
}
if (property >= UProperty.BINARY_START && property < BINARY_PROPERTY_LIMIT) {
return BinaryProperty.forId(property);
}
return EnumProperty.forId(property);
}
示例3: forId
static EnumProperty forId(int propertyId) {
if ((propertyId >= UProperty.INT_START && propertyId < INT_PROPERTY_LIMIT)
|| propertyId == UProperty.GENERAL_CATEGORY_MASK || propertyId == UProperty.SCRIPT_EXTENSIONS) {
if (propertyId == UProperty.GENERAL_CATEGORY) {
return General_Category;
}
for (EnumProperty e : EnumProperty.values()) {
if (e.propertyId == propertyId) {
return e;
}
}
}
return null;
}
示例4: getSource
public final int getSource(int which) {
if(which<UProperty.BINARY_START) {
return SRC_NONE; /* undefined */
} else if(which<UProperty.BINARY_LIMIT) {
return binProps[which].getSource();
} else if(which<UProperty.INT_START) {
return SRC_NONE; /* undefined */
} else if(which<UProperty.INT_LIMIT) {
return intProps[which-UProperty.INT_START].getSource();
} else if(which<UProperty.STRING_START) {
switch(which) {
case UProperty.GENERAL_CATEGORY_MASK:
case UProperty.NUMERIC_VALUE:
return SRC_CHAR;
default:
return SRC_NONE;
}
} else if(which<UProperty.STRING_LIMIT) {
switch(which) {
case UProperty.AGE:
return SRC_PROPSVEC;
case UProperty.BIDI_MIRRORING_GLYPH:
return SRC_BIDI;
case UProperty.CASE_FOLDING:
case UProperty.LOWERCASE_MAPPING:
case UProperty.SIMPLE_CASE_FOLDING:
case UProperty.SIMPLE_LOWERCASE_MAPPING:
case UProperty.SIMPLE_TITLECASE_MAPPING:
case UProperty.SIMPLE_UPPERCASE_MAPPING:
case UProperty.TITLECASE_MAPPING:
case UProperty.UPPERCASE_MAPPING:
return SRC_CASE;
case UProperty.ISO_COMMENT:
case UProperty.NAME:
case UProperty.UNICODE_1_NAME:
return SRC_NAMES;
default:
return SRC_NONE;
}
} else {
switch(which) {
case UProperty.SCRIPT_EXTENSIONS:
return SRC_PROPSVEC;
default:
return SRC_NONE; /* undefined */
}
}
}
示例5: applyIntPropertyValue
/**
* Modifies this set to contain those code points which have the
* given value for the given binary or enumerated property, as
* returned by UCharacter.getIntPropertyValue. Prior contents of
* this set are lost.
*
* @param prop a property in the range
* UProperty.BIN_START..UProperty.BIN_LIMIT-1 or
* UProperty.INT_START..UProperty.INT_LIMIT-1 or.
* UProperty.MASK_START..UProperty.MASK_LIMIT-1.
*
* @param value a value in the range
* UCharacter.getIntPropertyMinValue(prop)..
* UCharacter.getIntPropertyMaxValue(prop), with one exception.
* If prop is UProperty.GENERAL_CATEGORY_MASK, then value should not be
* a UCharacter.getType() result, but rather a mask value produced
* by logically ORing (1 << UCharacter.getType()) values together.
* This allows grouped categories such as [:L:] to be represented.
*
* @return a reference to this set
*
* @stable ICU 2.4
*/
public UnicodeSet applyIntPropertyValue(int prop, int value) {
checkFrozen();
if (prop == UProperty.GENERAL_CATEGORY_MASK) {
applyFilter(new GeneralCategoryMaskFilter(value), UCharacterProperty.SRC_CHAR);
} else if (prop == UProperty.SCRIPT_EXTENSIONS) {
applyFilter(new ScriptExtensionsFilter(value), UCharacterProperty.SRC_PROPSVEC);
} else {
applyFilter(new IntPropertyFilter(prop, value), UCharacterProperty.INSTANCE.getSource(prop));
}
return this;
}