當前位置: 首頁>>代碼示例>>Java>>正文


Java AttributedCharacterIterator.current方法代碼示例

本文整理匯總了Java中java.text.AttributedCharacterIterator.current方法的典型用法代碼示例。如果您正苦於以下問題:Java AttributedCharacterIterator.current方法的具體用法?Java AttributedCharacterIterator.current怎麽用?Java AttributedCharacterIterator.current使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.text.AttributedCharacterIterator的用法示例。


在下文中一共展示了AttributedCharacterIterator.current方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: format

import java.text.AttributedCharacterIterator; //導入方法依賴的package包/類
@Override
String format(
        AttributedCharacterIterator iterator,
        String preExponent) {
    int copyFromOffset = 0;
    StringBuilder result = new StringBuilder();
    for (
            iterator.first();
            iterator.current() != CharacterIterator.DONE;
        ) {
        Map<Attribute, Object> attributeSet = iterator.getAttributes();
        if (attributeSet.containsKey(NumberFormat.Field.EXPONENT_SYMBOL)) {
            append(
                    iterator,
                    copyFromOffset,
                    iterator.getRunStart(NumberFormat.Field.EXPONENT_SYMBOL),
                    result);
            copyFromOffset = iterator.getRunLimit(NumberFormat.Field.EXPONENT_SYMBOL);
            iterator.setIndex(copyFromOffset);
            result.append(preExponent);
            result.append(beginMarkup);
        } else if (attributeSet.containsKey(NumberFormat.Field.EXPONENT)) {
            int limit = iterator.getRunLimit(NumberFormat.Field.EXPONENT);
            append(
                    iterator,
                    copyFromOffset,
                    limit,
                    result);
            copyFromOffset = limit;
            iterator.setIndex(copyFromOffset);
            result.append(endMarkup);
        } else {
            iterator.next();
        }
    }
    append(iterator, copyFromOffset, iterator.getEndIndex(), result);
    return result.toString();
}
 
開發者ID:abhijitvalluri,項目名稱:fitnotifications,代碼行數:39,代碼來源:ScientificNumberFormatter.java

示例2: char32AtAndAdvance

import java.text.AttributedCharacterIterator; //導入方法依賴的package包/類
private static int char32AtAndAdvance(AttributedCharacterIterator iterator) {
    char c1 = iterator.current();
    char c2 = iterator.next();
    if (UCharacter.isHighSurrogate(c1)) {
        // If c2 is DONE, it will fail the low surrogate test and we
        // skip this block.
        if (UCharacter.isLowSurrogate(c2)) {
            iterator.next();
            return UCharacter.toCodePoint(c1, c2);
        }
    }
    return c1;
}
 
開發者ID:abhijitvalluri,項目名稱:fitnotifications,代碼行數:14,代碼來源:ScientificNumberFormatter.java

示例3: iterateRun

import java.text.AttributedCharacterIterator; //導入方法依賴的package包/類
private boolean iterateRun(AttributedCharacterIterator iterator, StringBuilder sb) {
	sb.setLength(0);
	int charCount = iterator.getRunLimit() - iterator.getRunStart();
	while (charCount-- >= 0) {
		char c = iterator.current();
		iterator.next();
		if (c == AttributedCharacterIterator.DONE) {
			return false;
		} else {
			sb.append(c);
		}
	}
	return true;
}
 
開發者ID:rototor,項目名稱:pdfbox-graphics2d,代碼行數:15,代碼來源:PdfBoxGraphics2DFontTextDrawer.java


注:本文中的java.text.AttributedCharacterIterator.current方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。