mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-21 12:40:02 +00:00
ICU-10911 added and called UPropertyAliases.getPropertyValueEnumNoThrow, as per Markus's suggestion
X-SVN-Rev: 36356
This commit is contained in:
parent
7732bb2599
commit
0fe5842382
2 changed files with 28 additions and 7 deletions
|
@ -305,6 +305,33 @@ public final class UPropertyAliases {
|
|||
// where the first word is the BytesTrie offset.
|
||||
return getPropertyOrValueEnum(valueMaps[valueMapIndex], alias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a value enum given a property enum and one of its value names. Does not throw.
|
||||
* @param property
|
||||
* @param alias
|
||||
* @return value enum, or UProperty.UNDEFINED if not defined for that property
|
||||
* @internal
|
||||
* @deprecated This API is ICU internal only.
|
||||
*/
|
||||
@Deprecated
|
||||
public int getPropertyValueEnumNoThrow(int property, CharSequence alias) {
|
||||
try {
|
||||
int valueMapIndex=findProperty(property);
|
||||
if(valueMapIndex==0) {
|
||||
return UProperty.UNDEFINED;
|
||||
}
|
||||
valueMapIndex=valueMaps[valueMapIndex+1];
|
||||
if(valueMapIndex==0) {
|
||||
return UProperty.UNDEFINED;
|
||||
}
|
||||
// valueMapIndex is the start of the property's valueMap,
|
||||
// where the first word is the BytesTrie offset.
|
||||
return getPropertyOrValueEnum(valueMaps[valueMapIndex], alias);
|
||||
} catch (Exception e) {
|
||||
return UProperty.UNDEFINED;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare two property names, returning <0, 0, or >0. The
|
||||
|
|
|
@ -4640,13 +4640,7 @@ public final class UCharacter implements ECharacterCategory, ECharacterDirection
|
|||
*/
|
||||
@Deprecated
|
||||
public static int getPropertyValueEnumNoThrow(int property, CharSequence valueAlias) {
|
||||
int propEnum;
|
||||
try {
|
||||
propEnum = UPropertyAliases.INSTANCE.getPropertyValueEnum(property, valueAlias);
|
||||
} catch (Exception e) {
|
||||
propEnum = UProperty.UNDEFINED;
|
||||
}
|
||||
return propEnum;
|
||||
return UPropertyAliases.INSTANCE.getPropertyValueEnumNoThrow(property, valueAlias);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue