本文整理汇总了Java中org.vimgadgets.linebreak.LineBreaker类的典型用法代码示例。如果您正苦于以下问题:Java LineBreaker类的具体用法?Java LineBreaker怎么用?Java LineBreaker使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LineBreaker类属于org.vimgadgets.linebreak包,在下文中一共展示了LineBreaker类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Processor
import org.vimgadgets.linebreak.LineBreaker; //导入依赖的package包/类
private Processor(ZLTextParagraph paragraph, LineBreaker lineBreaker, List<ZLTextMark> marks, int paragraphIndex, ArrayList<ZLTextElement> elements) {
myParagraph = paragraph;
myLineBreaker = lineBreaker;
myElements = elements;
myMarks = marks;
final ZLTextMark mark = new ZLTextMark(paragraphIndex, 0, 0);
int i;
for (i = 0; i < myMarks.size(); i++) {
if (((ZLTextMark)myMarks.get(i)).compareTo(mark) >= 0) {
break;
}
}
myFirstMark = i;
myLastMark = myFirstMark;
for (; (myLastMark != myMarks.size()) && (((ZLTextMark)myMarks.get(myLastMark)).ParagraphIndex == paragraphIndex); myLastMark++);
myOffset = 0;
}
示例2: fill
import org.vimgadgets.linebreak.LineBreaker; //导入依赖的package包/类
public void fill() {
ZLTextParagraph paragraph = Model.getParagraph(Index);
switch (paragraph.getKind()) {
case ZLTextParagraph.Kind.TEXT_PARAGRAPH:
new Processor(paragraph, new LineBreaker(Model.getLanguage()), Model.getMarks(), Index, myElements).fill();
break;
case ZLTextParagraph.Kind.EMPTY_LINE_PARAGRAPH:
myElements.add(new ZLTextWord(SPACE_ARRAY, 0, 1, 0));
break;
default:
break;
}
}
示例3: fill
import org.vimgadgets.linebreak.LineBreaker; //导入依赖的package包/类
void fill() {
ZLTextParagraph paragraph = Model.getParagraph(Index);
switch (paragraph.getKind()) {
case ZLTextParagraph.Kind.TEXT_PARAGRAPH:
new Processor(paragraph, new LineBreaker(Model.getLanguage()), Model.getMarks(), Index, myElements).fill();
break;
case ZLTextParagraph.Kind.EMPTY_LINE_PARAGRAPH:
myElements.add(new ZLTextWord(SPACE_ARRAY, 0, 1, 0));
break;
default:
break;
}
}
示例4: processTextEntry
import org.vimgadgets.linebreak.LineBreaker; //导入依赖的package包/类
private void processTextEntry(final char[] data, final int offset, final int length, ZLTextHyperlink hyperlink) {
if (length != 0) {
if (ourBreaks.length < length) {
ourBreaks = new byte[length];
}
final byte[] breaks = ourBreaks;
myLineBreaker.setLineBreaks(data, offset, length, breaks);
final ZLTextElement hSpace = ZLTextElement.HSpace;
final ArrayList<ZLTextElement> elements = myElements;
char ch = 0;
char previousChar = 0;
int spaceState = NO_SPACE;
int wordStart = 0;
for (int index = 0; index < length; ++index) {
previousChar = ch;
ch = data[offset + index];
if (Character.isSpace(ch)) {
if (index > 0 && spaceState == NO_SPACE) {
addWord(data, offset + wordStart, index - wordStart, myOffset + wordStart, hyperlink);
}
spaceState = SPACE;
} else {
switch (spaceState) {
case SPACE:
//if (breaks[index - 1] == LineBreak.NOBREAK || previousChar == '-') {
//}
elements.add(hSpace);
wordStart = index;
break;
//case NON_BREAKABLE_SPACE:
//break;
case NO_SPACE:
if (index > 0 &&
breaks[index - 1] != LineBreaker.NOBREAK &&
previousChar != '-' &&
index != wordStart) {
addWord(data, offset + wordStart, index - wordStart, myOffset + wordStart, hyperlink);
wordStart = index;
}
break;
}
spaceState = NO_SPACE;
}
}
switch (spaceState) {
case SPACE:
elements.add(hSpace);
break;
//case NON_BREAKABLE_SPACE:
//break;
case NO_SPACE:
addWord(data, offset + wordStart, length - wordStart, myOffset + wordStart, hyperlink);
break;
}
myOffset += length;
}
}