public int getParagraphElementsCount(int paragraphIndex) { final ZLTextWordCursor cursor = new ZLTextWordCursor(getReader().getTextView().getStartCursor()); cursor.moveToParagraph(paragraphIndex); cursor.moveToParagraphEnd(); return cursor.getElementIndex(); }
public ArrayList<Integer> getParagraphWordIndices(int paragraphIndex) { final ArrayList<Integer> indices = new ArrayList<Integer>(); final ZLTextWordCursor cursor = new ZLTextWordCursor(getReader().getTextView().getStartCursor()); cursor.moveToParagraph(paragraphIndex); cursor.moveToParagraphStart(); while (!cursor.isEndOfParagraph()) { ZLTextElement element = cursor.getElement(); if (element instanceof ZLTextWord) { indices.add(cursor.getElementIndex()); } cursor.nextWord(); } return indices; }
public List<String> getParagraphWords(int paragraphIndex) { final ArrayList<String> words = new ArrayList<String>(); final ZLTextWordCursor cursor = new ZLTextWordCursor(getReader().getTextView().getStartCursor()); cursor.moveToParagraph(paragraphIndex); cursor.moveToParagraphStart(); while (!cursor.isEndOfParagraph()) { ZLTextElement element = cursor.getElement(); if (element instanceof ZLTextWord) { words.add(element.toString()); } cursor.nextWord(); } return words; }
public String getParagraphText(int paragraphIndex) { final StringBuffer sb = new StringBuffer(); final ZLTextWordCursor cursor = new ZLTextWordCursor(getReader().getTextView().getStartCursor()); cursor.moveToParagraph(paragraphIndex); cursor.moveToParagraphStart(); while (!cursor.isEndOfParagraph()) { ZLTextElement element = cursor.getElement(); if (element instanceof ZLTextWord) { sb.append(element.toString() + " "); } cursor.nextWord(); } return sb.toString(); }
private TextPosition getTextPosition(ZLTextWordCursor cursor) { return new TextPosition( cursor.getParagraphIndex(), cursor.getElementIndex(), cursor.getCharIndex()); }
public boolean isPageEndOfText() { final ZLTextWordCursor cursor = getReader().getTextView().getEndCursor(); return cursor.isEndOfParagraph() && cursor.getParagraphCursor().isLast(); }