gpt4 book ai didi

com.koolearn.klibrary.text.view.ZLTextParagraphCursor.getElement()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 11:56:08 26 4
gpt4 key购买 nike

本文整理了Java中com.koolearn.klibrary.text.view.ZLTextParagraphCursor.getElement()方法的一些代码示例,展示了ZLTextParagraphCursor.getElement()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZLTextParagraphCursor.getElement()方法的具体详情如下:
包路径:com.koolearn.klibrary.text.view.ZLTextParagraphCursor
类名称:ZLTextParagraphCursor
方法名:getElement

ZLTextParagraphCursor.getElement介绍

暂无

代码示例

代码示例来源:origin: ydcx/KooReader

public ZLTextElement getElement() {
  return myParagraphCursor.getElement(myElementIndex);
}

代码示例来源:origin: Jiangzqts/EpubRead

public ZLTextElement getElement() {
  return myParagraphCursor.getElement(myElementIndex);
}

代码示例来源:origin: ydcx/KooReader

public void setCharIndex(int charIndex) {
  charIndex = Math.max(0, charIndex);
  myCharIndex = 0;
  if (charIndex > 0) {
    ZLTextElement element = myParagraphCursor.getElement(myElementIndex);
    if (element instanceof ZLTextWord) {
      if (charIndex <= ((ZLTextWord) element).Length) {
        myCharIndex = charIndex;
      }
    }
  }
}

代码示例来源:origin: Jiangzqts/EpubRead

public void setCharIndex(int charIndex) {
  charIndex = Math.max(0, charIndex);
  myCharIndex = 0;
  if (charIndex > 0) {
    ZLTextElement element = myParagraphCursor.getElement(myElementIndex);
    if (element instanceof ZLTextWord) {
      if (charIndex <= ((ZLTextWord) element).Length) {
        myCharIndex = charIndex;
      }
    }
  }
}

代码示例来源:origin: ydcx/KooReader

void applyStyleChanges(ZLTextParagraphCursor cursor, int index, int end) {
  for (; index != end; ++index) {
    applyStyleChangeElement(cursor.getElement(index));
  }
}

代码示例来源:origin: Jiangzqts/EpubRead

void applyStyleChanges(ZLTextParagraphCursor cursor, int index, int end) {
  for (; index != end; ++index) {
    applyStyleChangeElement(cursor.getElement(index));
  }
}

代码示例来源:origin: Jiangzqts/EpubRead

int getAreaLength(ZLTextParagraphCursor paragraph, ZLTextElementArea area, int toCharIndex) {
  setTextStyle(area.Style);
  final ZLTextWord word = (ZLTextWord) paragraph.getElement(area.ElementIndex);
  int length = toCharIndex - area.CharIndex;
  boolean selectHyphenationSign = false;
  if (length >= area.Length) {
    selectHyphenationSign = area.AddHyphenationSign;
    length = area.Length;
  }
  if (length > 0) {
    return getWordWidth(word, area.CharIndex, length, selectHyphenationSign);
  }
  return 0;
}

代码示例来源:origin: ydcx/KooReader

int getAreaLength(ZLTextParagraphCursor paragraph, ZLTextElementArea area, int toCharIndex) {
  setTextStyle(area.Style);
  final ZLTextWord word = (ZLTextWord) paragraph.getElement(area.ElementIndex);
  int length = toCharIndex - area.CharIndex;
  boolean selectHyphenationSign = false;
  if (length >= area.Length) {
    selectHyphenationSign = area.AddHyphenationSign;
    length = area.Length;
  }
  if (length > 0) {
    return getWordWidth(word, area.CharIndex, length, selectHyphenationSign);
  }
  return 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: 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: ydcx/KooReader

@Override
public ZLTextPosition getEndPosition() {
  if (isEmpty()) {
    return null;
  }
  final ZLTextParagraphCursor cursor = myView.cursor(myRightMostRegionSoul.ParagraphIndex);
  final ZLTextElement element = cursor.getElement(myRightMostRegionSoul.EndElementIndex);
  return new ZLTextFixedPosition(
    myRightMostRegionSoul.ParagraphIndex,
    myRightMostRegionSoul.EndElementIndex,
    element instanceof ZLTextWord ? ((ZLTextWord)element).Length : 0
  );
}

代码示例来源:origin: Jiangzqts/EpubRead

@Override
public ZLTextPosition getEndPosition() {
  if (isEmpty()) {
    return null;
  }
  final ZLTextParagraphCursor cursor = myView.cursor(myRightMostRegionSoul.ParagraphIndex);
  final ZLTextElement element = cursor.getElement(myRightMostRegionSoul.EndElementIndex);
  return new ZLTextFixedPosition(
    myRightMostRegionSoul.ParagraphIndex,
    myRightMostRegionSoul.EndElementIndex,
    element instanceof ZLTextWord ? ((ZLTextWord)element).Length : 0
  );
}

代码示例来源:origin: ydcx/KooReader

ZLTextElement element = paragraphCursor.getElement(currentElementIndex);
while (isStyleChangeElement(element)) {
  applyStyleChangeElement(element);
    break;
  element = paragraphCursor.getElement(currentElementIndex);
ZLTextElement element = paragraphCursor.getElement(currentElementIndex);
newWidth += getElementWidth(element, currentCharIndex);
newHeight = Math.max(newHeight, getElementHeight(element));
boolean allowBreak = currentElementIndex == endIndex;
if (!allowBreak) {
  element = paragraphCursor.getElement(currentElementIndex);
  allowBreak =
      previousElement != ZLTextElement.NBSpace &&
ZLTextElement element = paragraphCursor.getElement(currentElementIndex);
if (element instanceof ZLTextWord) {
  final ZLTextWord word = (ZLTextWord) element;

代码示例来源:origin: Jiangzqts/EpubRead

ZLTextElement element = paragraphCursor.getElement(currentElementIndex);
while (isStyleChangeElement(element)) {
  applyStyleChangeElement(element);
    break;
  element = paragraphCursor.getElement(currentElementIndex);
ZLTextElement element = paragraphCursor.getElement(currentElementIndex);
newWidth += getElementWidth(element, currentCharIndex);
newHeight = Math.max(newHeight, getElementHeight(element));
boolean allowBreak = currentElementIndex == endIndex;
if (!allowBreak) {
  element = paragraphCursor.getElement(currentElementIndex);
  allowBreak =
      previousElement != ZLTextElement.NBSpace &&
ZLTextElement element = paragraphCursor.getElement(currentElementIndex);
if (element instanceof ZLTextWord) {
  final ZLTextWord word = (ZLTextWord) element;

代码示例来源: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();
      }
    }
  }
}

代码示例来源: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: Jiangzqts/EpubRead

break;
  case ZLTextAlignmentType.ALIGN_JUSTIFY:
    if (!endOfParagraph && (paragraphCursor.getElement(info.EndElementIndex) != ZLTextElement.AfterParagraph)) {
      fullCorrection = maxWidth - getTextStyle().getRightIndent(metrics()) - info.Width;
ZLTextElementArea spaceElement = null;
for (int wordIndex = info.RealStartElementIndex; wordIndex != endElementIndex; ++wordIndex, charIndex = 0) {
  final ZLTextElement element = paragraph.getElement(wordIndex);
  final int width = getElementWidth(element, charIndex);
  if (element == ZLTextElement.HSpace) {
  if (len > 0) {
    final int wordIndex = info.EndElementIndex;
    final ZLTextWord word = (ZLTextWord) paragraph.getElement(wordIndex);
    final boolean addHyphenationSign = word.Data[word.Offset + len - 1] != '-';
    final int width = getWordWidth(word, 0, len, addHyphenationSign);

代码示例来源:origin: ydcx/KooReader

break;
  case ZLTextAlignmentType.ALIGN_JUSTIFY:
    if (!endOfParagraph && (paragraphCursor.getElement(info.EndElementIndex) != ZLTextElement.AfterParagraph)) {
      fullCorrection = maxWidth - getTextStyle().getRightIndent(metrics()) - info.Width;
ZLTextElementArea spaceElement = null;
for (int wordIndex = info.RealStartElementIndex; wordIndex != endElementIndex; ++wordIndex, charIndex = 0) {
  final ZLTextElement element = paragraph.getElement(wordIndex);
  final int width = getElementWidth(element, charIndex);
  if (element == ZLTextElement.HSpace) {
  if (len > 0) {
    final int wordIndex = info.EndElementIndex;
    final ZLTextWord word = (ZLTextWord) paragraph.getElement(wordIndex);
    final boolean addHyphenationSign = word.Data[word.Offset + len - 1] != '-';
    final int width = getWordWidth(word, 0, len, addHyphenationSign);

代码示例来源:origin: Jiangzqts/EpubRead

final ZLTextElement element = paragraph.getElement(wordIndex);
final ZLTextElementArea area = pageAreas.get(index);
if (element == area.Element) {
    ? info.StartCharIndex : 0;
final int len = info.EndCharIndex - start;
final ZLTextWord word = (ZLTextWord) paragraph.getElement(info.EndElementIndex);
final ZLTextPosition pos =
    new ZLTextFixedPosition(info.ParagraphCursor.Index, info.EndElementIndex, 0);

代码示例来源:origin: ydcx/KooReader

final ZLTextElement element = paragraph.getElement(wordIndex);
final ZLTextElementArea area = pageAreas.get(index);
if (element == area.Element) {
    ? info.StartCharIndex : 0;
final int len = info.EndCharIndex - start;
final ZLTextWord word = (ZLTextWord) paragraph.getElement(info.EndElementIndex);
final ZLTextPosition pos =
    new ZLTextFixedPosition(info.ParagraphCursor.Index, info.EndElementIndex, 0);

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com