本文整理汇总了Java中com.ibm.icu.lang.UScript.COMMON属性的典型用法代码示例。如果您正苦于以下问题:Java UScript.COMMON属性的具体用法?Java UScript.COMMON怎么用?Java UScript.COMMON使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.ibm.icu.lang.UScript
的用法示例。
在下文中一共展示了UScript.COMMON属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: next
/**
* Iterates to the next script run, returning true if one exists.
*
* @return true if there is another script run, false otherwise.
*/
boolean next() {
if (scriptLimit >= limit) {
return false;
}
scriptCode = UScript.COMMON;
scriptStart = scriptLimit;
while (index < limit) {
final int ch = UTF16.charAt(text, start, limit, index - start);
final int sc = getScript(ch);
/*
* From UTR #24: Implementations that determine the boundaries between
* characters of given scripts should never break between a non-spacing
* mark and its base character. Thus for boundary determinations and
* similar sorts of processing, a non-spacing mark — whatever its script
* value — should inherit the script value of its base character.
*/
if (isSameScript(scriptCode, sc)
|| UCharacter.getType(ch) == ECharacterCategory.NON_SPACING_MARK) {
index += UTF16.getCharCount(ch);
/*
* Inherited or Common becomes the script code of the surrounding text.
*/
if (scriptCode <= UScript.INHERITED && sc > UScript.INHERITED) {
scriptCode = sc;
}
} else {
break;
}
}
scriptLimit = index;
return true;
}
示例2: next
/**
* Iterates to the next script run, returning true if one exists.
*
* @return true if there is another script run, false otherwise.
*/
boolean next() {
if (scriptLimit >= limit)
return false;
scriptCode = UScript.COMMON;
scriptStart = scriptLimit;
while (index < limit) {
final int ch = UTF16.charAt(text, start, limit, index - start);
final int sc = getScript(ch);
/*
* From UTR #24: Implementations that determine the boundaries between
* characters of given scripts should never break between a non-spacing
* mark and its base character. Thus for boundary determinations and
* similar sorts of processing, a non-spacing mark — whatever its script
* value — should inherit the script value of its base character.
*/
if (isSameScript(scriptCode, sc)
|| UCharacter.getType(ch) == ECharacterCategory.NON_SPACING_MARK) {
index += UTF16.getCharCount(ch);
/*
* Inherited or Common becomes the script code of the surrounding text.
*/
if (scriptCode <= UScript.INHERITED && sc > UScript.INHERITED) {
scriptCode = sc;
}
} else {
break;
}
}
scriptLimit = index;
return true;
}
示例3: next
/**
* Iterates to the next script run, returning true if one exists.
*
* @return true if there is another script run, false otherwise.
*/
boolean next() {
if (scriptLimit >= limit) {
return false;
}
scriptCode = UScript.COMMON;
scriptStart = scriptLimit;
while (index < limit) {
final int ch = UTF16.charAt(text, start, limit, index - start);
final int sc = getScript(ch);
/*
* From UTR #24: Implementations that determine the boundaries between
* characters of given scripts should never break between a non-spacing
* mark and its base character. Thus for boundary determinations and
* similar sorts of processing, a non-spacing mark — whatever its script
* value — should inherit the script value of its base character.
*/
if (isSameScript(scriptCode, sc)
|| UCharacter.getType(ch) == ECharacterCategory.NON_SPACING_MARK) {
index += UTF16.getCharCount(ch);
/*
* Inherited or Common becomes the script code of the surrounding text.
*/
if (scriptCode <= UScript.INHERITED && sc > UScript.INHERITED) {
scriptCode = sc;
}
} else {
break;
}
}
scriptLimit = index;
return true;
}
示例4: has
@Override
public boolean has(int codePoint, int value) {
// See https://ssl.icu-project.org/trac/ticket/13462
switch (codePoint) {
case 0x3000:
case 0x3004:
case 0x3012:
case 0x3020:
case 0x3036:
return value == UScript.COMMON;
}
return super.has(codePoint, value);
}
示例5: 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;
}
示例6: includesCharacter
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;
}
示例7: clear
@Override
public void clear() {
code = UScript.COMMON;
}
示例8: clear
@Override
public void clear() {
code = UScript.COMMON;
}