- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.koolearn.klibrary.text.view.ZLTextParagraphCursor.getParagraphLength()
方法的一些代码示例,展示了ZLTextParagraphCursor.getParagraphLength()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZLTextParagraphCursor.getParagraphLength()
方法的具体详情如下:
包路径:com.koolearn.klibrary.text.view.ZLTextParagraphCursor
类名称:ZLTextParagraphCursor
方法名:getParagraphLength
暂无
代码示例来源:origin: Jiangzqts/EpubRead
ZLTextLineInfo(ZLTextParagraphCursor paragraphCursor, int elementIndex, int charIndex, ZLTextStyle style) {
ParagraphCursor = paragraphCursor;
ParagraphCursorLength = paragraphCursor.getParagraphLength();
StartElementIndex = elementIndex;
StartCharIndex = charIndex;
RealStartElementIndex = elementIndex;
RealStartCharIndex = charIndex;
EndElementIndex = elementIndex;
EndCharIndex = charIndex;
StartStyle = style;
}
代码示例来源:origin: ydcx/KooReader
ZLTextLineInfo(ZLTextParagraphCursor paragraphCursor, int elementIndex, int charIndex, ZLTextStyle style) {
ParagraphCursor = paragraphCursor;
ParagraphCursorLength = paragraphCursor.getParagraphLength();
StartElementIndex = elementIndex;
StartCharIndex = charIndex;
RealStartElementIndex = elementIndex;
RealStartCharIndex = charIndex;
EndElementIndex = elementIndex;
EndCharIndex = charIndex;
StartStyle = style;
}
代码示例来源:origin: ydcx/KooReader
public boolean isEndOfParagraph() {
return
myParagraphCursor != null &&
myElementIndex == myParagraphCursor.getParagraphLength();
}
代码示例来源:origin: Jiangzqts/EpubRead
public boolean isEndOfParagraph() {
return
myParagraphCursor != null &&
myElementIndex == myParagraphCursor.getParagraphLength();
}
代码示例来源:origin: ydcx/KooReader
public void moveToParagraphEnd() {
if (!isNull()) {
myElementIndex = myParagraphCursor.getParagraphLength();
myCharIndex = 0;
}
}
代码示例来源:origin: Jiangzqts/EpubRead
public void moveToParagraphEnd() {
if (!isNull()) {
myElementIndex = myParagraphCursor.getParagraphLength();
myCharIndex = 0;
}
}
代码示例来源:origin: ydcx/KooReader
private ZLTextLineInfo processTextLine(
ZLTextPage page,
ZLTextParagraphCursor paragraphCursor,
final int startIndex,
final int startCharIndex,
final int endIndex,
ZLTextLineInfo previousInfo
) {
final ZLTextLineInfo info = processTextLineInternal(
page, paragraphCursor, startIndex, startCharIndex, endIndex, previousInfo
);
if (info.EndElementIndex == startIndex && info.EndCharIndex == startCharIndex) {
info.EndElementIndex = paragraphCursor.getParagraphLength();
info.EndCharIndex = 0;
// TODO: add error element
}
return info;
}
代码示例来源:origin: Jiangzqts/EpubRead
private ZLTextLineInfo processTextLine(
ZLTextPage page,
ZLTextParagraphCursor paragraphCursor,
final int startIndex,
final int startCharIndex,
final int endIndex,
ZLTextLineInfo previousInfo
) {
final ZLTextLineInfo info = processTextLineInternal(
page, paragraphCursor, startIndex, startCharIndex, endIndex, previousInfo
);
if (info.EndElementIndex == startIndex && info.EndCharIndex == startCharIndex) {
info.EndElementIndex = paragraphCursor.getParagraphLength();
info.EndCharIndex = 0;
// TODO: add error element
}
return info;
}
代码示例来源:origin: ydcx/KooReader
public void moveTo(int wordIndex, int charIndex) {
LogUtil.i13("moveTo2:" + toString());
if (!isNull()) {
if (wordIndex == 0 && charIndex == 0) {
myElementIndex = 0;
myCharIndex = 0;
} else {
wordIndex = Math.max(0, wordIndex);
int size = myParagraphCursor.getParagraphLength();
if (wordIndex > size) {
myElementIndex = size;
myCharIndex = 0;
} else {
myElementIndex = wordIndex;
setCharIndex(charIndex);
}
}
}
}
代码示例来源:origin: Jiangzqts/EpubRead
public void moveTo(int wordIndex, int charIndex) {
LogUtil.i13("moveTo2:" + toString());
if (!isNull()) {
if (wordIndex == 0 && charIndex == 0) {
myElementIndex = 0;
myCharIndex = 0;
} else {
wordIndex = Math.max(0, wordIndex);
int size = myParagraphCursor.getParagraphLength();
if (wordIndex > size) {
myElementIndex = size;
myCharIndex = 0;
} else {
myElementIndex = wordIndex;
setCharIndex(charIndex);
}
}
}
}
代码示例来源:origin: Jiangzqts/EpubRead
private int sizeOfTextBeforeCursor(ZLTextWordCursor wordCursor) {
final ZLTextParagraphCursor paragraphCursor = wordCursor.getParagraphCursor();
if (paragraphCursor == null) {
return -1;
}
final int paragraphIndex = paragraphCursor.Index;
int sizeOfText = myModel.getTextLength(paragraphIndex - 1);
final int paragraphLength = paragraphCursor.getParagraphLength();
if (paragraphLength > 0) {
sizeOfText +=
(myModel.getTextLength(paragraphIndex) - sizeOfText)
* wordCursor.getElementIndex()
/ paragraphLength;
}
return sizeOfText;
}
代码示例来源:origin: ydcx/KooReader
private int sizeOfTextBeforeCursor(ZLTextWordCursor wordCursor) {
final ZLTextParagraphCursor paragraphCursor = wordCursor.getParagraphCursor();
if (paragraphCursor == null) {
return -1;
}
final int paragraphIndex = paragraphCursor.Index;
int sizeOfText = myModel.getTextLength(paragraphIndex - 1);
final int paragraphLength = paragraphCursor.getParagraphLength();
if (paragraphLength > 0) {
sizeOfText +=
(myModel.getTextLength(paragraphIndex) - sizeOfText)
* wordCursor.getElementIndex()
/ paragraphLength;
}
return sizeOfText;
}
代码示例来源:origin: ydcx/KooReader
public ZLTextMark getMark() {
if (myParagraphCursor == null) {
return null;
}
final ZLTextParagraphCursor paragraph = myParagraphCursor;
int paragraphLength = paragraph.getParagraphLength();
int wordIndex = myElementIndex;
while ((wordIndex < paragraphLength) && (!(paragraph.getElement(wordIndex) instanceof ZLTextWord))) {
wordIndex++;
}
if (wordIndex < paragraphLength) {
return new ZLTextMark(paragraph.Index, ((ZLTextWord) paragraph.getElement(wordIndex)).getParagraphOffset(), 0);
}
return new ZLTextMark(paragraph.Index + 1, 0, 0);
}
代码示例来源:origin: Jiangzqts/EpubRead
public ZLTextMark getMark() {
if (myParagraphCursor == null) {
return null;
}
final ZLTextParagraphCursor paragraph = myParagraphCursor;
int paragraphLength = paragraph.getParagraphLength();
int wordIndex = myElementIndex;
while ((wordIndex < paragraphLength) && (!(paragraph.getElement(wordIndex) instanceof ZLTextWord))) {
wordIndex++;
}
if (wordIndex < paragraphLength) {
return new ZLTextMark(paragraph.Index, ((ZLTextWord) paragraph.getElement(wordIndex)).getParagraphOffset(), 0);
}
return new ZLTextMark(paragraph.Index + 1, 0, 0);
}
代码示例来源:origin: Jiangzqts/EpubRead
private ParagraphSize paragraphSize(ZLTextPage page, ZLTextWordCursor cursor, boolean beforeCurrentPosition, int unit) {
final ParagraphSize size = new ParagraphSize();
final ZLTextParagraphCursor paragraphCursor = cursor.getParagraphCursor();
if (paragraphCursor == null) {
return size;
}
final int endElementIndex =
beforeCurrentPosition ? cursor.getElementIndex() : paragraphCursor.getParagraphLength();
resetTextStyle();
int wordIndex = 0;
int charIndex = 0;
ZLTextLineInfo info = null;
while (wordIndex != endElementIndex) {
final ZLTextLineInfo prev = info;
info = processTextLine(page, paragraphCursor, wordIndex, charIndex, endElementIndex, prev);
wordIndex = info.EndElementIndex;
charIndex = info.EndCharIndex;
size.Height += infoSize(info, unit);
if (prev == null) {
size.TopMargin = info.VSpaceBefore;
}
size.BottomMargin = info.VSpaceAfter;
}
return size;
}
代码示例来源:origin: ydcx/KooReader
private ParagraphSize paragraphSize(ZLTextPage page, ZLTextWordCursor cursor, boolean beforeCurrentPosition, int unit) {
final ParagraphSize size = new ParagraphSize();
final ZLTextParagraphCursor paragraphCursor = cursor.getParagraphCursor();
if (paragraphCursor == null) {
return size;
}
final int endElementIndex =
beforeCurrentPosition ? cursor.getElementIndex() : paragraphCursor.getParagraphLength();
resetTextStyle();
int wordIndex = 0;
int charIndex = 0;
ZLTextLineInfo info = null;
while (wordIndex != endElementIndex) {
final ZLTextLineInfo prev = info;
info = processTextLine(page, paragraphCursor, wordIndex, charIndex, endElementIndex, prev);
wordIndex = info.EndElementIndex;
charIndex = info.EndCharIndex;
size.Height += infoSize(info, unit);
if (prev == null) {
size.TopMargin = info.VSpaceBefore;
}
size.BottomMargin = info.VSpaceAfter;
}
return size;
}
代码示例来源:origin: ydcx/KooReader
private void skip(ZLTextPage page, ZLTextWordCursor cursor, int unit, int size) {
final ZLTextParagraphCursor paragraphCursor = cursor.getParagraphCursor();
if (paragraphCursor == null) {
return;
}
final int endElementIndex = paragraphCursor.getParagraphLength();
resetTextStyle();
applyStyleChanges(paragraphCursor, 0, cursor.getElementIndex());
ZLTextLineInfo info = null;
while (!cursor.isEndOfParagraph() && size > 0) {
info = processTextLine(page, paragraphCursor, cursor.getElementIndex(), cursor.getCharIndex(), endElementIndex, info);
cursor.moveTo(info.EndElementIndex, info.EndCharIndex);
size -= infoSize(info, unit);
}
}
代码示例来源:origin: Jiangzqts/EpubRead
private void skip(ZLTextPage page, ZLTextWordCursor cursor, int unit, int size) {
final ZLTextParagraphCursor paragraphCursor = cursor.getParagraphCursor();
if (paragraphCursor == null) {
return;
}
final int endElementIndex = paragraphCursor.getParagraphLength();
resetTextStyle();
applyStyleChanges(paragraphCursor, 0, cursor.getElementIndex());
ZLTextLineInfo info = null;
while (!cursor.isEndOfParagraph() && size > 0) {
info = processTextLine(page, paragraphCursor, cursor.getElementIndex(), cursor.getCharIndex(), endElementIndex, info);
cursor.moveTo(info.EndElementIndex, info.EndCharIndex);
size -= infoSize(info, unit);
}
}
代码示例来源:origin: Jiangzqts/EpubRead
public void traverse(ZLTextPosition from, ZLTextPosition to) {
final int fromParagraph = from.getParagraphIndex();
final int toParagraph = to.getParagraphIndex();
ZLTextParagraphCursor cursor = myView.cursor(fromParagraph);
for (int i = fromParagraph; i <= toParagraph; ++i) {
final int fromElement = i == fromParagraph ? from.getElementIndex() : 0;
final int toElement = i == toParagraph ? to.getElementIndex() : cursor.getParagraphLength() - 1;
for (int j = fromElement; j <= toElement; j++) {
final ZLTextElement element = cursor.getElement(j);
if (element == ZLTextElement.HSpace) {
processSpace();
} else if (element == ZLTextElement.NBSpace) {
processNbSpace();
} else if (element instanceof ZLTextWord) {
processWord((ZLTextWord)element);
}
}
if (i < toParagraph) {
processEndOfParagraph();
cursor = cursor.next();
}
}
}
}
代码示例来源:origin: ydcx/KooReader
public void traverse(ZLTextPosition from, ZLTextPosition to) {
final int fromParagraph = from.getParagraphIndex();
final int toParagraph = to.getParagraphIndex();
ZLTextParagraphCursor cursor = myView.cursor(fromParagraph);
for (int i = fromParagraph; i <= toParagraph; ++i) {
final int fromElement = i == fromParagraph ? from.getElementIndex() : 0;
final int toElement = i == toParagraph ? to.getElementIndex() : cursor.getParagraphLength() - 1;
for (int j = fromElement; j <= toElement; j++) {
final ZLTextElement element = cursor.getElement(j);
if (element == ZLTextElement.HSpace) {
processSpace();
} else if (element == ZLTextElement.NBSpace) {
processNbSpace();
} else if (element instanceof ZLTextWord) {
processWord((ZLTextWord)element);
}
}
if (i < toParagraph) {
processEndOfParagraph();
cursor = cursor.next();
}
}
}
}
本文整理了Java中com.koolearn.klibrary.text.view.ZLTextParagraphCursor.getParagraphLength()方法的一些代码示例,展示了ZLT
我是一名优秀的程序员,十分优秀!